summaryrefslogtreecommitdiff
path: root/src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2022-11-08 14:58:05 -0800
committerRob Mensching <rob@firegiant.com>2022-11-08 16:20:25 -0800
commitc843b47d6233153fa961c6d0e61edf7cedf255bb (patch)
tree9eae6badd42d3badb8665b7414b4d44ca48d6ae1 /src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs
parent7e498d6348c26583972ea1cdf7d51dadc8f5b792 (diff)
downloadwix-c843b47d6233153fa961c6d0e61edf7cedf255bb.tar.gz
wix-c843b47d6233153fa961c6d0e61edf7cedf255bb.tar.bz2
wix-c843b47d6233153fa961c6d0e61edf7cedf255bb.zip
Separate WixInternal content from official WixToolset namespace
Diffstat (limited to 'src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs')
-rw-r--r--src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs104
1 files changed, 0 insertions, 104 deletions
diff --git a/src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs b/src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs
deleted file mode 100644
index d950bca9..00000000
--- a/src/internal/WixToolset.BaseBuildTasks.Sources/WixCommandLineBuilder.cs
+++ /dev/null
@@ -1,104 +0,0 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolset.BaseBuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Globalization;
8 using System.IO;
9
10 using Microsoft.Build.Framework;
11 using Microsoft.Build.Utilities;
12
13 /// <summary>
14 /// Helper class for appending the command line arguments.
15 /// </summary>
16 public class WixCommandLineBuilder : CommandLineBuilder
17 {
18 internal const int Unspecified = -1;
19
20 /// <summary>
21 /// Append a switch to the command line if the value has been specified.
22 /// </summary>
23 /// <param name="switchName">Switch to append.</param>
24 /// <param name="value">Value specified by the user.</param>
25 public void AppendIfSpecified(string switchName, int value)
26 {
27 if (value != Unspecified)
28 {
29 this.AppendSwitchIfNotNull(switchName, value.ToString(CultureInfo.InvariantCulture));
30 }
31 }
32
33 /// <summary>
34 /// Append a switch to the command line if the condition is true.
35 /// </summary>
36 /// <param name="switchName">Switch to append.</param>
37 /// <param name="condition">Condition specified by the user.</param>
38 public void AppendIfTrue(string switchName, bool condition)
39 {
40 if (condition)
41 {
42 this.AppendSwitch(switchName);
43 }
44 }
45
46 /// <summary>
47 /// Append a switch to the command line if any values in the array have been specified.
48 /// </summary>
49 /// <param name="switchName">Switch to append.</param>
50 /// <param name="values">Values specified by the user.</param>
51 public void AppendArrayIfNotNull(string switchName, IEnumerable<ITaskItem> values)
52 {
53 if (values != null)
54 {
55 foreach (ITaskItem value in values)
56 {
57 this.AppendSwitchIfNotNull(switchName, value);
58 }
59 }
60 }
61
62 /// <summary>
63 /// Append a switch to the command line if any values in the array have been specified.
64 /// </summary>
65 /// <param name="switchName">Switch to append.</param>
66 /// <param name="values">Values specified by the user.</param>
67 public void AppendArrayIfNotNull(string switchName, IEnumerable<string> values)
68 {
69 if (values != null)
70 {
71 foreach (string value in values)
72 {
73 this.AppendSwitchIfNotNull(switchName, value);
74 }
75 }
76 }
77
78 /// <summary>
79 /// Append arbitrary text to the command-line if specified.
80 /// </summary>
81 /// <param name="textToAppend">Text to append.</param>
82 public void AppendTextIfNotNull(string textToAppend)
83 {
84 if (!String.IsNullOrEmpty(textToAppend))
85 {
86 this.AppendSpaceIfNotEmpty();
87 this.AppendTextUnquoted(textToAppend);
88 }
89 }
90
91 /// <summary>
92 /// Append arbitrary text to the command-line if specified.
93 /// </summary>
94 /// <param name="textToAppend">Text to append.</param>
95 public void AppendTextIfNotWhitespace(string textToAppend)
96 {
97 if (!String.IsNullOrWhiteSpace(textToAppend))
98 {
99 this.AppendSpaceIfNotEmpty();
100 this.AppendTextUnquoted(textToAppend);
101 }
102 }
103 }
104}