aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-01-19 15:38:47 -0600
committerSean Hall <r.sean.hall@gmail.com>2021-01-19 15:56:43 -0600
commit453107d72fa96e7b942ef4698ab10e4bcac91d2e (patch)
tree3f3f0ba134746a83493607f1567510da1c87ad38
parentc941c5365e59127274f53b329da53c052aad0215 (diff)
downloadwix-453107d72fa96e7b942ef4698ab10e4bcac91d2e.tar.gz
wix-453107d72fa96e7b942ef4698ab10e4bcac91d2e.tar.bz2
wix-453107d72fa96e7b942ef4698ab10e4bcac91d2e.zip
Use new logic for -sw in DecompileCommand.
-rw-r--r--src/WixToolset.Core/CommandLine/DecompileCommand.cs37
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs3
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs2
3 files changed, 30 insertions, 12 deletions
diff --git a/src/WixToolset.Core/CommandLine/DecompileCommand.cs b/src/WixToolset.Core/CommandLine/DecompileCommand.cs
index 393e2a4e..06402a13 100644
--- a/src/WixToolset.Core/CommandLine/DecompileCommand.cs
+++ b/src/WixToolset.Core/CommandLine/DecompileCommand.cs
@@ -128,19 +128,19 @@ namespace WixToolset.Core.CommandLine
128 case "verbose": 128 case "verbose":
129 this.Messaging.ShowVerboseMessages = true; 129 this.Messaging.ShowVerboseMessages = true;
130 return true; 130 return true;
131 }
131 132
132 case "sw": 133 if (parameter.StartsWith("sw"))
133 case "suppresswarning": 134 {
134 var warning = parser.GetNextArgumentOrError(arg); 135 this.ParseSuppressWarning(parameter, "sw".Length, parser);
135 if (!String.IsNullOrEmpty(warning))
136 {
137 var warningNumber = Convert.ToInt32(warning);
138 this.Messaging.SuppressWarningMessage(warningNumber);
139 }
140 return true; 136 return true;
141 } 137 }
142 138 else if (parameter.StartsWith("suppresswarning"))
143 if (parameter.StartsWith("wx")) 139 {
140 this.ParseSuppressWarning(parameter, "suppresswarning".Length, parser);
141 return true;
142 }
143 else if (parameter.StartsWith("wx"))
144 { 144 {
145 this.ParseWarningAsError(parameter, "wx".Length, parser); 145 this.ParseWarningAsError(parameter, "wx".Length, parser);
146 return true; 146 return true;
@@ -218,6 +218,23 @@ namespace WixToolset.Core.CommandLine
218 return String.IsNullOrEmpty(this.OutputFile) ? Path.ChangeExtension(this.DecompileFilePath, ".wxs") : this.OutputFile; 218 return String.IsNullOrEmpty(this.OutputFile) ? Path.ChangeExtension(this.DecompileFilePath, ".wxs") : this.OutputFile;
219 } 219 }
220 220
221 private void ParseSuppressWarning(string parameter, int offset, ICommandLineParser parser)
222 {
223 var paramArg = parameter.Substring(offset);
224 if (paramArg.Length == 0)
225 {
226 this.Messaging.SuppressAllWarnings = true;
227 }
228 else if (Int32.TryParse(paramArg, out var suppressWarning) && suppressWarning > 0)
229 {
230 this.Messaging.SuppressWarningMessage(suppressWarning);
231 }
232 else
233 {
234 parser.ReportErrorArgument(parameter, ErrorMessages.IllegalSuppressWarningId(paramArg));
235 }
236 }
237
221 private void ParseWarningAsError(string parameter, int offset, ICommandLineParser parser) 238 private void ParseWarningAsError(string parameter, int offset, ICommandLineParser parser)
222 { 239 {
223 var paramArg = parameter.Substring(offset); 240 var paramArg = parameter.Substring(offset);
diff --git a/src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs b/src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs
index 3ee88640..f9cd2c70 100644
--- a/src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/CustomTableFixture.cs
@@ -216,9 +216,10 @@ namespace WixToolsetTest.CoreIntegration
216 result.AssertSuccess(); 216 result.AssertSuccess();
217 Assert.True(File.Exists(msiPath)); 217 Assert.True(File.Exists(msiPath));
218 218
219 result = WixRunner.Execute(false, new[] 219 result = WixRunner.Execute(new[]
220 { 220 {
221 "decompile", msiPath, 221 "decompile", msiPath,
222 "-sw1060",
222 "-intermediateFolder", intermediateFolder, 223 "-intermediateFolder", intermediateFolder,
223 "-o", decompiledWxsPath 224 "-o", decompiledWxsPath
224 }); 225 });
diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
index 924337ba..b07f5bda 100644
--- a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
@@ -20,7 +20,7 @@ namespace WixToolsetTest.CoreIntegration
20 var intermediateFolder = fs.GetFolder(); 20 var intermediateFolder = fs.GetFolder();
21 var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs"); 21 var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs");
22 22
23 var result = WixRunner.Execute(false, new[] 23 var result = WixRunner.Execute(new[]
24 { 24 {
25 "decompile", 25 "decompile",
26 Path.Combine(folder, msiName), 26 Path.Combine(folder, msiName),