aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/WixToolset.Core.Burn/BundleBackend.cs4
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs75
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs (renamed from src/WixToolset.Core.WindowsInstaller/Decompiler.cs)5447
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Decompile/DecompilerCore.cs (renamed from src/WixToolset.Core.WindowsInstaller/DecompilerCore.cs)60
-rw-r--r--src/WixToolset.Core.WindowsInstaller/MsiBackend.cs23
-rw-r--r--src/WixToolset.Core.WindowsInstaller/MsmBackend.cs23
-rw-r--r--src/WixToolset.Core.WindowsInstaller/MspBackend.cs4
-rw-r--r--src/WixToolset.Core.WindowsInstaller/MstBackend.cs4
-rw-r--r--src/WixToolset.Core/CommandLine/DecompileCommand.cs212
-rw-r--r--src/WixToolset.Core/DecompileContext.cs20
-rw-r--r--src/WixToolset.Core/Decompiler.cs12
-rw-r--r--src/WixToolset.Core/IDecompiler.cs4
-rw-r--r--src/WixToolset.Core/OptimizeCA.cs4
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs41
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs21
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.cabbin0 -> 137 bytes
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.msibin0 -> 32768 bytes
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj3
18 files changed, 3095 insertions, 2862 deletions
diff --git a/src/WixToolset.Core.Burn/BundleBackend.cs b/src/WixToolset.Core.Burn/BundleBackend.cs
index 3baa526e..1d833b93 100644
--- a/src/WixToolset.Core.Burn/BundleBackend.cs
+++ b/src/WixToolset.Core.Burn/BundleBackend.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core.Burn 3namespace WixToolset.Core.Burn
4{ 4{
@@ -27,7 +27,7 @@ namespace WixToolset.Core.Burn
27 return new BindResult { FileTransfers = command.FileTransfers, TrackedFiles = command.TrackedFiles }; 27 return new BindResult { FileTransfers = command.FileTransfers, TrackedFiles = command.TrackedFiles };
28 } 28 }
29 29
30 public BindResult Decompile(IDecompileContext context) 30 public DecompileResult Decompile(IDecompileContext context)
31 { 31 {
32 throw new NotImplementedException(); 32 throw new NotImplementedException();
33 } 33 }
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs
new file mode 100644
index 00000000..130f5ea8
--- /dev/null
+++ b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs
@@ -0,0 +1,75 @@
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.Core.WindowsInstaller.Unbind
4{
5 using System;
6 using System.Collections.Generic;
7 using System.ComponentModel;
8 using System.Xml.Linq;
9 using WixToolset.Core.Native;
10 using WixToolset.Data;
11 using WixToolset.Extensibility;
12 using WixToolset.Extensibility.Data;
13 using WixToolset.Extensibility.Services;
14 using WixToolset.Msi;
15
16 internal class DecompileMsiOrMsmCommand
17 {
18 public DecompileMsiOrMsmCommand(IDecompileContext context, IEnumerable<IWindowsInstallerBackendDecompilerExtension> backendExtensions)
19 {
20 this.Context = context;
21 this.Extensions = backendExtensions;
22 this.Messaging = context.ServiceProvider.GetService<IMessaging>();
23 }
24
25 private IDecompileContext Context { get; }
26
27 private IEnumerable<IWindowsInstallerBackendDecompilerExtension> Extensions { get; }
28
29 private IMessaging Messaging { get; }
30
31 public DecompileResult Execute()
32 {
33 var result = new DecompileResult();
34
35 try
36 {
37 using (var database = new Database(this.Context.DecompilePath, OpenDatabase.ReadOnly))
38 {
39 var unbindCommand = new UnbindDatabaseCommand(this.Messaging, database, this.Context.DecompilePath, this.Context.DecompileType, this.Context.ExtractFolder, this.Context.IntermediateFolder, this.Context.IsAdminImage, false, skipSummaryInfo: false);
40 var output = unbindCommand.Execute();
41
42 var decompiler = new Decompiler(this.Messaging, this.Extensions, this.Context.BaseSourcePath, this.Context.SuppressCustomTables, this.Context.SuppressDroppingEmptyTables, this.Context.SuppressUI, this.Context.TreatProductAsModule);
43 var wxs = decompiler.Decompile(output);
44
45 wxs.Save(this.Context.OutputPath, SaveOptions.OmitDuplicateNamespaces);
46 result.SourceDocumentPath = this.Context.OutputPath;
47
48 // extract the files from the cabinets
49 if (!String.IsNullOrEmpty(this.Context.ExtractFolder) && !this.Context.SuppressExtractCabinets)
50 {
51 var extractCommand = new ExtractCabinetsCommand(output, database, this.Context.DecompilePath, this.Context.ExtractFolder, this.Context.IntermediateFolder);
52 extractCommand.Execute();
53
54 result.ExtractedFilePaths = extractCommand.ExtractedFiles;
55 }
56 else
57 {
58 result.ExtractedFilePaths = new string[0];
59 }
60 }
61 }
62 catch (Win32Exception e)
63 {
64 if (0x6E == e.NativeErrorCode) // ERROR_OPEN_FAILED
65 {
66 throw new WixException(ErrorMessages.OpenDatabaseFailed(this.Context.DecompilePath));
67 }
68
69 throw;
70 }
71
72 return result;
73 }
74 }
75}
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
index c5d68db3..26e1f399 100644
--- a/src/WixToolset.Core.WindowsInstaller/Decompiler.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
@@ -6,181 +6,104 @@ namespace WixToolset.Core.WindowsInstaller
6 using System.Collections; 6 using System.Collections;
7 using System.Collections.Generic; 7 using System.Collections.Generic;
8 using System.Collections.Specialized; 8 using System.Collections.Specialized;
9 using System.Diagnostics.CodeAnalysis;
10 using System.Globalization; 9 using System.Globalization;
11 using System.IO; 10 using System.IO;
11 using System.Linq;
12 using System.Text; 12 using System.Text;
13 using System.Text.RegularExpressions; 13 using System.Text.RegularExpressions;
14 using System.Xml.Linq;
15 using WixToolset.Core;
16 using WixToolset.Core.Native;
17 using WixToolset.Core.WindowsInstaller.Rows;
14 using WixToolset.Data; 18 using WixToolset.Data;
19 using WixToolset.Data.Tuples;
20 using WixToolset.Data.WindowsInstaller;
21 using WixToolset.Data.WindowsInstaller.Rows;
15 using WixToolset.Extensibility; 22 using WixToolset.Extensibility;
16 using WixToolset.Core.Native; 23 using WixToolset.Extensibility.Services;
17 using Wix = WixToolset.Data.Serialize; 24 using Wix = WixToolset.Data.Serialize;
18 using WixToolset.Core;
19 25
20 /// <summary> 26 /// <summary>
21 /// Decompiles an msi database into WiX source. 27 /// Decompiles an msi database into WiX source.
22 /// </summary> 28 /// </summary>
23 public class Decompiler 29 internal class Decompiler
24 { 30 {
25 private static readonly Regex NullSplitter = new Regex(@"\[~]"); 31 private static readonly Regex NullSplitter = new Regex(@"\[~]");
26#if TODO 32
27 private int codepage;
28 private bool compressed; 33 private bool compressed;
29 private bool shortNames; 34 private bool shortNames;
30 private DecompilerCore core; 35 private DecompilerCore core;
31 private string exportFilePath;
32 private List<IDecompilerExtension> extensions;
33 private Dictionary<string, IDecompilerExtension> extensionsByTableName;
34 private string modularizationGuid; 36 private string modularizationGuid;
35 private OutputType outputType; 37 private readonly Hashtable patchTargetFiles;
36 private Hashtable patchTargetFiles; 38 private readonly Hashtable sequenceElements;
37 private Hashtable sequenceElements; 39 private readonly TableDefinitionCollection tableDefinitions;
38 private bool showPedanticMessages;
39 private WixActionRowCollection standardActions;
40 private bool suppressCustomTables;
41 private bool suppressDroppingEmptyTables;
42 private bool suppressRelativeActionSequencing;
43 private bool suppressUI;
44 private TableDefinitionCollection tableDefinitions;
45 // private TempFileCollection tempFiles;
46 private bool treatProductAsModule;
47 40
48 /// <summary> 41 /// <summary>
49 /// Creates a new decompiler object with a default set of table definitions. 42 /// Creates a new decompiler object with a default set of table definitions.
50 /// </summary> 43 /// </summary>
51 public Decompiler() 44 public Decompiler(IMessaging messaging, IEnumerable<IWindowsInstallerBackendDecompilerExtension> extensions, string baseSourcePath, bool suppressCustomTables, bool suppressDroppingEmptyTables, bool suppressUI, bool treatProductAsModule)
52 { 45 {
53 this.standardActions = WindowsInstallerStandard.GetStandardActions(); 46 this.Messaging = messaging;
47 this.Extensions = extensions;
48 this.BaseSourcePath = String.IsNullOrEmpty(baseSourcePath) ? "SourceDir" : baseSourcePath;
49 this.SuppressCustomTables = suppressCustomTables;
50 this.SuppressDroppingEmptyTables = suppressDroppingEmptyTables;
51 this.SuppressUI = suppressUI;
52 this.TreatProductAsModule = treatProductAsModule;
53
54 this.ExtensionsByTableName = new Dictionary<string, IWindowsInstallerBackendDecompilerExtension>();
55 this.StandardActions = WindowsInstallerStandard.StandardActions().ToDictionary(a => a.Id.Id);
54 56
55 this.extensions = new List<IDecompilerExtension>();
56 this.extensionsByTableName = new Dictionary<string,IDecompilerExtension>();
57 this.patchTargetFiles = new Hashtable(); 57 this.patchTargetFiles = new Hashtable();
58 this.sequenceElements = new Hashtable(); 58 this.sequenceElements = new Hashtable();
59 this.tableDefinitions = new TableDefinitionCollection(); 59 this.tableDefinitions = new TableDefinitionCollection();
60 this.exportFilePath = "SourceDir";
61 } 60 }
62 61
63 /// <summary> 62 private IMessaging Messaging { get; }
64 /// Gets or sets the base source file path.
65 /// </summary>
66 /// <value>Base source file path.</value>
67 public string ExportFilePath
68 {
69 get { return this.exportFilePath; }
70 set { this.exportFilePath = value; }
71 }
72 63
73 /// <summary> 64 private IEnumerable<IWindowsInstallerBackendDecompilerExtension> Extensions { get; }
74 /// Gets or sets the option to show pedantic messages.
75 /// </summary>
76 /// <value>The option to show pedantic messages.</value>
77 public bool ShowPedanticMessages
78 {
79 get { return this.showPedanticMessages; }
80 set { this.showPedanticMessages = value; }
81 }
82 65
83 /// <summary> 66 private Dictionary<string, IWindowsInstallerBackendDecompilerExtension> ExtensionsByTableName { get; }
84 /// Gets or sets the option to suppress custom tables.
85 /// </summary>
86 /// <value>The option to suppress dropping empty tables.</value>
87 public bool SuppressCustomTables
88 {
89 get { return this.suppressCustomTables; }
90 set { this.suppressCustomTables = value; }
91 }
92 67
93 /// <summary> 68 private string BaseSourcePath { get; }
94 /// Gets or sets the option to suppress dropping empty tables.
95 /// </summary>
96 /// <value>The option to suppress dropping empty tables.</value>
97 public bool SuppressDroppingEmptyTables
98 {
99 get { return this.suppressDroppingEmptyTables; }
100 set { this.suppressDroppingEmptyTables = value; }
101 }
102 69
103 /// <summary> 70 private bool SuppressCustomTables { get; }
104 /// Gets or sets the option to suppress decompiling with relative action sequencing (uses sequence numbers).
105 /// </summary>
106 /// <value>The option to suppress decompiling with relative action sequencing (uses sequence numbers).</value>
107 public bool SuppressRelativeActionSequencing
108 {
109 get { return this.suppressRelativeActionSequencing; }
110 set { this.suppressRelativeActionSequencing = value; }
111 }
112 71
113 /// <summary> 72 private bool SuppressDroppingEmptyTables { get; }
114 /// Gets or sets the option to suppress decompiling UI-related tables.
115 /// </summary>
116 /// <value>The option to suppress decompiling UI-related tables.</value>
117 public bool SuppressUI
118 {
119 get { return this.suppressUI; }
120 set { this.suppressUI = value; }
121 }
122 73
123 /// <summary> 74 private bool SuppressRelativeActionSequencing { get; }
124 /// Gets or sets the temporary path for the Decompiler. If left null, the decompiler
125 /// will use %TEMP% environment variable.
126 /// </summary>
127 /// <value>Path to temp files.</value>
128 public string TempFilesLocation
129 {
130 get
131 {
132 // return null == this.tempFiles ? String.Empty : this.tempFiles.BasePath;
133 return Path.GetTempPath();
134 }
135 75
136 // set 76 private bool SuppressUI { get; }
137 // {
138 // if (null == value)
139 // {
140 // this.tempFiles = new TempFileCollection();
141 // }
142 // else
143 // {
144 // this.tempFiles = new TempFileCollection(value);
145 // }
146 // }
147 }
148 77
149 /// <summary> 78 private bool TreatProductAsModule { get; }
150 /// Gets or sets whether the decompiler should use module logic on a product output. 79
151 /// </summary> 80 private OutputType OutputType { get; set; }
152 /// <value>The option to treat a product like a module</value> 81
153 public bool TreatProductAsModule 82 private Dictionary<string, WixActionTuple> StandardActions { get; }
154 {
155 get { return this.treatProductAsModule; }
156 set { this.treatProductAsModule = value; }
157 }
158 83
159 /// <summary> 84 /// <summary>
160 /// Decompile the database file. 85 /// Decompile the database file.
161 /// </summary> 86 /// </summary>
162 /// <param name="output">The output to decompile.</param> 87 /// <param name="output">The output to decompile.</param>
163 /// <returns>The serialized WiX source code.</returns> 88 /// <returns>The serialized WiX source code.</returns>
164 [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")] 89 public XDocument Decompile(Output output)
165 public Wix.Wix Decompile(Output output)
166 { 90 {
167 if (null == output) 91 if (null == output)
168 { 92 {
169 throw new ArgumentNullException("output"); 93 throw new ArgumentNullException("output");
170 } 94 }
171 95
172 this.codepage = output.Codepage; 96 this.OutputType = output.Type;
173 this.outputType = output.Type;
174 97
175 // collect the table definitions from the output 98 // collect the table definitions from the output
176 this.tableDefinitions.Clear(); 99 this.tableDefinitions.Clear();
177 foreach (Table table in output.Tables) 100 foreach (var table in output.Tables)
178 { 101 {
179 this.tableDefinitions.Add(table.Definition); 102 this.tableDefinitions.Add(table.Definition);
180 } 103 }
181 104
182 // add any missing standard and wix-specific table definitions 105 // add any missing standard and wix-specific table definitions
183 foreach (TableDefinition tableDefinition in WindowsInstallerStandard.GetTableDefinitions()) 106 foreach (var tableDefinition in WindowsInstallerStandardInternal.GetTableDefinitions())
184 { 107 {
185 if (!this.tableDefinitions.Contains(tableDefinition.Name)) 108 if (!this.tableDefinitions.Contains(tableDefinition.Name))
186 { 109 {
@@ -189,46 +112,29 @@ namespace WixToolset.Core.WindowsInstaller
189 } 112 }
190 113
191 // add any missing extension table definitions 114 // add any missing extension table definitions
192 foreach (IDecompilerExtension extension in this.extensions) 115#if TODO_DECOMPILER_EXTENSIONS
193 { 116 foreach (var extension in this.Extensions)
194 if (null != extension.TableDefinitions)
195 {
196 foreach (TableDefinition tableDefinition in extension.TableDefinitions)
197 {
198 if (!this.tableDefinitions.Contains(tableDefinition.Name))
199 {
200 this.tableDefinitions.Add(tableDefinition);
201 }
202 }
203 }
204 }
205
206 // if we don't have the temporary files object yet, get one
207#if REDO_IN_NETCORE
208 if (null == this.tempFiles)
209 { 117 {
210 this.TempFilesLocation = null; 118 this.AddExtension(extension);
211 } 119 }
212#endif 120#endif
213 Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there
214 121
215 bool encounteredError = false; 122 var wixElement = new Wix.Wix();
216 Wix.IParentElement rootElement; 123 Wix.IParentElement rootElement;
217 Wix.Wix wixElement = new Wix.Wix();
218 124
219 switch (this.outputType) 125 switch (this.OutputType)
220 { 126 {
221 case OutputType.Module: 127 case OutputType.Module:
222 rootElement = new Wix.Module(); 128 rootElement = new Wix.Module();
223 break; 129 break;
224 case OutputType.PatchCreation: 130 case OutputType.PatchCreation:
225 rootElement = new Wix.PatchCreation(); 131 rootElement = new Wix.PatchCreation();
226 break; 132 break;
227 case OutputType.Product: 133 case OutputType.Product:
228 rootElement = new Wix.Product(); 134 rootElement = new Wix.Product();
229 break; 135 break;
230 default: 136 default:
231 throw new InvalidOperationException(WixStrings.EXP_UnknownOutputType); 137 throw new InvalidOperationException("Unknown output type.");
232 } 138 }
233 wixElement.AddChild((Wix.ISchemaElement)rootElement); 139 wixElement.AddChild((Wix.ISchemaElement)rootElement);
234 140
@@ -236,24 +142,17 @@ namespace WixToolset.Core.WindowsInstaller
236 try 142 try
237 { 143 {
238 this.core = new DecompilerCore(rootElement); 144 this.core = new DecompilerCore(rootElement);
239 this.core.ShowPedanticMessages = this.showPedanticMessages;
240 145
241 // stop processing if an error previously occurred 146 // stop processing if an error previously occurred
242 if (this.core.EncounteredError) 147 if (this.Messaging.EncounteredError)
243 { 148 {
244 return null; 149 return null;
245 } 150 }
246 151
247 // initialize the decompiler and its extensions 152 this.InitializeDecompile(output.Tables, output.Codepage);
248 foreach (IDecompilerExtension extension in this.extensions)
249 {
250 extension.Core = this.core;
251 extension.Initialize(output.Tables);
252 }
253 this.InitializeDecompile(output.Tables);
254 153
255 // stop processing if an error previously occurred 154 // stop processing if an error previously occurred
256 if (this.core.EncounteredError) 155 if (this.Messaging.EncounteredError)
257 { 156 {
258 return null; 157 return null;
259 } 158 }
@@ -263,79 +162,41 @@ namespace WixToolset.Core.WindowsInstaller
263 162
264 // finalize the decompiler and its extensions 163 // finalize the decompiler and its extensions
265 this.FinalizeDecompile(output.Tables); 164 this.FinalizeDecompile(output.Tables);
266 foreach (IDecompilerExtension extension in this.extensions)
267 {
268 extension.Finish(output.Tables);
269 }
270 } 165 }
271 finally 166 finally
272 { 167 {
273 encounteredError = this.core.EncounteredError;
274
275 this.core = null; 168 this.core = null;
276 foreach (IDecompilerExtension extension in this.extensions)
277 {
278 extension.Core = null;
279 }
280 } 169 }
281 170
282 // return the root element only if decompilation completed successfully 171 var document = new XDocument();
283 return (encounteredError ? null : wixElement); 172 using (var writer = document.CreateWriter())
173 {
174 wixElement.OutputXml(writer);
175 }
176
177 // return the XML document only if decompilation completed successfully
178 return this.Messaging.EncounteredError ? null : document;
284 } 179 }
285 180
286 /// <summary> 181#if TODO_DECOMPILER_EXTENSIONS
287 /// Adds an extension. 182 private void AddExtension(IWindowsInstallerBackendDecompilerExtension extension)
288 /// </summary>
289 /// <param name="extension">The extension to add.</param>
290 public void AddExtension(IDecompilerExtension extension)
291 { 183 {
292 this.extensions.Add(extension);
293
294 if (null != extension.TableDefinitions) 184 if (null != extension.TableDefinitions)
295 { 185 {
296 foreach (TableDefinition tableDefinition in extension.TableDefinitions) 186 foreach (TableDefinition tableDefinition in extension.TableDefinitions)
297 { 187 {
298 if (!this.extensionsByTableName.ContainsKey(tableDefinition.Name)) 188 if (!this.ExtensionsByTableName.ContainsKey(tableDefinition.Name))
299 { 189 {
300 this.extensionsByTableName.Add(tableDefinition.Name, extension); 190 this.ExtensionsByTableName.Add(tableDefinition.Name, extension);
301 } 191 }
302 else 192 else
303 { 193 {
304 Messaging.Instance.OnMessage(WixErrors.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name)); 194 this.Messaging.Write(ErrorMessages.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name));
305 } 195 }
306 } 196 }
307 } 197 }
308 } 198 }
309
310 /// <summary>
311 /// Cleans up the temp files used by the Decompiler.
312 /// </summary>
313 /// <returns>True if all files were deleted, false otherwise.</returns>
314 /// <remarks>
315 /// This should be called after every call to Decompile to ensure there
316 /// are no conflicts between each decompiled database.
317 /// </remarks>
318 public bool DeleteTempFiles()
319 {
320#if REDO_IN_NETCORE
321 if (null == this.tempFiles)
322 {
323 return true; // no work to do
324 }
325 else
326 {
327 bool deleted = Common.DeleteTempFiles(this.tempFiles.BasePath, this.core);
328
329 if (deleted)
330 {
331 this.tempFiles = null; // temp files have been deleted, no need to remember this now
332 }
333
334 return deleted;
335 }
336#endif 199#endif
337 return true;
338 }
339 200
340 /// <summary> 201 /// <summary>
341 /// Set the common control attributes in a control element. 202 /// Set the common control attributes in a control element.
@@ -395,7 +256,7 @@ namespace WixToolset.Core.WindowsInstaller
395 256
396 if (null != this.core.GetIndexedElement("CustomAction", actionRow.Action)) // custom action 257 if (null != this.core.GetIndexedElement("CustomAction", actionRow.Action)) // custom action
397 { 258 {
398 Wix.Custom custom = new Wix.Custom(); 259 var custom = new Wix.Custom();
399 260
400 custom.Action = actionRow.Action; 261 custom.Action = actionRow.Action;
401 262
@@ -406,39 +267,39 @@ namespace WixToolset.Core.WindowsInstaller
406 267
407 switch (actionRow.Sequence) 268 switch (actionRow.Sequence)
408 { 269 {
409 case (-4): 270 case (-4):
410 custom.OnExit = Wix.ExitType.suspend; 271 custom.OnExit = Wix.ExitType.suspend;
411 break; 272 break;
412 case (-3): 273 case (-3):
413 custom.OnExit = Wix.ExitType.error; 274 custom.OnExit = Wix.ExitType.error;
414 break; 275 break;
415 case (-2): 276 case (-2):
416 custom.OnExit = Wix.ExitType.cancel; 277 custom.OnExit = Wix.ExitType.cancel;
417 break; 278 break;
418 case (-1): 279 case (-1):
419 custom.OnExit = Wix.ExitType.success; 280 custom.OnExit = Wix.ExitType.success;
420 break; 281 break;
421 default: 282 default:
422 if (null != actionRow.Before) 283 if (null != actionRow.Before)
423 { 284 {
424 custom.Before = actionRow.Before; 285 custom.Before = actionRow.Before;
425 } 286 }
426 else if (null != actionRow.After) 287 else if (null != actionRow.After)
427 { 288 {
428 custom.After = actionRow.After; 289 custom.After = actionRow.After;
429 } 290 }
430 else if (0 < actionRow.Sequence) 291 else if (0 < actionRow.Sequence)
431 { 292 {
432 custom.Sequence = actionRow.Sequence; 293 custom.Sequence = actionRow.Sequence;
433 } 294 }
434 break; 295 break;
435 } 296 }
436 297
437 actionElement = custom; 298 actionElement = custom;
438 } 299 }
439 else if (null != this.core.GetIndexedElement("Dialog", actionRow.Action)) // dialog 300 else if (null != this.core.GetIndexedElement("Dialog", actionRow.Action)) // dialog
440 { 301 {
441 Wix.Show show = new Wix.Show(); 302 var show = new Wix.Show();
442 303
443 show.Dialog = actionRow.Action; 304 show.Dialog = actionRow.Action;
444 305
@@ -449,32 +310,32 @@ namespace WixToolset.Core.WindowsInstaller
449 310
450 switch (actionRow.Sequence) 311 switch (actionRow.Sequence)
451 { 312 {
452 case (-4): 313 case (-4):
453 show.OnExit = Wix.ExitType.suspend; 314 show.OnExit = Wix.ExitType.suspend;
454 break; 315 break;
455 case (-3): 316 case (-3):
456 show.OnExit = Wix.ExitType.error; 317 show.OnExit = Wix.ExitType.error;
457 break; 318 break;
458 case (-2): 319 case (-2):
459 show.OnExit = Wix.ExitType.cancel; 320 show.OnExit = Wix.ExitType.cancel;
460 break; 321 break;
461 case (-1): 322 case (-1):
462 show.OnExit = Wix.ExitType.success; 323 show.OnExit = Wix.ExitType.success;
463 break; 324 break;
464 default: 325 default:
465 if (null != actionRow.Before) 326 if (null != actionRow.Before)
466 { 327 {
467 show.Before = actionRow.Before; 328 show.Before = actionRow.Before;
468 } 329 }
469 else if (null != actionRow.After) 330 else if (null != actionRow.After)
470 { 331 {
471 show.After = actionRow.After; 332 show.After = actionRow.After;
472 } 333 }
473 else if (0 < actionRow.Sequence) 334 else if (0 < actionRow.Sequence)
474 { 335 {
475 show.Sequence = actionRow.Sequence; 336 show.Sequence = actionRow.Sequence;
476 } 337 }
477 break; 338 break;
478 } 339 }
479 340
480 actionElement = show; 341 actionElement = show;
@@ -487,30 +348,30 @@ namespace WixToolset.Core.WindowsInstaller
487 // add the action element to the appropriate sequence element 348 // add the action element to the appropriate sequence element
488 if (null != actionElement) 349 if (null != actionElement)
489 { 350 {
490 string sequenceTable = actionRow.SequenceTable.ToString(); 351 var sequenceTable = actionRow.SequenceTable.ToString();
491 Wix.IParentElement sequenceElement = (Wix.IParentElement)this.sequenceElements[sequenceTable]; 352 var sequenceElement = (Wix.IParentElement)this.sequenceElements[sequenceTable];
492 353
493 if (null == sequenceElement) 354 if (null == sequenceElement)
494 { 355 {
495 switch (actionRow.SequenceTable) 356 switch (actionRow.SequenceTable)
496 { 357 {
497 case SequenceTable.AdminExecuteSequence: 358 case SequenceTable.AdminExecuteSequence:
498 sequenceElement = new Wix.AdminExecuteSequence(); 359 sequenceElement = new Wix.AdminExecuteSequence();
499 break; 360 break;
500 case SequenceTable.AdminUISequence: 361 case SequenceTable.AdminUISequence:
501 sequenceElement = new Wix.AdminUISequence(); 362 sequenceElement = new Wix.AdminUISequence();
502 break; 363 break;
503 case SequenceTable.AdvtExecuteSequence: 364 case SequenceTable.AdvtExecuteSequence:
504 sequenceElement = new Wix.AdvertiseExecuteSequence(); 365 sequenceElement = new Wix.AdvertiseExecuteSequence();
505 break; 366 break;
506 case SequenceTable.InstallExecuteSequence: 367 case SequenceTable.InstallExecuteSequence:
507 sequenceElement = new Wix.InstallExecuteSequence(); 368 sequenceElement = new Wix.InstallExecuteSequence();
508 break; 369 break;
509 case SequenceTable.InstallUISequence: 370 case SequenceTable.InstallUISequence:
510 sequenceElement = new Wix.InstallUISequence(); 371 sequenceElement = new Wix.InstallUISequence();
511 break; 372 break;
512 default: 373 default:
513 throw new InvalidOperationException(WixStrings.EXP_UnknowSequenceTable); 374 throw new InvalidOperationException("Unknown sequence table.");
514 } 375 }
515 376
516 this.core.RootElement.AddChild((Wix.ISchemaElement)sequenceElement); 377 this.core.RootElement.AddChild((Wix.ISchemaElement)sequenceElement);
@@ -523,7 +384,7 @@ namespace WixToolset.Core.WindowsInstaller
523 } 384 }
524 catch (System.ArgumentException) // action/dialog is not valid for this sequence 385 catch (System.ArgumentException) // action/dialog is not valid for this sequence
525 { 386 {
526 this.core.OnMessage(WixWarnings.IllegalActionInSequence(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); 387 this.Messaging.Write(WarningMessages.IllegalActionInSequence(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action));
527 } 388 }
528 } 389 }
529 } 390 }
@@ -539,267 +400,267 @@ namespace WixToolset.Core.WindowsInstaller
539 400
540 switch (actionRow.Action) 401 switch (actionRow.Action)
541 { 402 {
542 case "AllocateRegistrySpace": 403 case "AllocateRegistrySpace":
543 actionElement = new Wix.AllocateRegistrySpace(); 404 actionElement = new Wix.AllocateRegistrySpace();
544 break; 405 break;
545 case "AppSearch": 406 case "AppSearch":
546 WixActionRow appSearchActionRow = this.standardActions[actionRow.SequenceTable, actionRow.Action]; 407 this.StandardActions.TryGetValue(actionRow.GetPrimaryKey(), out var appSearchActionRow);
547 408
548 if (null != actionRow.Before || null != actionRow.After || (null != appSearchActionRow && actionRow.Sequence != appSearchActionRow.Sequence)) 409 if (null != actionRow.Before || null != actionRow.After || (null != appSearchActionRow && actionRow.Sequence != appSearchActionRow.Sequence))
549 { 410 {
550 Wix.AppSearch appSearch = new Wix.AppSearch(); 411 var appSearch = new Wix.AppSearch();
551 412
552 if (null != actionRow.Condition) 413 if (null != actionRow.Condition)
553 { 414 {
554 appSearch.Content = actionRow.Condition; 415 appSearch.Content = actionRow.Condition;
555 } 416 }
556 417
557 if (null != actionRow.Before) 418 if (null != actionRow.Before)
558 { 419 {
559 appSearch.Before = actionRow.Before; 420 appSearch.Before = actionRow.Before;
560 } 421 }
561 else if (null != actionRow.After) 422 else if (null != actionRow.After)
562 { 423 {
563 appSearch.After = actionRow.After; 424 appSearch.After = actionRow.After;
564 } 425 }
565 else if (0 < actionRow.Sequence) 426 else if (0 < actionRow.Sequence)
566 { 427 {
567 appSearch.Sequence = actionRow.Sequence; 428 appSearch.Sequence = actionRow.Sequence;
568 } 429 }
569 430
570 return appSearch; 431 return appSearch;
571 } 432 }
572 break; 433 break;
573 case "BindImage": 434 case "BindImage":
574 actionElement = new Wix.BindImage(); 435 actionElement = new Wix.BindImage();
575 break; 436 break;
576 case "CCPSearch": 437 case "CCPSearch":
577 Wix.CCPSearch ccpSearch = new Wix.CCPSearch(); 438 var ccpSearch = new Wix.CCPSearch();
578 Decompiler.SequenceRelativeAction(actionRow, ccpSearch); 439 Decompiler.SequenceRelativeAction(actionRow, ccpSearch);
579 return ccpSearch; 440 return ccpSearch;
580 case "CostFinalize": 441 case "CostFinalize":
581 actionElement = new Wix.CostFinalize(); 442 actionElement = new Wix.CostFinalize();
582 break; 443 break;
583 case "CostInitialize": 444 case "CostInitialize":
584 actionElement = new Wix.CostInitialize(); 445 actionElement = new Wix.CostInitialize();
585 break; 446 break;
586 case "CreateFolders": 447 case "CreateFolders":
587 actionElement = new Wix.CreateFolders(); 448 actionElement = new Wix.CreateFolders();
588 break; 449 break;
589 case "CreateShortcuts": 450 case "CreateShortcuts":
590 actionElement = new Wix.CreateShortcuts(); 451 actionElement = new Wix.CreateShortcuts();
591 break; 452 break;
592 case "DeleteServices": 453 case "DeleteServices":
593 actionElement = new Wix.DeleteServices(); 454 actionElement = new Wix.DeleteServices();
594 break; 455 break;
595 case "DisableRollback": 456 case "DisableRollback":
596 Wix.DisableRollback disableRollback = new Wix.DisableRollback(); 457 var disableRollback = new Wix.DisableRollback();
597 Decompiler.SequenceRelativeAction(actionRow, disableRollback); 458 Decompiler.SequenceRelativeAction(actionRow, disableRollback);
598 return disableRollback; 459 return disableRollback;
599 case "DuplicateFiles": 460 case "DuplicateFiles":
600 actionElement = new Wix.DuplicateFiles(); 461 actionElement = new Wix.DuplicateFiles();
601 break; 462 break;
602 case "ExecuteAction": 463 case "ExecuteAction":
603 actionElement = new Wix.ExecuteAction(); 464 actionElement = new Wix.ExecuteAction();
604 break; 465 break;
605 case "FileCost": 466 case "FileCost":
606 actionElement = new Wix.FileCost(); 467 actionElement = new Wix.FileCost();
607 break; 468 break;
608 case "FindRelatedProducts": 469 case "FindRelatedProducts":
609 Wix.FindRelatedProducts findRelatedProducts = new Wix.FindRelatedProducts(); 470 var findRelatedProducts = new Wix.FindRelatedProducts();
610 Decompiler.SequenceRelativeAction(actionRow, findRelatedProducts); 471 Decompiler.SequenceRelativeAction(actionRow, findRelatedProducts);
611 return findRelatedProducts; 472 return findRelatedProducts;
612 case "ForceReboot": 473 case "ForceReboot":
613 Wix.ForceReboot forceReboot = new Wix.ForceReboot(); 474 var forceReboot = new Wix.ForceReboot();
614 Decompiler.SequenceRelativeAction(actionRow, forceReboot); 475 Decompiler.SequenceRelativeAction(actionRow, forceReboot);
615 return forceReboot; 476 return forceReboot;
616 case "InstallAdminPackage": 477 case "InstallAdminPackage":
617 actionElement = new Wix.InstallAdminPackage(); 478 actionElement = new Wix.InstallAdminPackage();
618 break; 479 break;
619 case "InstallExecute": 480 case "InstallExecute":
620 Wix.InstallExecute installExecute = new Wix.InstallExecute(); 481 var installExecute = new Wix.InstallExecute();
621 Decompiler.SequenceRelativeAction(actionRow, installExecute); 482 Decompiler.SequenceRelativeAction(actionRow, installExecute);
622 return installExecute; 483 return installExecute;
623 case "InstallExecuteAgain": 484 case "InstallExecuteAgain":
624 Wix.InstallExecuteAgain installExecuteAgain = new Wix.InstallExecuteAgain(); 485 var installExecuteAgain = new Wix.InstallExecuteAgain();
625 Decompiler.SequenceRelativeAction(actionRow, installExecuteAgain); 486 Decompiler.SequenceRelativeAction(actionRow, installExecuteAgain);
626 return installExecuteAgain; 487 return installExecuteAgain;
627 case "InstallFiles": 488 case "InstallFiles":
628 actionElement = new Wix.InstallFiles(); 489 actionElement = new Wix.InstallFiles();
629 break; 490 break;
630 case "InstallFinalize": 491 case "InstallFinalize":
631 actionElement = new Wix.InstallFinalize(); 492 actionElement = new Wix.InstallFinalize();
632 break; 493 break;
633 case "InstallInitialize": 494 case "InstallInitialize":
634 actionElement = new Wix.InstallInitialize(); 495 actionElement = new Wix.InstallInitialize();
635 break; 496 break;
636 case "InstallODBC": 497 case "InstallODBC":
637 actionElement = new Wix.InstallODBC(); 498 actionElement = new Wix.InstallODBC();
638 break; 499 break;
639 case "InstallServices": 500 case "InstallServices":
640 actionElement = new Wix.InstallServices(); 501 actionElement = new Wix.InstallServices();
641 break; 502 break;
642 case "InstallValidate": 503 case "InstallValidate":
643 actionElement = new Wix.InstallValidate(); 504 actionElement = new Wix.InstallValidate();
644 break; 505 break;
645 case "IsolateComponents": 506 case "IsolateComponents":
646 actionElement = new Wix.IsolateComponents(); 507 actionElement = new Wix.IsolateComponents();
647 break; 508 break;
648 case "LaunchConditions": 509 case "LaunchConditions":
649 Wix.LaunchConditions launchConditions = new Wix.LaunchConditions(); 510 var launchConditions = new Wix.LaunchConditions();
650 Decompiler.SequenceRelativeAction(actionRow, launchConditions); 511 Decompiler.SequenceRelativeAction(actionRow, launchConditions);
651 return launchConditions; 512 return launchConditions;
652 case "MigrateFeatureStates": 513 case "MigrateFeatureStates":
653 actionElement = new Wix.MigrateFeatureStates(); 514 actionElement = new Wix.MigrateFeatureStates();
654 break; 515 break;
655 case "MoveFiles": 516 case "MoveFiles":
656 actionElement = new Wix.MoveFiles(); 517 actionElement = new Wix.MoveFiles();
657 break; 518 break;
658 case "MsiPublishAssemblies": 519 case "MsiPublishAssemblies":
659 actionElement = new Wix.MsiPublishAssemblies(); 520 actionElement = new Wix.MsiPublishAssemblies();
660 break; 521 break;
661 case "MsiUnpublishAssemblies": 522 case "MsiUnpublishAssemblies":
662 actionElement = new Wix.MsiUnpublishAssemblies(); 523 actionElement = new Wix.MsiUnpublishAssemblies();
663 break; 524 break;
664 case "PatchFiles": 525 case "PatchFiles":
665 actionElement = new Wix.PatchFiles(); 526 actionElement = new Wix.PatchFiles();
666 break; 527 break;
667 case "ProcessComponents": 528 case "ProcessComponents":
668 actionElement = new Wix.ProcessComponents(); 529 actionElement = new Wix.ProcessComponents();
669 break; 530 break;
670 case "PublishComponents": 531 case "PublishComponents":
671 actionElement = new Wix.PublishComponents(); 532 actionElement = new Wix.PublishComponents();
672 break; 533 break;
673 case "PublishFeatures": 534 case "PublishFeatures":
674 actionElement = new Wix.PublishFeatures(); 535 actionElement = new Wix.PublishFeatures();
675 break; 536 break;
676 case "PublishProduct": 537 case "PublishProduct":
677 actionElement = new Wix.PublishProduct(); 538 actionElement = new Wix.PublishProduct();
678 break; 539 break;
679 case "RegisterClassInfo": 540 case "RegisterClassInfo":
680 actionElement = new Wix.RegisterClassInfo(); 541 actionElement = new Wix.RegisterClassInfo();
681 break; 542 break;
682 case "RegisterComPlus": 543 case "RegisterComPlus":
683 actionElement = new Wix.RegisterComPlus(); 544 actionElement = new Wix.RegisterComPlus();
684 break; 545 break;
685 case "RegisterExtensionInfo": 546 case "RegisterExtensionInfo":
686 actionElement = new Wix.RegisterExtensionInfo(); 547 actionElement = new Wix.RegisterExtensionInfo();
687 break; 548 break;
688 case "RegisterFonts": 549 case "RegisterFonts":
689 actionElement = new Wix.RegisterFonts(); 550 actionElement = new Wix.RegisterFonts();
690 break; 551 break;
691 case "RegisterMIMEInfo": 552 case "RegisterMIMEInfo":
692 actionElement = new Wix.RegisterMIMEInfo(); 553 actionElement = new Wix.RegisterMIMEInfo();
693 break; 554 break;
694 case "RegisterProduct": 555 case "RegisterProduct":
695 actionElement = new Wix.RegisterProduct(); 556 actionElement = new Wix.RegisterProduct();
696 break; 557 break;
697 case "RegisterProgIdInfo": 558 case "RegisterProgIdInfo":
698 actionElement = new Wix.RegisterProgIdInfo(); 559 actionElement = new Wix.RegisterProgIdInfo();
699 break; 560 break;
700 case "RegisterTypeLibraries": 561 case "RegisterTypeLibraries":
701 actionElement = new Wix.RegisterTypeLibraries(); 562 actionElement = new Wix.RegisterTypeLibraries();
702 break; 563 break;
703 case "RegisterUser": 564 case "RegisterUser":
704 actionElement = new Wix.RegisterUser(); 565 actionElement = new Wix.RegisterUser();
705 break; 566 break;
706 case "RemoveDuplicateFiles": 567 case "RemoveDuplicateFiles":
707 actionElement = new Wix.RemoveDuplicateFiles(); 568 actionElement = new Wix.RemoveDuplicateFiles();
708 break; 569 break;
709 case "RemoveEnvironmentStrings": 570 case "RemoveEnvironmentStrings":
710 actionElement = new Wix.RemoveEnvironmentStrings(); 571 actionElement = new Wix.RemoveEnvironmentStrings();
711 break; 572 break;
712 case "RemoveExistingProducts": 573 case "RemoveExistingProducts":
713 Wix.RemoveExistingProducts removeExistingProducts = new Wix.RemoveExistingProducts(); 574 var removeExistingProducts = new Wix.RemoveExistingProducts();
714 Decompiler.SequenceRelativeAction(actionRow, removeExistingProducts); 575 Decompiler.SequenceRelativeAction(actionRow, removeExistingProducts);
715 return removeExistingProducts; 576 return removeExistingProducts;
716 case "RemoveFiles": 577 case "RemoveFiles":
717 actionElement = new Wix.RemoveFiles(); 578 actionElement = new Wix.RemoveFiles();
718 break; 579 break;
719 case "RemoveFolders": 580 case "RemoveFolders":
720 actionElement = new Wix.RemoveFolders(); 581 actionElement = new Wix.RemoveFolders();
721 break; 582 break;
722 case "RemoveIniValues": 583 case "RemoveIniValues":
723 actionElement = new Wix.RemoveIniValues(); 584 actionElement = new Wix.RemoveIniValues();
724 break; 585 break;
725 case "RemoveODBC": 586 case "RemoveODBC":
726 actionElement = new Wix.RemoveODBC(); 587 actionElement = new Wix.RemoveODBC();
727 break; 588 break;
728 case "RemoveRegistryValues": 589 case "RemoveRegistryValues":
729 actionElement = new Wix.RemoveRegistryValues(); 590 actionElement = new Wix.RemoveRegistryValues();
730 break; 591 break;
731 case "RemoveShortcuts": 592 case "RemoveShortcuts":
732 actionElement = new Wix.RemoveShortcuts(); 593 actionElement = new Wix.RemoveShortcuts();
733 break; 594 break;
734 case "ResolveSource": 595 case "ResolveSource":
735 Wix.ResolveSource resolveSource = new Wix.ResolveSource(); 596 var resolveSource = new Wix.ResolveSource();
736 Decompiler.SequenceRelativeAction(actionRow, resolveSource); 597 Decompiler.SequenceRelativeAction(actionRow, resolveSource);
737 return resolveSource; 598 return resolveSource;
738 case "RMCCPSearch": 599 case "RMCCPSearch":
739 Wix.RMCCPSearch rmccpSearch = new Wix.RMCCPSearch(); 600 var rmccpSearch = new Wix.RMCCPSearch();
740 Decompiler.SequenceRelativeAction(actionRow, rmccpSearch); 601 Decompiler.SequenceRelativeAction(actionRow, rmccpSearch);
741 return rmccpSearch; 602 return rmccpSearch;
742 case "ScheduleReboot": 603 case "ScheduleReboot":
743 Wix.ScheduleReboot scheduleReboot = new Wix.ScheduleReboot(); 604 var scheduleReboot = new Wix.ScheduleReboot();
744 Decompiler.SequenceRelativeAction(actionRow, scheduleReboot); 605 Decompiler.SequenceRelativeAction(actionRow, scheduleReboot);
745 return scheduleReboot; 606 return scheduleReboot;
746 case "SelfRegModules": 607 case "SelfRegModules":
747 actionElement = new Wix.SelfRegModules(); 608 actionElement = new Wix.SelfRegModules();
748 break; 609 break;
749 case "SelfUnregModules": 610 case "SelfUnregModules":
750 actionElement = new Wix.SelfUnregModules(); 611 actionElement = new Wix.SelfUnregModules();
751 break; 612 break;
752 case "SetODBCFolders": 613 case "SetODBCFolders":
753 actionElement = new Wix.SetODBCFolders(); 614 actionElement = new Wix.SetODBCFolders();
754 break; 615 break;
755 case "StartServices": 616 case "StartServices":
756 actionElement = new Wix.StartServices(); 617 actionElement = new Wix.StartServices();
757 break; 618 break;
758 case "StopServices": 619 case "StopServices":
759 actionElement = new Wix.StopServices(); 620 actionElement = new Wix.StopServices();
760 break; 621 break;
761 case "UnpublishComponents": 622 case "UnpublishComponents":
762 actionElement = new Wix.UnpublishComponents(); 623 actionElement = new Wix.UnpublishComponents();
763 break; 624 break;
764 case "UnpublishFeatures": 625 case "UnpublishFeatures":
765 actionElement = new Wix.UnpublishFeatures(); 626 actionElement = new Wix.UnpublishFeatures();
766 break; 627 break;
767 case "UnregisterClassInfo": 628 case "UnregisterClassInfo":
768 actionElement = new Wix.UnregisterClassInfo(); 629 actionElement = new Wix.UnregisterClassInfo();
769 break; 630 break;
770 case "UnregisterComPlus": 631 case "UnregisterComPlus":
771 actionElement = new Wix.UnregisterComPlus(); 632 actionElement = new Wix.UnregisterComPlus();
772 break; 633 break;
773 case "UnregisterExtensionInfo": 634 case "UnregisterExtensionInfo":
774 actionElement = new Wix.UnregisterExtensionInfo(); 635 actionElement = new Wix.UnregisterExtensionInfo();
775 break; 636 break;
776 case "UnregisterFonts": 637 case "UnregisterFonts":
777 actionElement = new Wix.UnregisterFonts(); 638 actionElement = new Wix.UnregisterFonts();
778 break; 639 break;
779 case "UnregisterMIMEInfo": 640 case "UnregisterMIMEInfo":
780 actionElement = new Wix.UnregisterMIMEInfo(); 641 actionElement = new Wix.UnregisterMIMEInfo();
781 break; 642 break;
782 case "UnregisterProgIdInfo": 643 case "UnregisterProgIdInfo":
783 actionElement = new Wix.UnregisterProgIdInfo(); 644 actionElement = new Wix.UnregisterProgIdInfo();
784 break; 645 break;
785 case "UnregisterTypeLibraries": 646 case "UnregisterTypeLibraries":
786 actionElement = new Wix.UnregisterTypeLibraries(); 647 actionElement = new Wix.UnregisterTypeLibraries();
787 break; 648 break;
788 case "ValidateProductID": 649 case "ValidateProductID":
789 actionElement = new Wix.ValidateProductID(); 650 actionElement = new Wix.ValidateProductID();
790 break; 651 break;
791 case "WriteEnvironmentStrings": 652 case "WriteEnvironmentStrings":
792 actionElement = new Wix.WriteEnvironmentStrings(); 653 actionElement = new Wix.WriteEnvironmentStrings();
793 break; 654 break;
794 case "WriteIniValues": 655 case "WriteIniValues":
795 actionElement = new Wix.WriteIniValues(); 656 actionElement = new Wix.WriteIniValues();
796 break; 657 break;
797 case "WriteRegistryValues": 658 case "WriteRegistryValues":
798 actionElement = new Wix.WriteRegistryValues(); 659 actionElement = new Wix.WriteRegistryValues();
799 break; 660 break;
800 default: 661 default:
801 this.core.OnMessage(WixWarnings.UnknownAction(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); 662 this.Messaging.Write(WarningMessages.UnknownAction(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action));
802 return null; 663 return null;
803 } 664 }
804 665
805 if (actionElement != null) 666 if (actionElement != null)
@@ -824,7 +685,7 @@ namespace WixToolset.Core.WindowsInstaller
824 685
825 if ((null != actionRow.Before || null != actionRow.After) && 0 == actionRow.Sequence) 686 if ((null != actionRow.Before || null != actionRow.After) && 0 == actionRow.Sequence)
826 { 687 {
827 this.core.OnMessage(WixWarnings.DecompiledStandardActionRelativelyScheduledInModule(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); 688 this.Messaging.Write(WarningMessages.DecompiledStandardActionRelativelyScheduledInModule(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action));
828 } 689 }
829 else if (0 < actionRow.Sequence) 690 else if (0 < actionRow.Sequence)
830 { 691 {
@@ -865,7 +726,7 @@ namespace WixToolset.Core.WindowsInstaller
865 /// <returns>The property element.</returns> 726 /// <returns>The property element.</returns>
866 private Wix.Property EnsureProperty(string id) 727 private Wix.Property EnsureProperty(string id)
867 { 728 {
868 Wix.Property property = (Wix.Property)this.core.GetIndexedElement("Property", id); 729 var property = (Wix.Property)this.core.GetIndexedElement("Property", id);
869 730
870 if (null == property) 731 if (null == property)
871 { 732 {
@@ -873,7 +734,7 @@ namespace WixToolset.Core.WindowsInstaller
873 property.Id = id; 734 property.Id = id;
874 735
875 // create a dummy row for indexing 736 // create a dummy row for indexing
876 Row row = new Row(null, this.tableDefinitions["Property"]); 737 var row = new Row(null, this.tableDefinitions["Property"]);
877 row[0] = id; 738 row[0] = id;
878 739
879 this.core.RootElement.AddChild(property); 740 this.core.RootElement.AddChild(property);
@@ -889,7 +750,7 @@ namespace WixToolset.Core.WindowsInstaller
889 /// <param name="tables">The collection of all tables.</param> 750 /// <param name="tables">The collection of all tables.</param>
890 private void FinalizeDecompile(TableIndexedCollection tables) 751 private void FinalizeDecompile(TableIndexedCollection tables)
891 { 752 {
892 if (OutputType.PatchCreation == this.outputType) 753 if (OutputType.PatchCreation == this.OutputType)
893 { 754 {
894 this.FinalizeFamilyFileRangesTable(tables); 755 this.FinalizeFamilyFileRangesTable(tables);
895 } 756 }
@@ -926,21 +787,21 @@ namespace WixToolset.Core.WindowsInstaller
926 private void FinalizeCheckBoxTable(TableIndexedCollection tables) 787 private void FinalizeCheckBoxTable(TableIndexedCollection tables)
927 { 788 {
928 // if the user has requested to suppress the UI elements, we have nothing to do 789 // if the user has requested to suppress the UI elements, we have nothing to do
929 if (this.suppressUI) 790 if (this.SuppressUI)
930 { 791 {
931 return; 792 return;
932 } 793 }
933 794
934 Table checkBoxTable = tables["CheckBox"]; 795 var checkBoxTable = tables["CheckBox"];
935 Table controlTable = tables["Control"]; 796 var controlTable = tables["Control"];
936 797
937 Hashtable checkBoxes = new Hashtable(); 798 var checkBoxes = new Hashtable();
938 Hashtable checkBoxProperties = new Hashtable(); 799 var checkBoxProperties = new Hashtable();
939 800
940 // index the CheckBox table 801 // index the CheckBox table
941 if (null != checkBoxTable) 802 if (null != checkBoxTable)
942 { 803 {
943 foreach (Row row in checkBoxTable.Rows) 804 foreach (var row in checkBoxTable.Rows)
944 { 805 {
945 checkBoxes.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row); 806 checkBoxes.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row);
946 checkBoxProperties.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), false); 807 checkBoxProperties.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), false);
@@ -950,17 +811,17 @@ namespace WixToolset.Core.WindowsInstaller
950 // enumerate through the Control table, adding CheckBox values where appropriate 811 // enumerate through the Control table, adding CheckBox values where appropriate
951 if (null != controlTable) 812 if (null != controlTable)
952 { 813 {
953 foreach (Row row in controlTable.Rows) 814 foreach (var row in controlTable.Rows)
954 { 815 {
955 Wix.Control control = (Wix.Control)this.core.GetIndexedElement(row); 816 var control = (Wix.Control)this.core.GetIndexedElement(row);
956 817
957 if ("CheckBox" == Convert.ToString(row[2]) && null != row[8]) 818 if ("CheckBox" == Convert.ToString(row[2]) && null != row[8])
958 { 819 {
959 Row checkBoxRow = (Row)checkBoxes[row[8]]; 820 var checkBoxRow = (Row)checkBoxes[row[8]];
960 821
961 if (null == checkBoxRow) 822 if (null == checkBoxRow)
962 { 823 {
963 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Control", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Property", Convert.ToString(row[8]), "CheckBox")); 824 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Control", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Property", Convert.ToString(row[8]), "CheckBox"));
964 } 825 }
965 else 826 else
966 { 827 {
@@ -994,21 +855,21 @@ namespace WixToolset.Core.WindowsInstaller
994 /// </remarks> 855 /// </remarks>
995 private void FinalizeComponentTable(TableIndexedCollection tables) 856 private void FinalizeComponentTable(TableIndexedCollection tables)
996 { 857 {
997 Table componentTable = tables["Component"]; 858 var componentTable = tables["Component"];
998 Table fileTable = tables["File"]; 859 var fileTable = tables["File"];
999 Table odbcDataSourceTable = tables["ODBCDataSource"]; 860 var odbcDataSourceTable = tables["ODBCDataSource"];
1000 Table registryTable = tables["Registry"]; 861 var registryTable = tables["Registry"];
1001 862
1002 // set the component keypaths 863 // set the component keypaths
1003 if (null != componentTable) 864 if (null != componentTable)
1004 { 865 {
1005 foreach (Row row in componentTable.Rows) 866 foreach (var row in componentTable.Rows)
1006 { 867 {
1007 int attributes = Convert.ToInt32(row[3]); 868 var attributes = Convert.ToInt32(row[3]);
1008 869
1009 if (null == row[5]) 870 if (null == row[5])
1010 { 871 {
1011 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0])); 872 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0]));
1012 873
1013 component.KeyPath = Wix.YesNoType.yes; 874 component.KeyPath = Wix.YesNoType.yes;
1014 } 875 }
@@ -1018,7 +879,7 @@ namespace WixToolset.Core.WindowsInstaller
1018 879
1019 if (null != registryObject) 880 if (null != registryObject)
1020 { 881 {
1021 Wix.RegistryValue registryValue = registryObject as Wix.RegistryValue; 882 var registryValue = registryObject as Wix.RegistryValue;
1022 883
1023 if (null != registryValue) 884 if (null != registryValue)
1024 { 885 {
@@ -1026,17 +887,17 @@ namespace WixToolset.Core.WindowsInstaller
1026 } 887 }
1027 else 888 else
1028 { 889 {
1029 this.core.OnMessage(WixWarnings.IllegalRegistryKeyPath(row.SourceLineNumbers, "Component", Convert.ToString(row[5]))); 890 this.Messaging.Write(WarningMessages.IllegalRegistryKeyPath(row.SourceLineNumbers, "Component", Convert.ToString(row[5])));
1030 } 891 }
1031 } 892 }
1032 else 893 else
1033 { 894 {
1034 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "Registry")); 895 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "Registry"));
1035 } 896 }
1036 } 897 }
1037 else if (MsiInterop.MsidbComponentAttributesODBCDataSource == (attributes & MsiInterop.MsidbComponentAttributesODBCDataSource)) 898 else if (MsiInterop.MsidbComponentAttributesODBCDataSource == (attributes & MsiInterop.MsidbComponentAttributesODBCDataSource))
1038 { 899 {
1039 Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[5])); 900 var odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[5]));
1040 901
1041 if (null != odbcDataSource) 902 if (null != odbcDataSource)
1042 { 903 {
@@ -1044,12 +905,12 @@ namespace WixToolset.Core.WindowsInstaller
1044 } 905 }
1045 else 906 else
1046 { 907 {
1047 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "ODBCDataSource")); 908 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "ODBCDataSource"));
1048 } 909 }
1049 } 910 }
1050 else 911 else
1051 { 912 {
1052 Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[5])); 913 var file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[5]));
1053 914
1054 if (null != file) 915 if (null != file)
1055 { 916 {
@@ -1057,7 +918,7 @@ namespace WixToolset.Core.WindowsInstaller
1057 } 918 }
1058 else 919 else
1059 { 920 {
1060 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "File")); 921 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Component", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "KeyPath", Convert.ToString(row[5]), "File"));
1061 } 922 }
1062 } 923 }
1063 } 924 }
@@ -1068,8 +929,8 @@ namespace WixToolset.Core.WindowsInstaller
1068 { 929 {
1069 foreach (FileRow fileRow in fileTable.Rows) 930 foreach (FileRow fileRow in fileTable.Rows)
1070 { 931 {
1071 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", fileRow.Component); 932 var component = (Wix.Component)this.core.GetIndexedElement("Component", fileRow.Component);
1072 Wix.File file = (Wix.File)this.core.GetIndexedElement(fileRow); 933 var file = (Wix.File)this.core.GetIndexedElement(fileRow);
1073 934
1074 if (null != component) 935 if (null != component)
1075 { 936 {
@@ -1077,7 +938,7 @@ namespace WixToolset.Core.WindowsInstaller
1077 } 938 }
1078 else 939 else
1079 { 940 {
1080 this.core.OnMessage(WixWarnings.ExpectedForeignRow(fileRow.SourceLineNumbers, "File", fileRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", fileRow.Component, "Component")); 941 this.Messaging.Write(WarningMessages.ExpectedForeignRow(fileRow.SourceLineNumbers, "File", fileRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", fileRow.Component, "Component"));
1081 } 942 }
1082 } 943 }
1083 } 944 }
@@ -1085,10 +946,10 @@ namespace WixToolset.Core.WindowsInstaller
1085 // add the ODBCDataSource children elements 946 // add the ODBCDataSource children elements
1086 if (null != odbcDataSourceTable) 947 if (null != odbcDataSourceTable)
1087 { 948 {
1088 foreach (Row row in odbcDataSourceTable.Rows) 949 foreach (var row in odbcDataSourceTable.Rows)
1089 { 950 {
1090 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 951 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
1091 Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement(row); 952 var odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement(row);
1092 953
1093 if (null != component) 954 if (null != component)
1094 { 955 {
@@ -1096,7 +957,7 @@ namespace WixToolset.Core.WindowsInstaller
1096 } 957 }
1097 else 958 else
1098 { 959 {
1099 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "ODBCDataSource", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 960 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "ODBCDataSource", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
1100 } 961 }
1101 } 962 }
1102 } 963 }
@@ -1104,10 +965,10 @@ namespace WixToolset.Core.WindowsInstaller
1104 // add the Registry children elements 965 // add the Registry children elements
1105 if (null != registryTable) 966 if (null != registryTable)
1106 { 967 {
1107 foreach (Row row in registryTable.Rows) 968 foreach (var row in registryTable.Rows)
1108 { 969 {
1109 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5])); 970 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5]));
1110 Wix.ISchemaElement registryElement = (Wix.ISchemaElement)this.core.GetIndexedElement(row); 971 var registryElement = this.core.GetIndexedElement(row);
1111 972
1112 if (null != component) 973 if (null != component)
1113 { 974 {
@@ -1115,7 +976,7 @@ namespace WixToolset.Core.WindowsInstaller
1115 } 976 }
1116 else 977 else
1117 { 978 {
1118 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Registry", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[5]), "Component")); 979 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Registry", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[5]), "Component"));
1119 } 980 }
1120 } 981 }
1121 } 982 }
@@ -1132,21 +993,21 @@ namespace WixToolset.Core.WindowsInstaller
1132 private void FinalizeDialogTable(TableIndexedCollection tables) 993 private void FinalizeDialogTable(TableIndexedCollection tables)
1133 { 994 {
1134 // if the user has requested to suppress the UI elements, we have nothing to do 995 // if the user has requested to suppress the UI elements, we have nothing to do
1135 if (this.suppressUI) 996 if (this.SuppressUI)
1136 { 997 {
1137 return; 998 return;
1138 } 999 }
1139 1000
1140 Table controlTable = tables["Control"]; 1001 var controlTable = tables["Control"];
1141 Table dialogTable = tables["Dialog"]; 1002 var dialogTable = tables["Dialog"];
1142 1003
1143 Hashtable addedControls = new Hashtable(); 1004 var addedControls = new Hashtable();
1144 Hashtable controlRows = new Hashtable(); 1005 var controlRows = new Hashtable();
1145 1006
1146 // index the rows in the control rows (because we need the Control_Next value) 1007 // index the rows in the control rows (because we need the Control_Next value)
1147 if (null != controlTable) 1008 if (null != controlTable)
1148 { 1009 {
1149 foreach (Row row in controlTable.Rows) 1010 foreach (var row in controlTable.Rows)
1150 { 1011 {
1151 controlRows.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row); 1012 controlRows.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row);
1152 } 1013 }
@@ -1154,21 +1015,21 @@ namespace WixToolset.Core.WindowsInstaller
1154 1015
1155 if (null != dialogTable) 1016 if (null != dialogTable)
1156 { 1017 {
1157 foreach (Row row in dialogTable.Rows) 1018 foreach (var row in dialogTable.Rows)
1158 { 1019 {
1159 Wix.Dialog dialog = (Wix.Dialog)this.core.GetIndexedElement(row); 1020 var dialog = (Wix.Dialog)this.core.GetIndexedElement(row);
1160 string dialogId = Convert.ToString(row[0]); 1021 var dialogId = Convert.ToString(row[0]);
1161 1022
1162 Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[7])); 1023 var control = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[7]));
1163 if (null == control) 1024 if (null == control)
1164 { 1025 {
1165 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_First", Convert.ToString(row[7]), "Control")); 1026 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_First", Convert.ToString(row[7]), "Control"));
1166 } 1027 }
1167 1028
1168 // add tabbable controls 1029 // add tabbable controls
1169 while (null != control) 1030 while (null != control)
1170 { 1031 {
1171 Row controlRow = (Row)controlRows[String.Concat(dialogId, DecompilerConstants.PrimaryKeyDelimiter, control.Id)]; 1032 var controlRow = (Row)controlRows[String.Concat(dialogId, DecompilerConstants.PrimaryKeyDelimiter, control.Id)];
1172 1033
1173 control.TabSkip = Wix.YesNoType.no; 1034 control.TabSkip = Wix.YesNoType.no;
1174 dialog.AddChild(control); 1035 dialog.AddChild(control);
@@ -1187,7 +1048,7 @@ namespace WixToolset.Core.WindowsInstaller
1187 } 1048 }
1188 else 1049 else
1189 { 1050 {
1190 this.core.OnMessage(WixWarnings.ExpectedForeignRow(controlRow.SourceLineNumbers, "Control", controlRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", dialogId, "Control_Next", Convert.ToString(controlRow[10]), "Control")); 1051 this.Messaging.Write(WarningMessages.ExpectedForeignRow(controlRow.SourceLineNumbers, "Control", controlRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", dialogId, "Control_Next", Convert.ToString(controlRow[10]), "Control"));
1191 } 1052 }
1192 } 1053 }
1193 else 1054 else
@@ -1199,7 +1060,7 @@ namespace WixToolset.Core.WindowsInstaller
1199 // set default control 1060 // set default control
1200 if (null != row[8]) 1061 if (null != row[8])
1201 { 1062 {
1202 Wix.Control defaultControl = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[8])); 1063 var defaultControl = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[8]));
1203 1064
1204 if (null != defaultControl) 1065 if (null != defaultControl)
1205 { 1066 {
@@ -1207,14 +1068,14 @@ namespace WixToolset.Core.WindowsInstaller
1207 } 1068 }
1208 else 1069 else
1209 { 1070 {
1210 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_Default", Convert.ToString(row[8]), "Control")); 1071 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_Default", Convert.ToString(row[8]), "Control"));
1211 } 1072 }
1212 } 1073 }
1213 1074
1214 // set cancel control 1075 // set cancel control
1215 if (null != row[9]) 1076 if (null != row[9])
1216 { 1077 {
1217 Wix.Control cancelControl = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[9])); 1078 var cancelControl = (Wix.Control)this.core.GetIndexedElement("Control", dialogId, Convert.ToString(row[9]));
1218 1079
1219 if (null != cancelControl) 1080 if (null != cancelControl)
1220 { 1081 {
@@ -1222,7 +1083,7 @@ namespace WixToolset.Core.WindowsInstaller
1222 } 1083 }
1223 else 1084 else
1224 { 1085 {
1225 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_Cancel", Convert.ToString(row[9]), "Control")); 1086 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Dialog", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog", dialogId, "Control_Cancel", Convert.ToString(row[9]), "Control"));
1226 } 1087 }
1227 } 1088 }
1228 } 1089 }
@@ -1231,14 +1092,14 @@ namespace WixToolset.Core.WindowsInstaller
1231 // add the non-tabbable controls to the dialog 1092 // add the non-tabbable controls to the dialog
1232 if (null != controlTable) 1093 if (null != controlTable)
1233 { 1094 {
1234 foreach (Row row in controlTable.Rows) 1095 foreach (var row in controlTable.Rows)
1235 { 1096 {
1236 Wix.Control control = (Wix.Control)this.core.GetIndexedElement(row); 1097 var control = (Wix.Control)this.core.GetIndexedElement(row);
1237 Wix.Dialog dialog = (Wix.Dialog)this.core.GetIndexedElement("Dialog", Convert.ToString(row[0])); 1098 var dialog = (Wix.Dialog)this.core.GetIndexedElement("Dialog", Convert.ToString(row[0]));
1238 1099
1239 if (null == dialog) 1100 if (null == dialog)
1240 { 1101 {
1241 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Control", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Dialog")); 1102 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Control", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Dialog"));
1242 continue; 1103 continue;
1243 } 1104 }
1244 1105
@@ -1261,14 +1122,14 @@ namespace WixToolset.Core.WindowsInstaller
1261 /// </remarks> 1122 /// </remarks>
1262 private void FinalizeDuplicateMoveFileTables(TableIndexedCollection tables) 1123 private void FinalizeDuplicateMoveFileTables(TableIndexedCollection tables)
1263 { 1124 {
1264 Table duplicateFileTable = tables["DuplicateFile"]; 1125 var duplicateFileTable = tables["DuplicateFile"];
1265 Table moveFileTable = tables["MoveFile"]; 1126 var moveFileTable = tables["MoveFile"];
1266 1127
1267 if (null != duplicateFileTable) 1128 if (null != duplicateFileTable)
1268 { 1129 {
1269 foreach (Row row in duplicateFileTable.Rows) 1130 foreach (var row in duplicateFileTable.Rows)
1270 { 1131 {
1271 Wix.CopyFile copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row); 1132 var copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row);
1272 1133
1273 if (null != row[4]) 1134 if (null != row[4])
1274 { 1135 {
@@ -1286,9 +1147,9 @@ namespace WixToolset.Core.WindowsInstaller
1286 1147
1287 if (null != moveFileTable) 1148 if (null != moveFileTable)
1288 { 1149 {
1289 foreach (Row row in moveFileTable.Rows) 1150 foreach (var row in moveFileTable.Rows)
1290 { 1151 {
1291 Wix.CopyFile copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row); 1152 var copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row);
1292 1153
1293 if (null != row[4]) 1154 if (null != row[4])
1294 { 1155 {
@@ -1320,26 +1181,26 @@ namespace WixToolset.Core.WindowsInstaller
1320 /// <param name="tables">The collection of all tables.</param> 1181 /// <param name="tables">The collection of all tables.</param>
1321 private void FinalizeFamilyFileRangesTable(TableIndexedCollection tables) 1182 private void FinalizeFamilyFileRangesTable(TableIndexedCollection tables)
1322 { 1183 {
1323 Table externalFilesTable = tables["ExternalFiles"]; 1184 var externalFilesTable = tables["ExternalFiles"];
1324 Table familyFileRangesTable = tables["FamilyFileRanges"]; 1185 var familyFileRangesTable = tables["FamilyFileRanges"];
1325 Table targetFiles_OptionalDataTable = tables["TargetFiles_OptionalData"]; 1186 var targetFiles_OptionalDataTable = tables["TargetFiles_OptionalData"];
1326 1187
1327 Hashtable usedProtectRanges = new Hashtable(); 1188 var usedProtectRanges = new Hashtable();
1328 1189
1329 if (null != familyFileRangesTable) 1190 if (null != familyFileRangesTable)
1330 { 1191 {
1331 foreach (Row row in familyFileRangesTable.Rows) 1192 foreach (var row in familyFileRangesTable.Rows)
1332 { 1193 {
1333 Wix.ProtectRange protectRange = new Wix.ProtectRange(); 1194 var protectRange = new Wix.ProtectRange();
1334 1195
1335 if (null != row[2] && null != row[3]) 1196 if (null != row[2] && null != row[3])
1336 { 1197 {
1337 string[] retainOffsets = (Convert.ToString(row[2])).Split(','); 1198 var retainOffsets = (Convert.ToString(row[2])).Split(',');
1338 string[] retainLengths = (Convert.ToString(row[3])).Split(','); 1199 var retainLengths = (Convert.ToString(row[3])).Split(',');
1339 1200
1340 if (retainOffsets.Length == retainLengths.Length) 1201 if (retainOffsets.Length == retainLengths.Length)
1341 { 1202 {
1342 for (int i = 0; i < retainOffsets.Length; i++) 1203 for (var i = 0; i < retainOffsets.Length; i++)
1343 { 1204 {
1344 if (retainOffsets[i].StartsWith("0x", StringComparison.Ordinal)) 1205 if (retainOffsets[i].StartsWith("0x", StringComparison.Ordinal))
1345 { 1206 {
@@ -1376,11 +1237,11 @@ namespace WixToolset.Core.WindowsInstaller
1376 1237
1377 if (null != externalFilesTable) 1238 if (null != externalFilesTable)
1378 { 1239 {
1379 foreach (Row row in externalFilesTable.Rows) 1240 foreach (var row in externalFilesTable.Rows)
1380 { 1241 {
1381 Wix.ExternalFile externalFile = (Wix.ExternalFile)this.core.GetIndexedElement(row); 1242 var externalFile = (Wix.ExternalFile)this.core.GetIndexedElement(row);
1382 1243
1383 Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement("FamilyFileRanges", Convert.ToString(row[0]), Convert.ToString(row[1])); 1244 var protectRange = (Wix.ProtectRange)this.core.GetIndexedElement("FamilyFileRanges", Convert.ToString(row[0]), Convert.ToString(row[1]));
1384 if (null != protectRange) 1245 if (null != protectRange)
1385 { 1246 {
1386 externalFile.AddChild(protectRange); 1247 externalFile.AddChild(protectRange);
@@ -1391,16 +1252,16 @@ namespace WixToolset.Core.WindowsInstaller
1391 1252
1392 if (null != targetFiles_OptionalDataTable) 1253 if (null != targetFiles_OptionalDataTable)
1393 { 1254 {
1394 Table targetImagesTable = tables["TargetImages"]; 1255 var targetImagesTable = tables["TargetImages"];
1395 Table upgradedImagesTable = tables["UpgradedImages"]; 1256 var upgradedImagesTable = tables["UpgradedImages"];
1396 1257
1397 Hashtable targetImageRows = new Hashtable(); 1258 var targetImageRows = new Hashtable();
1398 Hashtable upgradedImagesRows = new Hashtable(); 1259 var upgradedImagesRows = new Hashtable();
1399 1260
1400 // index the TargetImages table 1261 // index the TargetImages table
1401 if (null != targetImagesTable) 1262 if (null != targetImagesTable)
1402 { 1263 {
1403 foreach (Row row in targetImagesTable.Rows) 1264 foreach (var row in targetImagesTable.Rows)
1404 { 1265 {
1405 targetImageRows.Add(row[0], row); 1266 targetImageRows.Add(row[0], row);
1406 } 1267 }
@@ -1409,31 +1270,31 @@ namespace WixToolset.Core.WindowsInstaller
1409 // index the UpgradedImages table 1270 // index the UpgradedImages table
1410 if (null != upgradedImagesTable) 1271 if (null != upgradedImagesTable)
1411 { 1272 {
1412 foreach (Row row in upgradedImagesTable.Rows) 1273 foreach (var row in upgradedImagesTable.Rows)
1413 { 1274 {
1414 upgradedImagesRows.Add(row[0], row); 1275 upgradedImagesRows.Add(row[0], row);
1415 } 1276 }
1416 } 1277 }
1417 1278
1418 foreach (Row row in targetFiles_OptionalDataTable.Rows) 1279 foreach (var row in targetFiles_OptionalDataTable.Rows)
1419 { 1280 {
1420 Wix.TargetFile targetFile = (Wix.TargetFile)this.patchTargetFiles[row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)]; 1281 var targetFile = (Wix.TargetFile)this.patchTargetFiles[row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)];
1421 1282
1422 Row targetImageRow = (Row)targetImageRows[row[0]]; 1283 var targetImageRow = (Row)targetImageRows[row[0]];
1423 if (null == targetImageRow) 1284 if (null == targetImageRow)
1424 { 1285 {
1425 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, targetFiles_OptionalDataTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Target", Convert.ToString(row[0]), "TargetImages")); 1286 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, targetFiles_OptionalDataTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Target", Convert.ToString(row[0]), "TargetImages"));
1426 continue; 1287 continue;
1427 } 1288 }
1428 1289
1429 Row upgradedImagesRow = (Row)upgradedImagesRows[targetImageRow[3]]; 1290 var upgradedImagesRow = (Row)upgradedImagesRows[targetImageRow[3]];
1430 if (null == upgradedImagesRow) 1291 if (null == upgradedImagesRow)
1431 { 1292 {
1432 this.core.OnMessage(WixWarnings.ExpectedForeignRow(targetImageRow.SourceLineNumbers, targetImageRow.Table.Name, targetImageRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[3]), "UpgradedImages")); 1293 this.Messaging.Write(WarningMessages.ExpectedForeignRow(targetImageRow.SourceLineNumbers, targetImageRow.Table.Name, targetImageRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[3]), "UpgradedImages"));
1433 continue; 1294 continue;
1434 } 1295 }
1435 1296
1436 Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement("FamilyFileRanges", Convert.ToString(upgradedImagesRow[4]), Convert.ToString(row[1])); 1297 var protectRange = (Wix.ProtectRange)this.core.GetIndexedElement("FamilyFileRanges", Convert.ToString(upgradedImagesRow[4]), Convert.ToString(row[1]));
1437 if (null != protectRange) 1298 if (null != protectRange)
1438 { 1299 {
1439 targetFile.AddChild(protectRange); 1300 targetFile.AddChild(protectRange);
@@ -1444,26 +1305,26 @@ namespace WixToolset.Core.WindowsInstaller
1444 1305
1445 if (null != familyFileRangesTable) 1306 if (null != familyFileRangesTable)
1446 { 1307 {
1447 foreach (Row row in familyFileRangesTable.Rows) 1308 foreach (var row in familyFileRangesTable.Rows)
1448 { 1309 {
1449 Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement(row); 1310 var protectRange = (Wix.ProtectRange)this.core.GetIndexedElement(row);
1450 1311
1451 if (!usedProtectRanges.Contains(protectRange)) 1312 if (!usedProtectRanges.Contains(protectRange))
1452 { 1313 {
1453 Wix.ProtectFile protectFile = new Wix.ProtectFile(); 1314 var protectFile = new Wix.ProtectFile();
1454 1315
1455 protectFile.File = Convert.ToString(row[1]); 1316 protectFile.File = Convert.ToString(row[1]);
1456 1317
1457 protectFile.AddChild(protectRange); 1318 protectFile.AddChild(protectRange);
1458 1319
1459 Wix.Family family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[0])); 1320 var family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[0]));
1460 if (null != family) 1321 if (null != family)
1461 { 1322 {
1462 family.AddChild(protectFile); 1323 family.AddChild(protectFile);
1463 } 1324 }
1464 else 1325 else
1465 { 1326 {
1466 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, familyFileRangesTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[0]), "ImageFamilies")); 1327 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, familyFileRangesTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[0]), "ImageFamilies"));
1467 } 1328 }
1468 } 1329 }
1469 } 1330 }
@@ -1481,16 +1342,16 @@ namespace WixToolset.Core.WindowsInstaller
1481 /// </remarks> 1342 /// </remarks>
1482 private void FinalizeFeatureComponentsTable(TableIndexedCollection tables) 1343 private void FinalizeFeatureComponentsTable(TableIndexedCollection tables)
1483 { 1344 {
1484 Table classTable = tables["Class"]; 1345 var classTable = tables["Class"];
1485 Table extensionTable = tables["Extension"]; 1346 var extensionTable = tables["Extension"];
1486 Table msiAssemblyTable = tables["MsiAssembly"]; 1347 var msiAssemblyTable = tables["MsiAssembly"];
1487 Table publishComponentTable = tables["PublishComponent"]; 1348 var publishComponentTable = tables["PublishComponent"];
1488 Table shortcutTable = tables["Shortcut"]; 1349 var shortcutTable = tables["Shortcut"];
1489 Table typeLibTable = tables["TypeLib"]; 1350 var typeLibTable = tables["TypeLib"];
1490 1351
1491 if (null != classTable) 1352 if (null != classTable)
1492 { 1353 {
1493 foreach (Row row in classTable.Rows) 1354 foreach (var row in classTable.Rows)
1494 { 1355 {
1495 this.SetPrimaryFeature(row, 11, 2); 1356 this.SetPrimaryFeature(row, 11, 2);
1496 } 1357 }
@@ -1498,7 +1359,7 @@ namespace WixToolset.Core.WindowsInstaller
1498 1359
1499 if (null != extensionTable) 1360 if (null != extensionTable)
1500 { 1361 {
1501 foreach (Row row in extensionTable.Rows) 1362 foreach (var row in extensionTable.Rows)
1502 { 1363 {
1503 this.SetPrimaryFeature(row, 4, 1); 1364 this.SetPrimaryFeature(row, 4, 1);
1504 } 1365 }
@@ -1506,7 +1367,7 @@ namespace WixToolset.Core.WindowsInstaller
1506 1367
1507 if (null != msiAssemblyTable) 1368 if (null != msiAssemblyTable)
1508 { 1369 {
1509 foreach (Row row in msiAssemblyTable.Rows) 1370 foreach (var row in msiAssemblyTable.Rows)
1510 { 1371 {
1511 this.SetPrimaryFeature(row, 1, 0); 1372 this.SetPrimaryFeature(row, 1, 0);
1512 } 1373 }
@@ -1514,7 +1375,7 @@ namespace WixToolset.Core.WindowsInstaller
1514 1375
1515 if (null != publishComponentTable) 1376 if (null != publishComponentTable)
1516 { 1377 {
1517 foreach (Row row in publishComponentTable.Rows) 1378 foreach (var row in publishComponentTable.Rows)
1518 { 1379 {
1519 this.SetPrimaryFeature(row, 4, 2); 1380 this.SetPrimaryFeature(row, 4, 2);
1520 } 1381 }
@@ -1522,9 +1383,9 @@ namespace WixToolset.Core.WindowsInstaller
1522 1383
1523 if (null != shortcutTable) 1384 if (null != shortcutTable)
1524 { 1385 {
1525 foreach (Row row in shortcutTable.Rows) 1386 foreach (var row in shortcutTable.Rows)
1526 { 1387 {
1527 string target = Convert.ToString(row[4]); 1388 var target = Convert.ToString(row[4]);
1528 1389
1529 if (!target.StartsWith("[", StringComparison.Ordinal) && !target.EndsWith("]", StringComparison.Ordinal)) 1390 if (!target.StartsWith("[", StringComparison.Ordinal) && !target.EndsWith("]", StringComparison.Ordinal))
1530 { 1391 {
@@ -1535,7 +1396,7 @@ namespace WixToolset.Core.WindowsInstaller
1535 1396
1536 if (null != typeLibTable) 1397 if (null != typeLibTable)
1537 { 1398 {
1538 foreach (Row row in typeLibTable.Rows) 1399 foreach (var row in typeLibTable.Rows)
1539 { 1400 {
1540 this.SetPrimaryFeature(row, 6, 2); 1401 this.SetPrimaryFeature(row, 6, 2);
1541 } 1402 }
@@ -1551,10 +1412,10 @@ namespace WixToolset.Core.WindowsInstaller
1551 /// </remarks> 1412 /// </remarks>
1552 private void FinalizeFileTable(TableIndexedCollection tables) 1413 private void FinalizeFileTable(TableIndexedCollection tables)
1553 { 1414 {
1554 Table fileTable = tables["File"]; 1415 var fileTable = tables["File"];
1555 Table mediaTable = tables["Media"]; 1416 var mediaTable = tables["Media"];
1556 Table msiAssemblyTable = tables["MsiAssembly"]; 1417 var msiAssemblyTable = tables["MsiAssembly"];
1557 Table typeLibTable = tables["TypeLib"]; 1418 var typeLibTable = tables["TypeLib"];
1558 1419
1559 // index the media table by media id 1420 // index the media table by media id
1560 RowDictionary<MediaRow> mediaRows; 1421 RowDictionary<MediaRow> mediaRows;
@@ -1568,7 +1429,7 @@ namespace WixToolset.Core.WindowsInstaller
1568 { 1429 {
1569 foreach (FileRow fileRow in fileTable.Rows) 1430 foreach (FileRow fileRow in fileTable.Rows)
1570 { 1431 {
1571 Wix.File file = (Wix.File)this.core.GetIndexedElement("File", fileRow.File); 1432 var file = (Wix.File)this.core.GetIndexedElement("File", fileRow.File);
1572 1433
1573 // Don't bother processing files that are orphaned (and won't show up in the output anyway) 1434 // Don't bother processing files that are orphaned (and won't show up in the output anyway)
1574 if (null != file.ParentElement) 1435 if (null != file.ParentElement)
@@ -1578,7 +1439,7 @@ namespace WixToolset.Core.WindowsInstaller
1578 { 1439 {
1579 foreach (MediaRow mediaRow in mediaTable.Rows) 1440 foreach (MediaRow mediaRow in mediaTable.Rows)
1580 { 1441 {
1581 if (fileRow.Sequence <= mediaRow.LastSequence) 1442 if (fileRow.Sequence <= mediaRow.LastSequence && mediaRow.DiskId != 1)
1582 { 1443 {
1583 file.DiskId = Convert.ToString(mediaRow.DiskId); 1444 file.DiskId = Convert.ToString(mediaRow.DiskId);
1584 break; 1445 break;
@@ -1587,17 +1448,17 @@ namespace WixToolset.Core.WindowsInstaller
1587 } 1448 }
1588 1449
1589 // set the source (done here because it requires information from the Directory table) 1450 // set the source (done here because it requires information from the Directory table)
1590 if (OutputType.Module == this.outputType) 1451 if (OutputType.Module == this.OutputType)
1591 { 1452 {
1592 file.Source = String.Concat(this.exportFilePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, file.Id, '.', this.modularizationGuid.Substring(1, 36).Replace('-', '_')); 1453 file.Source = String.Concat(this.BaseSourcePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, file.Id, '.', this.modularizationGuid.Substring(1, 36).Replace('-', '_'));
1593 } 1454 }
1594 else if (Wix.YesNoDefaultType.yes == file.Compressed || (Wix.YesNoDefaultType.no != file.Compressed && this.compressed)) 1455 else if (Wix.YesNoDefaultType.yes == file.Compressed || (Wix.YesNoDefaultType.no != file.Compressed && this.compressed))
1595 { 1456 {
1596 file.Source = String.Concat(this.exportFilePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, file.Id); 1457 file.Source = String.Concat(this.BaseSourcePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, file.Id);
1597 } 1458 }
1598 else // uncompressed 1459 else // uncompressed
1599 { 1460 {
1600 string fileName = (null != file.ShortName ? file.ShortName : file.Name); 1461 var fileName = (null != file.ShortName ? file.ShortName : file.Name);
1601 1462
1602 if (!this.shortNames && null != file.Name) 1463 if (!this.shortNames && null != file.Name)
1603 { 1464 {
@@ -1610,7 +1471,7 @@ namespace WixToolset.Core.WindowsInstaller
1610 } 1471 }
1611 else 1472 else
1612 { 1473 {
1613 string sourcePath = this.GetSourcePath(file); 1474 var sourcePath = this.GetSourcePath(file);
1614 1475
1615 file.Source = Path.Combine(sourcePath, fileName); 1476 file.Source = Path.Combine(sourcePath, fileName);
1616 } 1477 }
@@ -1622,19 +1483,19 @@ namespace WixToolset.Core.WindowsInstaller
1622 // set the file assemblies and manifests 1483 // set the file assemblies and manifests
1623 if (null != msiAssemblyTable) 1484 if (null != msiAssemblyTable)
1624 { 1485 {
1625 foreach (Row row in msiAssemblyTable.Rows) 1486 foreach (var row in msiAssemblyTable.Rows)
1626 { 1487 {
1627 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0])); 1488 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0]));
1628 1489
1629 if (null == component) 1490 if (null == component)
1630 { 1491 {
1631 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MsiAssembly", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[0]), "Component")); 1492 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "MsiAssembly", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[0]), "Component"));
1632 } 1493 }
1633 else 1494 else
1634 { 1495 {
1635 foreach (Wix.ISchemaElement element in component.Children) 1496 foreach (Wix.ISchemaElement element in component.Children)
1636 { 1497 {
1637 Wix.File file = element as Wix.File; 1498 var file = element as Wix.File;
1638 1499
1639 if (null != file && Wix.YesNoType.yes == file.KeyPath) 1500 if (null != file && Wix.YesNoType.yes == file.KeyPath)
1640 { 1501 {
@@ -1665,14 +1526,14 @@ namespace WixToolset.Core.WindowsInstaller
1665 // nest the TypeLib elements 1526 // nest the TypeLib elements
1666 if (null != typeLibTable) 1527 if (null != typeLibTable)
1667 { 1528 {
1668 foreach (Row row in typeLibTable.Rows) 1529 foreach (var row in typeLibTable.Rows)
1669 { 1530 {
1670 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2])); 1531 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2]));
1671 Wix.TypeLib typeLib = (Wix.TypeLib)this.core.GetIndexedElement(row); 1532 var typeLib = (Wix.TypeLib)this.core.GetIndexedElement(row);
1672 1533
1673 foreach (Wix.ISchemaElement element in component.Children) 1534 foreach (Wix.ISchemaElement element in component.Children)
1674 { 1535 {
1675 Wix.File file = element as Wix.File; 1536 var file = element as Wix.File;
1676 1537
1677 if (null != file && Wix.YesNoType.yes == file.KeyPath) 1538 if (null != file && Wix.YesNoType.yes == file.KeyPath)
1678 { 1539 {
@@ -1694,16 +1555,16 @@ namespace WixToolset.Core.WindowsInstaller
1694 /// </remarks> 1555 /// </remarks>
1695 private void FinalizeMIMETable(TableIndexedCollection tables) 1556 private void FinalizeMIMETable(TableIndexedCollection tables)
1696 { 1557 {
1697 Table extensionTable = tables["Extension"]; 1558 var extensionTable = tables["Extension"];
1698 Table mimeTable = tables["MIME"]; 1559 var mimeTable = tables["MIME"];
1699 1560
1700 Hashtable comExtensions = new Hashtable(); 1561 var comExtensions = new Hashtable();
1701 1562
1702 if (null != extensionTable) 1563 if (null != extensionTable)
1703 { 1564 {
1704 foreach (Row row in extensionTable.Rows) 1565 foreach (var row in extensionTable.Rows)
1705 { 1566 {
1706 Wix.Extension extension = (Wix.Extension)this.core.GetIndexedElement(row); 1567 var extension = (Wix.Extension)this.core.GetIndexedElement(row);
1707 1568
1708 // index the extension 1569 // index the extension
1709 if (!comExtensions.Contains(row[0])) 1570 if (!comExtensions.Contains(row[0]))
@@ -1715,7 +1576,7 @@ namespace WixToolset.Core.WindowsInstaller
1715 // set the default MIME element for this extension 1576 // set the default MIME element for this extension
1716 if (null != row[3]) 1577 if (null != row[3])
1717 { 1578 {
1718 Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement("MIME", Convert.ToString(row[3])); 1579 var mime = (Wix.MIME)this.core.GetIndexedElement("MIME", Convert.ToString(row[3]));
1719 1580
1720 if (null != mime) 1581 if (null != mime)
1721 { 1582 {
@@ -1723,7 +1584,7 @@ namespace WixToolset.Core.WindowsInstaller
1723 } 1584 }
1724 else 1585 else
1725 { 1586 {
1726 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Extension", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "MIME_", Convert.ToString(row[3]), "MIME")); 1587 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Extension", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "MIME_", Convert.ToString(row[3]), "MIME"));
1727 } 1588 }
1728 } 1589 }
1729 } 1590 }
@@ -1731,13 +1592,13 @@ namespace WixToolset.Core.WindowsInstaller
1731 1592
1732 if (null != mimeTable) 1593 if (null != mimeTable)
1733 { 1594 {
1734 foreach (Row row in mimeTable.Rows) 1595 foreach (var row in mimeTable.Rows)
1735 { 1596 {
1736 Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement(row); 1597 var mime = (Wix.MIME)this.core.GetIndexedElement(row);
1737 1598
1738 if (comExtensions.Contains(row[1])) 1599 if (comExtensions.Contains(row[1]))
1739 { 1600 {
1740 ArrayList extensionElements = (ArrayList)comExtensions[row[1]]; 1601 var extensionElements = (ArrayList)comExtensions[row[1]];
1741 1602
1742 foreach (Wix.Extension extension in extensionElements) 1603 foreach (Wix.Extension extension in extensionElements)
1743 { 1604 {
@@ -1746,7 +1607,7 @@ namespace WixToolset.Core.WindowsInstaller
1746 } 1607 }
1747 else 1608 else
1748 { 1609 {
1749 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MIME", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Extension_", Convert.ToString(row[1]), "Extension")); 1610 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "MIME", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Extension_", Convert.ToString(row[1]), "Extension"));
1750 } 1611 }
1751 } 1612 }
1752 } 1613 }
@@ -1764,31 +1625,31 @@ namespace WixToolset.Core.WindowsInstaller
1764 /// </remarks> 1625 /// </remarks>
1765 private void FinalizeProgIdTable(TableIndexedCollection tables) 1626 private void FinalizeProgIdTable(TableIndexedCollection tables)
1766 { 1627 {
1767 Table classTable = tables["Class"]; 1628 var classTable = tables["Class"];
1768 Table progIdTable = tables["ProgId"]; 1629 var progIdTable = tables["ProgId"];
1769 Table extensionTable = tables["Extension"]; 1630 var extensionTable = tables["Extension"];
1770 Table componentTable = tables["Component"]; 1631 var componentTable = tables["Component"];
1771 1632
1772 Hashtable addedProgIds = new Hashtable(); 1633 var addedProgIds = new Hashtable();
1773 Hashtable classes = new Hashtable(); 1634 var classes = new Hashtable();
1774 Hashtable components = new Hashtable(); 1635 var components = new Hashtable();
1775 1636
1776 // add the default ProgIds for each class (and index the class table) 1637 // add the default ProgIds for each class (and index the class table)
1777 if (null != classTable) 1638 if (null != classTable)
1778 { 1639 {
1779 foreach (Row row in classTable.Rows) 1640 foreach (var row in classTable.Rows)
1780 { 1641 {
1781 Wix.Class wixClass = (Wix.Class)this.core.GetIndexedElement(row); 1642 var wixClass = (Wix.Class)this.core.GetIndexedElement(row);
1782 1643
1783 if (null != row[3]) 1644 if (null != row[3])
1784 { 1645 {
1785 Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[3])); 1646 var progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[3]));
1786 1647
1787 if (null != progId) 1648 if (null != progId)
1788 { 1649 {
1789 if (addedProgIds.Contains(progId)) 1650 if (addedProgIds.Contains(progId))
1790 { 1651 {
1791 this.core.OnMessage(WixWarnings.TooManyProgIds(row.SourceLineNumbers, Convert.ToString(row[0]), Convert.ToString(row[3]), Convert.ToString(addedProgIds[progId]))); 1652 this.Messaging.Write(WarningMessages.TooManyProgIds(row.SourceLineNumbers, Convert.ToString(row[0]), Convert.ToString(row[3]), Convert.ToString(addedProgIds[progId])));
1792 } 1653 }
1793 else 1654 else
1794 { 1655 {
@@ -1798,7 +1659,7 @@ namespace WixToolset.Core.WindowsInstaller
1798 } 1659 }
1799 else 1660 else
1800 { 1661 {
1801 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Class", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_Default", Convert.ToString(row[3]), "ProgId")); 1662 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Class", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_Default", Convert.ToString(row[3]), "ProgId"));
1802 } 1663 }
1803 } 1664 }
1804 1665
@@ -1814,13 +1675,13 @@ namespace WixToolset.Core.WindowsInstaller
1814 // add the remaining non-default ProgId entries for each class 1675 // add the remaining non-default ProgId entries for each class
1815 if (null != progIdTable) 1676 if (null != progIdTable)
1816 { 1677 {
1817 foreach (Row row in progIdTable.Rows) 1678 foreach (var row in progIdTable.Rows)
1818 { 1679 {
1819 Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement(row); 1680 var progId = (Wix.ProgId)this.core.GetIndexedElement(row);
1820 1681
1821 if (!addedProgIds.Contains(progId) && null != row[2] && null == progId.ParentElement) 1682 if (!addedProgIds.Contains(progId) && null != row[2] && null == progId.ParentElement)
1822 { 1683 {
1823 ArrayList classElements = (ArrayList)classes[row[2]]; 1684 var classElements = (ArrayList)classes[row[2]];
1824 1685
1825 if (null != classElements) 1686 if (null != classElements)
1826 { 1687 {
@@ -1832,7 +1693,7 @@ namespace WixToolset.Core.WindowsInstaller
1832 } 1693 }
1833 else 1694 else
1834 { 1695 {
1835 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "ProgId", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Class_", Convert.ToString(row[2]), "Class")); 1696 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "ProgId", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Class_", Convert.ToString(row[2]), "Class"));
1836 } 1697 }
1837 } 1698 }
1838 } 1699 }
@@ -1840,9 +1701,9 @@ namespace WixToolset.Core.WindowsInstaller
1840 1701
1841 if (null != componentTable) 1702 if (null != componentTable)
1842 { 1703 {
1843 foreach (Row row in componentTable.Rows) 1704 foreach (var row in componentTable.Rows)
1844 { 1705 {
1845 Wix.Component wixComponent = (Wix.Component)this.core.GetIndexedElement(row); 1706 var wixComponent = (Wix.Component)this.core.GetIndexedElement(row);
1846 1707
1847 // index the Class elements for nesting of ProgId elements (which don't use the full Class primary key) 1708 // index the Class elements for nesting of ProgId elements (which don't use the full Class primary key)
1848 if (!components.Contains(wixComponent.Id)) 1709 if (!components.Contains(wixComponent.Id))
@@ -1856,7 +1717,7 @@ namespace WixToolset.Core.WindowsInstaller
1856 // Check for any progIds that are not hooked up to a class and hook them up to the component specified by the extension 1717 // Check for any progIds that are not hooked up to a class and hook them up to the component specified by the extension
1857 if (null != extensionTable) 1718 if (null != extensionTable)
1858 { 1719 {
1859 foreach (Row row in extensionTable.Rows) 1720 foreach (var row in extensionTable.Rows)
1860 { 1721 {
1861 // ignore the extension if it isn't associated with a progId 1722 // ignore the extension if it isn't associated with a progId
1862 if (null == row[2]) 1723 if (null == row[2])
@@ -1864,12 +1725,12 @@ namespace WixToolset.Core.WindowsInstaller
1864 continue; 1725 continue;
1865 } 1726 }
1866 1727
1867 Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[2])); 1728 var progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[2]));
1868 1729
1869 // Haven't added the progId yet and it doesn't have a parent progId 1730 // Haven't added the progId yet and it doesn't have a parent progId
1870 if (!addedProgIds.Contains(progId) && null == progId.ParentElement) 1731 if (!addedProgIds.Contains(progId) && null == progId.ParentElement)
1871 { 1732 {
1872 ArrayList componentElements = (ArrayList)components[row[1]]; 1733 var componentElements = (ArrayList)components[row[1]];
1873 1734
1874 if (null != componentElements) 1735 if (null != componentElements)
1875 { 1736 {
@@ -1880,7 +1741,7 @@ namespace WixToolset.Core.WindowsInstaller
1880 } 1741 }
1881 else 1742 else
1882 { 1743 {
1883 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "Extension", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 1744 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "Extension", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
1884 } 1745 }
1885 } 1746 }
1886 } 1747 }
@@ -1896,18 +1757,18 @@ namespace WixToolset.Core.WindowsInstaller
1896 /// </remarks> 1757 /// </remarks>
1897 private void FinalizePropertyTable(TableIndexedCollection tables) 1758 private void FinalizePropertyTable(TableIndexedCollection tables)
1898 { 1759 {
1899 Table propertyTable = tables["Property"]; 1760 var propertyTable = tables["Property"];
1900 Table customActionTable = tables["CustomAction"]; 1761 var customActionTable = tables["CustomAction"];
1901 1762
1902 if (null != propertyTable && null != customActionTable) 1763 if (null != propertyTable && null != customActionTable)
1903 { 1764 {
1904 foreach (Row row in customActionTable.Rows) 1765 foreach (var row in customActionTable.Rows)
1905 { 1766 {
1906 int bits = Convert.ToInt32(row[1]); 1767 var bits = Convert.ToInt32(row[1]);
1907 if (MsiInterop.MsidbCustomActionTypeHideTarget == (bits & MsiInterop.MsidbCustomActionTypeHideTarget) && 1768 if (MsiInterop.MsidbCustomActionTypeHideTarget == (bits & MsiInterop.MsidbCustomActionTypeHideTarget) &&
1908 MsiInterop.MsidbCustomActionTypeInScript == (bits & MsiInterop.MsidbCustomActionTypeInScript)) 1769 MsiInterop.MsidbCustomActionTypeInScript == (bits & MsiInterop.MsidbCustomActionTypeInScript))
1909 { 1770 {
1910 Wix.Property property = (Wix.Property)this.core.GetIndexedElement("Property", Convert.ToString(row[0])); 1771 var property = (Wix.Property)this.core.GetIndexedElement("Property", Convert.ToString(row[0]));
1911 1772
1912 // If no other fields on the property are set we must have created it during link 1773 // If no other fields on the property are set we must have created it during link
1913 if (null != property && null == property.Value && Wix.YesNoType.yes != property.Secure && Wix.YesNoType.yes != property.SuppressModularization) 1774 if (null != property && null == property.Value && Wix.YesNoType.yes != property.Secure && Wix.YesNoType.yes != property.SuppressModularization)
@@ -1928,14 +1789,14 @@ namespace WixToolset.Core.WindowsInstaller
1928 /// </remarks> 1789 /// </remarks>
1929 private void FinalizeRemoveFileTable(TableIndexedCollection tables) 1790 private void FinalizeRemoveFileTable(TableIndexedCollection tables)
1930 { 1791 {
1931 Table removeFileTable = tables["RemoveFile"]; 1792 var removeFileTable = tables["RemoveFile"];
1932 1793
1933 if (null != removeFileTable) 1794 if (null != removeFileTable)
1934 { 1795 {
1935 foreach (Row row in removeFileTable.Rows) 1796 foreach (var row in removeFileTable.Rows)
1936 { 1797 {
1937 bool isDirectory = false; 1798 var isDirectory = false;
1938 string property = Convert.ToString(row[3]); 1799 var property = Convert.ToString(row[3]);
1939 1800
1940 // determine if the property is actually authored as a directory 1801 // determine if the property is actually authored as a directory
1941 if (null != this.core.GetIndexedElement("Directory", property)) 1802 if (null != this.core.GetIndexedElement("Directory", property))
@@ -1943,9 +1804,9 @@ namespace WixToolset.Core.WindowsInstaller
1943 isDirectory = true; 1804 isDirectory = true;
1944 } 1805 }
1945 1806
1946 Wix.ISchemaElement element = this.core.GetIndexedElement(row); 1807 var element = this.core.GetIndexedElement(row);
1947 1808
1948 Wix.RemoveFile removeFile = element as Wix.RemoveFile; 1809 var removeFile = element as Wix.RemoveFile;
1949 if (null != removeFile) 1810 if (null != removeFile)
1950 { 1811 {
1951 if (isDirectory) 1812 if (isDirectory)
@@ -1959,7 +1820,7 @@ namespace WixToolset.Core.WindowsInstaller
1959 } 1820 }
1960 else 1821 else
1961 { 1822 {
1962 Wix.RemoveFolder removeFolder = (Wix.RemoveFolder)element; 1823 var removeFolder = (Wix.RemoveFolder)element;
1963 1824
1964 if (isDirectory) 1825 if (isDirectory)
1965 { 1826 {
@@ -1984,19 +1845,19 @@ namespace WixToolset.Core.WindowsInstaller
1984 /// </remarks> 1845 /// </remarks>
1985 private void FinalizeLockPermissionsTable(TableIndexedCollection tables) 1846 private void FinalizeLockPermissionsTable(TableIndexedCollection tables)
1986 { 1847 {
1987 Table createFolderTable = tables["CreateFolder"]; 1848 var createFolderTable = tables["CreateFolder"];
1988 Table lockPermissionsTable = tables["LockPermissions"]; 1849 var lockPermissionsTable = tables["LockPermissions"];
1989 1850
1990 Hashtable createFolders = new Hashtable(); 1851 var createFolders = new Hashtable();
1991 1852
1992 // index the CreateFolder table because the foreign key to this table from the 1853 // index the CreateFolder table because the foreign key to this table from the
1993 // LockPermissions table is only part of the primary key of this table 1854 // LockPermissions table is only part of the primary key of this table
1994 if (null != createFolderTable) 1855 if (null != createFolderTable)
1995 { 1856 {
1996 foreach (Row row in createFolderTable.Rows) 1857 foreach (var row in createFolderTable.Rows)
1997 { 1858 {
1998 Wix.CreateFolder createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row); 1859 var createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row);
1999 string directoryId = Convert.ToString(row[0]); 1860 var directoryId = Convert.ToString(row[0]);
2000 1861
2001 if (!createFolders.Contains(directoryId)) 1862 if (!createFolders.Contains(directoryId))
2002 { 1863 {
@@ -2008,16 +1869,16 @@ namespace WixToolset.Core.WindowsInstaller
2008 1869
2009 if (null != lockPermissionsTable) 1870 if (null != lockPermissionsTable)
2010 { 1871 {
2011 foreach (Row row in lockPermissionsTable.Rows) 1872 foreach (var row in lockPermissionsTable.Rows)
2012 { 1873 {
2013 string id = Convert.ToString(row[0]); 1874 var id = Convert.ToString(row[0]);
2014 string table = Convert.ToString(row[1]); 1875 var table = Convert.ToString(row[1]);
2015 1876
2016 Wix.Permission permission = (Wix.Permission)this.core.GetIndexedElement(row); 1877 var permission = (Wix.Permission)this.core.GetIndexedElement(row);
2017 1878
2018 if ("CreateFolder" == table) 1879 if ("CreateFolder" == table)
2019 { 1880 {
2020 ArrayList createFolderElements = (ArrayList)createFolders[id]; 1881 var createFolderElements = (ArrayList)createFolders[id];
2021 1882
2022 if (null != createFolderElements) 1883 if (null != createFolderElements)
2023 { 1884 {
@@ -2028,12 +1889,12 @@ namespace WixToolset.Core.WindowsInstaller
2028 } 1889 }
2029 else 1890 else
2030 { 1891 {
2031 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "LockPermissions", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); 1892 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "LockPermissions", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table));
2032 } 1893 }
2033 } 1894 }
2034 else 1895 else
2035 { 1896 {
2036 Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id); 1897 var parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id);
2037 1898
2038 if (null != parentElement) 1899 if (null != parentElement)
2039 { 1900 {
@@ -2041,7 +1902,7 @@ namespace WixToolset.Core.WindowsInstaller
2041 } 1902 }
2042 else 1903 else
2043 { 1904 {
2044 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "LockPermissions", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); 1905 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "LockPermissions", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table));
2045 } 1906 }
2046 } 1907 }
2047 } 1908 }
@@ -2058,19 +1919,19 @@ namespace WixToolset.Core.WindowsInstaller
2058 /// </remarks> 1919 /// </remarks>
2059 private void FinalizeMsiLockPermissionsExTable(TableIndexedCollection tables) 1920 private void FinalizeMsiLockPermissionsExTable(TableIndexedCollection tables)
2060 { 1921 {
2061 Table createFolderTable = tables["CreateFolder"]; 1922 var createFolderTable = tables["CreateFolder"];
2062 Table msiLockPermissionsExTable = tables["MsiLockPermissionsEx"]; 1923 var msiLockPermissionsExTable = tables["MsiLockPermissionsEx"];
2063 1924
2064 Hashtable createFolders = new Hashtable(); 1925 var createFolders = new Hashtable();
2065 1926
2066 // index the CreateFolder table because the foreign key to this table from the 1927 // index the CreateFolder table because the foreign key to this table from the
2067 // MsiLockPermissionsEx table is only part of the primary key of this table 1928 // MsiLockPermissionsEx table is only part of the primary key of this table
2068 if (null != createFolderTable) 1929 if (null != createFolderTable)
2069 { 1930 {
2070 foreach (Row row in createFolderTable.Rows) 1931 foreach (var row in createFolderTable.Rows)
2071 { 1932 {
2072 Wix.CreateFolder createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row); 1933 var createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row);
2073 string directoryId = Convert.ToString(row[0]); 1934 var directoryId = Convert.ToString(row[0]);
2074 1935
2075 if (!createFolders.Contains(directoryId)) 1936 if (!createFolders.Contains(directoryId))
2076 { 1937 {
@@ -2082,16 +1943,16 @@ namespace WixToolset.Core.WindowsInstaller
2082 1943
2083 if (null != msiLockPermissionsExTable) 1944 if (null != msiLockPermissionsExTable)
2084 { 1945 {
2085 foreach (Row row in msiLockPermissionsExTable.Rows) 1946 foreach (var row in msiLockPermissionsExTable.Rows)
2086 { 1947 {
2087 string id = Convert.ToString(row[1]); 1948 var id = Convert.ToString(row[1]);
2088 string table = Convert.ToString(row[2]); 1949 var table = Convert.ToString(row[2]);
2089 1950
2090 Wix.PermissionEx permissionEx = (Wix.PermissionEx)this.core.GetIndexedElement(row); 1951 var permissionEx = (Wix.PermissionEx)this.core.GetIndexedElement(row);
2091 1952
2092 if ("CreateFolder" == table) 1953 if ("CreateFolder" == table)
2093 { 1954 {
2094 ArrayList createFolderElements = (ArrayList)createFolders[id]; 1955 var createFolderElements = (ArrayList)createFolders[id];
2095 1956
2096 if (null != createFolderElements) 1957 if (null != createFolderElements)
2097 { 1958 {
@@ -2102,12 +1963,12 @@ namespace WixToolset.Core.WindowsInstaller
2102 } 1963 }
2103 else 1964 else
2104 { 1965 {
2105 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MsiLockPermissionsEx", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); 1966 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "MsiLockPermissionsEx", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table));
2106 } 1967 }
2107 } 1968 }
2108 else 1969 else
2109 { 1970 {
2110 Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id); 1971 var parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id);
2111 1972
2112 if (null != parentElement) 1973 if (null != parentElement)
2113 { 1974 {
@@ -2115,7 +1976,7 @@ namespace WixToolset.Core.WindowsInstaller
2115 } 1976 }
2116 else 1977 else
2117 { 1978 {
2118 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, "MsiLockPermissionsEx", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table)); 1979 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, "MsiLockPermissionsEx", row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "LockObject", id, table));
2119 } 1980 }
2120 } 1981 }
2121 } 1982 }
@@ -2129,26 +1990,26 @@ namespace WixToolset.Core.WindowsInstaller
2129 /// <remarks>Does all the complex linking required for the search tables.</remarks> 1990 /// <remarks>Does all the complex linking required for the search tables.</remarks>
2130 private void FinalizeSearchTables(TableIndexedCollection tables) 1991 private void FinalizeSearchTables(TableIndexedCollection tables)
2131 { 1992 {
2132 Table appSearchTable = tables["AppSearch"]; 1993 var appSearchTable = tables["AppSearch"];
2133 Table ccpSearchTable = tables["CCPSearch"]; 1994 var ccpSearchTable = tables["CCPSearch"];
2134 Table drLocatorTable = tables["DrLocator"]; 1995 var drLocatorTable = tables["DrLocator"];
2135 1996
2136 Hashtable appSearches = new Hashtable(); 1997 var appSearches = new Hashtable();
2137 Hashtable ccpSearches = new Hashtable(); 1998 var ccpSearches = new Hashtable();
2138 Hashtable drLocators = new Hashtable(); 1999 var drLocators = new Hashtable();
2139 Hashtable locators = new Hashtable(); 2000 var locators = new Hashtable();
2140 Hashtable usedSearchElements = new Hashtable(); 2001 var usedSearchElements = new Hashtable();
2141 ArrayList unusedSearchElements = new ArrayList(); 2002 var unusedSearchElements = new ArrayList();
2142 2003
2143 Wix.ComplianceCheck complianceCheck = null; 2004 Wix.ComplianceCheck complianceCheck = null;
2144 2005
2145 // index the AppSearch table by signatures 2006 // index the AppSearch table by signatures
2146 if (null != appSearchTable) 2007 if (null != appSearchTable)
2147 { 2008 {
2148 foreach (Row row in appSearchTable.Rows) 2009 foreach (var row in appSearchTable.Rows)
2149 { 2010 {
2150 string property = Convert.ToString(row[0]); 2011 var property = Convert.ToString(row[0]);
2151 string signature = Convert.ToString(row[1]); 2012 var signature = Convert.ToString(row[1]);
2152 2013
2153 if (!appSearches.Contains(signature)) 2014 if (!appSearches.Contains(signature))
2154 { 2015 {
@@ -2162,9 +2023,9 @@ namespace WixToolset.Core.WindowsInstaller
2162 // index the CCPSearch table by signatures 2023 // index the CCPSearch table by signatures
2163 if (null != ccpSearchTable) 2024 if (null != ccpSearchTable)
2164 { 2025 {
2165 foreach (Row row in ccpSearchTable.Rows) 2026 foreach (var row in ccpSearchTable.Rows)
2166 { 2027 {
2167 string signature = Convert.ToString(row[0]); 2028 var signature = Convert.ToString(row[0]);
2168 2029
2169 if (!ccpSearches.Contains(signature)) 2030 if (!ccpSearches.Contains(signature))
2170 { 2031 {
@@ -2184,23 +2045,23 @@ namespace WixToolset.Core.WindowsInstaller
2184 // index the directory searches by their search elements (to get back the original row) 2045 // index the directory searches by their search elements (to get back the original row)
2185 if (null != drLocatorTable) 2046 if (null != drLocatorTable)
2186 { 2047 {
2187 foreach (Row row in drLocatorTable.Rows) 2048 foreach (var row in drLocatorTable.Rows)
2188 { 2049 {
2189 drLocators.Add(this.core.GetIndexedElement(row), row); 2050 drLocators.Add(this.core.GetIndexedElement(row), row);
2190 } 2051 }
2191 } 2052 }
2192 2053
2193 // index the locator tables by their signatures 2054 // index the locator tables by their signatures
2194 string[] locatorTableNames = new string[] { "CompLocator", "RegLocator", "IniLocator", "DrLocator", "Signature" }; 2055 var locatorTableNames = new string[] { "CompLocator", "RegLocator", "IniLocator", "DrLocator", "Signature" };
2195 foreach (string locatorTableName in locatorTableNames) 2056 foreach (var locatorTableName in locatorTableNames)
2196 { 2057 {
2197 Table locatorTable = tables[locatorTableName]; 2058 var locatorTable = tables[locatorTableName];
2198 2059
2199 if (null != locatorTable) 2060 if (null != locatorTable)
2200 { 2061 {
2201 foreach (Row row in locatorTable.Rows) 2062 foreach (var row in locatorTable.Rows)
2202 { 2063 {
2203 string signature = Convert.ToString(row[0]); 2064 var signature = Convert.ToString(row[0]);
2204 2065
2205 if (!locators.Contains(signature)) 2066 if (!locators.Contains(signature))
2206 { 2067 {
@@ -2215,11 +2076,11 @@ namespace WixToolset.Core.WindowsInstaller
2215 // move the DrLocator rows with a parent of CCP_DRIVE first to ensure they get FileSearch children (not FileSearchRef) 2076 // move the DrLocator rows with a parent of CCP_DRIVE first to ensure they get FileSearch children (not FileSearchRef)
2216 foreach (ArrayList locatorRows in locators.Values) 2077 foreach (ArrayList locatorRows in locators.Values)
2217 { 2078 {
2218 int firstDrLocator = -1; 2079 var firstDrLocator = -1;
2219 2080
2220 for (int i = 0; i < locatorRows.Count; i++) 2081 for (var i = 0; i < locatorRows.Count; i++)
2221 { 2082 {
2222 Row locatorRow = (Row)locatorRows[i]; 2083 var locatorRow = (Row)locatorRows[i];
2223 2084
2224 if ("DrLocator" == locatorRow.TableDefinition.Name) 2085 if ("DrLocator" == locatorRow.TableDefinition.Name)
2225 { 2086 {
@@ -2240,13 +2101,13 @@ namespace WixToolset.Core.WindowsInstaller
2240 2101
2241 foreach (string signature in locators.Keys) 2102 foreach (string signature in locators.Keys)
2242 { 2103 {
2243 ArrayList locatorRows = (ArrayList)locators[signature]; 2104 var locatorRows = (ArrayList)locators[signature];
2244 ArrayList signatureSearchElements = new ArrayList(); 2105 var signatureSearchElements = new ArrayList();
2245 2106
2246 foreach (Row locatorRow in locatorRows) 2107 foreach (Row locatorRow in locatorRows)
2247 { 2108 {
2248 bool used = true; 2109 var used = true;
2249 Wix.ISchemaElement searchElement = this.core.GetIndexedElement(locatorRow); 2110 var searchElement = this.core.GetIndexedElement(locatorRow);
2250 2111
2251 if ("Signature" == locatorRow.TableDefinition.Name && 0 < signatureSearchElements.Count) 2112 if ("Signature" == locatorRow.TableDefinition.Name && 0 < signatureSearchElements.Count)
2252 { 2113 {
@@ -2259,7 +2120,7 @@ namespace WixToolset.Core.WindowsInstaller
2259 } 2120 }
2260 else 2121 else
2261 { 2122 {
2262 Wix.FileSearchRef fileSearchRef = new Wix.FileSearchRef(); 2123 var fileSearchRef = new Wix.FileSearchRef();
2263 2124
2264 fileSearchRef.Id = signature; 2125 fileSearchRef.Id = signature;
2265 2126
@@ -2269,17 +2130,17 @@ namespace WixToolset.Core.WindowsInstaller
2269 } 2130 }
2270 else if ("DrLocator" == locatorRow.TableDefinition.Name && null != locatorRow[1]) 2131 else if ("DrLocator" == locatorRow.TableDefinition.Name && null != locatorRow[1])
2271 { 2132 {
2272 string parentSignature = Convert.ToString(locatorRow[1]); 2133 var parentSignature = Convert.ToString(locatorRow[1]);
2273 2134
2274 if ("CCP_DRIVE" == parentSignature) 2135 if ("CCP_DRIVE" == parentSignature)
2275 { 2136 {
2276 if (appSearches.Contains(signature)) 2137 if (appSearches.Contains(signature))
2277 { 2138 {
2278 StringCollection appSearchPropertyIds = (StringCollection)appSearches[signature]; 2139 var appSearchPropertyIds = (StringCollection)appSearches[signature];
2279 2140
2280 foreach (string propertyId in appSearchPropertyIds) 2141 foreach (var propertyId in appSearchPropertyIds)
2281 { 2142 {
2282 Wix.Property property = this.EnsureProperty(propertyId); 2143 var property = this.EnsureProperty(propertyId);
2283 Wix.ComplianceDrive complianceDrive = null; 2144 Wix.ComplianceDrive complianceDrive = null;
2284 2145
2285 if (ccpSearches.Contains(signature)) 2146 if (ccpSearches.Contains(signature))
@@ -2309,7 +2170,7 @@ namespace WixToolset.Core.WindowsInstaller
2309 } 2170 }
2310 else 2171 else
2311 { 2172 {
2312 Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef(); 2173 var directorySearchRef = new Wix.DirectorySearchRef();
2313 2174
2314 directorySearchRef.Id = signature; 2175 directorySearchRef.Id = signature;
2315 2176
@@ -2354,7 +2215,7 @@ namespace WixToolset.Core.WindowsInstaller
2354 } 2215 }
2355 else 2216 else
2356 { 2217 {
2357 Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef(); 2218 var directorySearchRef = new Wix.DirectorySearchRef();
2358 2219
2359 directorySearchRef.Id = signature; 2220 directorySearchRef.Id = signature;
2360 2221
@@ -2375,8 +2236,8 @@ namespace WixToolset.Core.WindowsInstaller
2375 } 2236 }
2376 else 2237 else
2377 { 2238 {
2378 bool usedDrLocator = false; 2239 var usedDrLocator = false;
2379 ArrayList parentLocatorRows = (ArrayList)locators[parentSignature]; 2240 var parentLocatorRows = (ArrayList)locators[parentSignature];
2380 2241
2381 if (null != parentLocatorRows) 2242 if (null != parentLocatorRows)
2382 { 2243 {
@@ -2384,12 +2245,12 @@ namespace WixToolset.Core.WindowsInstaller
2384 { 2245 {
2385 if ("DrLocator" == parentLocatorRow.TableDefinition.Name) 2246 if ("DrLocator" == parentLocatorRow.TableDefinition.Name)
2386 { 2247 {
2387 Wix.IParentElement parentSearchElement = (Wix.IParentElement)this.core.GetIndexedElement(parentLocatorRow); 2248 var parentSearchElement = (Wix.IParentElement)this.core.GetIndexedElement(parentLocatorRow);
2388 2249
2389 if (parentSearchElement.Children.GetEnumerator().MoveNext()) 2250 if (parentSearchElement.Children.GetEnumerator().MoveNext())
2390 { 2251 {
2391 Row parentDrLocatorRow = (Row)drLocators[parentSearchElement]; 2252 var parentDrLocatorRow = (Row)drLocators[parentSearchElement];
2392 Wix.DirectorySearchRef directorySeachRef = new Wix.DirectorySearchRef(); 2253 var directorySeachRef = new Wix.DirectorySearchRef();
2393 2254
2394 directorySeachRef.Id = parentSignature; 2255 directorySeachRef.Id = parentSignature;
2395 2256
@@ -2415,7 +2276,7 @@ namespace WixToolset.Core.WindowsInstaller
2415 } 2276 }
2416 else 2277 else
2417 { 2278 {
2418 Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef(); 2279 var directorySearchRef = new Wix.DirectorySearchRef();
2419 2280
2420 directorySearchRef.Id = signature; 2281 directorySearchRef.Id = signature;
2421 2282
@@ -2446,11 +2307,11 @@ namespace WixToolset.Core.WindowsInstaller
2446 } 2307 }
2447 else if (appSearches.Contains(signature)) 2308 else if (appSearches.Contains(signature))
2448 { 2309 {
2449 StringCollection appSearchPropertyIds = (StringCollection)appSearches[signature]; 2310 var appSearchPropertyIds = (StringCollection)appSearches[signature];
2450 2311
2451 foreach (string propertyId in appSearchPropertyIds) 2312 foreach (var propertyId in appSearchPropertyIds)
2452 { 2313 {
2453 Wix.Property property = this.EnsureProperty(propertyId); 2314 var property = this.EnsureProperty(propertyId);
2454 2315
2455 if (ccpSearches.Contains(signature)) 2316 if (ccpSearches.Contains(signature))
2456 { 2317 {
@@ -2464,7 +2325,7 @@ namespace WixToolset.Core.WindowsInstaller
2464 } 2325 }
2465 else if ("RegLocator" == locatorRow.TableDefinition.Name) 2326 else if ("RegLocator" == locatorRow.TableDefinition.Name)
2466 { 2327 {
2467 Wix.RegistrySearchRef registrySearchRef = new Wix.RegistrySearchRef(); 2328 var registrySearchRef = new Wix.RegistrySearchRef();
2468 2329
2469 registrySearchRef.Id = signature; 2330 registrySearchRef.Id = signature;
2470 2331
@@ -2486,7 +2347,7 @@ namespace WixToolset.Core.WindowsInstaller
2486 } 2347 }
2487 else if ("RegLocator" == locatorRow.TableDefinition.Name) 2348 else if ("RegLocator" == locatorRow.TableDefinition.Name)
2488 { 2349 {
2489 Wix.RegistrySearchRef registrySearchRef = new Wix.RegistrySearchRef(); 2350 var registrySearchRef = new Wix.RegistrySearchRef();
2490 2351
2491 registrySearchRef.Id = signature; 2352 registrySearchRef.Id = signature;
2492 2353
@@ -2521,19 +2382,19 @@ namespace WixToolset.Core.WindowsInstaller
2521 2382
2522 foreach (Wix.IParentElement unusedSearchElement in unusedSearchElements) 2383 foreach (Wix.IParentElement unusedSearchElement in unusedSearchElements)
2523 { 2384 {
2524 bool used = false; 2385 var used = false;
2525 2386
2526 foreach (Wix.ISchemaElement schemaElement in unusedSearchElement.Children) 2387 foreach (Wix.ISchemaElement schemaElement in unusedSearchElement.Children)
2527 { 2388 {
2528 Wix.DirectorySearch directorySearch = schemaElement as Wix.DirectorySearch; 2389 var directorySearch = schemaElement as Wix.DirectorySearch;
2529 if (null != directorySearch) 2390 if (null != directorySearch)
2530 { 2391 {
2531 StringCollection appSearchProperties = (StringCollection)appSearches[directorySearch.Id]; 2392 var appSearchProperties = (StringCollection)appSearches[directorySearch.Id];
2532 2393
2533 Wix.ISchemaElement unusedSearchSchemaElement = unusedSearchElement as Wix.ISchemaElement; 2394 var unusedSearchSchemaElement = unusedSearchElement as Wix.ISchemaElement;
2534 if (null != appSearchProperties) 2395 if (null != appSearchProperties)
2535 { 2396 {
2536 Wix.Property property = this.EnsureProperty(appSearchProperties[0]); 2397 var property = this.EnsureProperty(appSearchProperties[0]);
2537 2398
2538 property.AddChild(unusedSearchSchemaElement); 2399 property.AddChild(unusedSearchSchemaElement);
2539 used = true; 2400 used = true;
@@ -2570,30 +2431,30 @@ namespace WixToolset.Core.WindowsInstaller
2570 private void FinalizeSequenceTables(TableIndexedCollection tables) 2431 private void FinalizeSequenceTables(TableIndexedCollection tables)
2571 { 2432 {
2572 // finalize the normal sequence tables 2433 // finalize the normal sequence tables
2573 if (OutputType.Product == this.outputType && !this.treatProductAsModule) 2434 if (OutputType.Product == this.OutputType && !this.TreatProductAsModule)
2574 { 2435 {
2575 foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable))) 2436 foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable)))
2576 { 2437 {
2577 // if suppressing UI elements, skip UI-related sequence tables 2438 // if suppressing UI elements, skip UI-related sequence tables
2578 if (this.suppressUI && ("AdminUISequence" == sequenceTable.ToString() || "InstallUISequence" == sequenceTable.ToString())) 2439 if (this.SuppressUI && ("AdminUISequence" == sequenceTable.ToString() || "InstallUISequence" == sequenceTable.ToString()))
2579 { 2440 {
2580 continue; 2441 continue;
2581 } 2442 }
2582 2443
2583 Table actionsTable = new Table(null, this.tableDefinitions["WixAction"]); 2444 var actionsTable = new Table(this.tableDefinitions["WixAction"]);
2584 Table table = tables[sequenceTable.ToString()]; 2445 var table = tables[sequenceTable.ToString()];
2585 2446
2586 if (null != table) 2447 if (null != table)
2587 { 2448 {
2588 ArrayList actionRows = new ArrayList(); 2449 var actionRows = new ArrayList();
2589 bool needAbsoluteScheduling = this.suppressRelativeActionSequencing; 2450 var needAbsoluteScheduling = this.SuppressRelativeActionSequencing;
2590 WixActionRowCollection nonSequencedActionRows = new WixActionRowCollection(); 2451 var nonSequencedActionRows = new WixActionRowCollection();
2591 WixActionRowCollection suppressedRelativeActionRows = new WixActionRowCollection(); 2452 var suppressedRelativeActionRows = new WixActionRowCollection();
2592 2453
2593 // create a sorted array of actions in this table 2454 // create a sorted array of actions in this table
2594 foreach (Row row in table.Rows) 2455 foreach (var row in table.Rows)
2595 { 2456 {
2596 WixActionRow actionRow = (WixActionRow)actionsTable.CreateRow(null); 2457 var actionRow = (WixActionRow)actionsTable.CreateRow(null);
2597 2458
2598 actionRow.Action = Convert.ToString(row[0]); 2459 actionRow.Action = Convert.ToString(row[0]);
2599 2460
@@ -2610,10 +2471,10 @@ namespace WixToolset.Core.WindowsInstaller
2610 } 2471 }
2611 actionRows.Sort(); 2472 actionRows.Sort();
2612 2473
2613 for (int i = 0; i < actionRows.Count && !needAbsoluteScheduling; i++) 2474 for (var i = 0; i < actionRows.Count && !needAbsoluteScheduling; i++)
2614 { 2475 {
2615 WixActionRow actionRow = (WixActionRow)actionRows[i]; 2476 var actionRow = (WixActionRow)actionRows[i];
2616 WixActionRow standardActionRow = this.standardActions[actionRow.SequenceTable, actionRow.Action]; 2477 this.StandardActions.TryGetValue(actionRow.GetPrimaryKey(), out var standardActionRow);
2617 2478
2618 // create actions for custom actions, dialogs, AppSearch when its moved, and standard actions with non-standard conditions 2479 // create actions for custom actions, dialogs, AppSearch when its moved, and standard actions with non-standard conditions
2619 if ("AppSearch" == actionRow.Action || null == standardActionRow || actionRow.Condition != standardActionRow.Condition) 2480 if ("AppSearch" == actionRow.Action || null == standardActionRow || actionRow.Condition != standardActionRow.Condition)
@@ -2646,11 +2507,11 @@ namespace WixToolset.Core.WindowsInstaller
2646 { 2507 {
2647 needAbsoluteScheduling = true; 2508 needAbsoluteScheduling = true;
2648 } 2509 }
2649 else if (null != nextActionRow && null != this.standardActions[sequenceTable, nextActionRow.Action] && actionRow.Sequence + 1 == nextActionRow.Sequence) 2510 else if (null != nextActionRow && this.StandardActions.ContainsKey(nextActionRow.GetPrimaryKey()) && actionRow.Sequence + 1 == nextActionRow.Sequence)
2650 { 2511 {
2651 actionRow.Before = nextActionRow.Action; 2512 actionRow.Before = nextActionRow.Action;
2652 } 2513 }
2653 else if (null != previousActionRow && null != this.standardActions[sequenceTable, previousActionRow.Action] && actionRow.Sequence - 1 == previousActionRow.Sequence) 2514 else if (null != previousActionRow && this.StandardActions.ContainsKey(previousActionRow.GetPrimaryKey()) && actionRow.Sequence - 1 == previousActionRow.Sequence)
2654 { 2515 {
2655 actionRow.After = previousActionRow.Action; 2516 actionRow.After = previousActionRow.Action;
2656 } 2517 }
@@ -2707,24 +2568,24 @@ namespace WixToolset.Core.WindowsInstaller
2707 } 2568 }
2708 } 2569 }
2709 } 2570 }
2710 else if (OutputType.Module == this.outputType || this.treatProductAsModule) // finalize the Module sequence tables 2571 else if (OutputType.Module == this.OutputType || this.TreatProductAsModule) // finalize the Module sequence tables
2711 { 2572 {
2712 foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable))) 2573 foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable)))
2713 { 2574 {
2714 // if suppressing UI elements, skip UI-related sequence tables 2575 // if suppressing UI elements, skip UI-related sequence tables
2715 if (this.suppressUI && ("AdminUISequence" == sequenceTable.ToString() || "InstallUISequence" == sequenceTable.ToString())) 2576 if (this.SuppressUI && ("AdminUISequence" == sequenceTable.ToString() || "InstallUISequence" == sequenceTable.ToString()))
2716 { 2577 {
2717 continue; 2578 continue;
2718 } 2579 }
2719 2580
2720 Table actionsTable = new Table(null, this.tableDefinitions["WixAction"]); 2581 var actionsTable = new Table(this.tableDefinitions["WixAction"]);
2721 Table table = tables[String.Concat("Module", sequenceTable.ToString())]; 2582 var table = tables[String.Concat("Module", sequenceTable.ToString())];
2722 2583
2723 if (null != table) 2584 if (null != table)
2724 { 2585 {
2725 foreach (Row row in table.Rows) 2586 foreach (var row in table.Rows)
2726 { 2587 {
2727 WixActionRow actionRow = (WixActionRow)actionsTable.CreateRow(null); 2588 var actionRow = (WixActionRow)actionsTable.CreateRow(null);
2728 2589
2729 actionRow.Action = Convert.ToString(row[0]); 2590 actionRow.Action = Convert.ToString(row[0]);
2730 2591
@@ -2737,15 +2598,15 @@ namespace WixToolset.Core.WindowsInstaller
2737 { 2598 {
2738 switch (Convert.ToInt32(row[3])) 2599 switch (Convert.ToInt32(row[3]))
2739 { 2600 {
2740 case 0: 2601 case 0:
2741 actionRow.Before = Convert.ToString(row[2]); 2602 actionRow.Before = Convert.ToString(row[2]);
2742 break; 2603 break;
2743 case 1: 2604 case 1:
2744 actionRow.After = Convert.ToString(row[2]); 2605 actionRow.After = Convert.ToString(row[2]);
2745 break; 2606 break;
2746 default: 2607 default:
2747 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[3].Column.Name, row[3])); 2608 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[3].Column.Name, row[3]));
2748 break; 2609 break;
2749 } 2610 }
2750 } 2611 }
2751 2612
@@ -2757,7 +2618,7 @@ namespace WixToolset.Core.WindowsInstaller
2757 actionRow.SequenceTable = sequenceTable; 2618 actionRow.SequenceTable = sequenceTable;
2758 2619
2759 // create action elements for non-standard actions 2620 // create action elements for non-standard actions
2760 if (null == this.standardActions[actionRow.SequenceTable, actionRow.Action] || null != actionRow.After || null != actionRow.Before) 2621 if (!this.StandardActions.ContainsKey(actionRow.GetPrimaryKey()) || null != actionRow.After || null != actionRow.Before)
2761 { 2622 {
2762 this.CreateActionElement(actionRow); 2623 this.CreateActionElement(actionRow);
2763 } 2624 }
@@ -2777,22 +2638,22 @@ namespace WixToolset.Core.WindowsInstaller
2777 /// </remarks> 2638 /// </remarks>
2778 private void FinalizeUpgradeTable(TableIndexedCollection tables) 2639 private void FinalizeUpgradeTable(TableIndexedCollection tables)
2779 { 2640 {
2780 Table launchConditionTable = tables["LaunchCondition"]; 2641 var launchConditionTable = tables["LaunchCondition"];
2781 Table upgradeTable = tables["Upgrade"]; 2642 var upgradeTable = tables["Upgrade"];
2782 string downgradeErrorMessage = null; 2643 string downgradeErrorMessage = null;
2783 string disallowUpgradeErrorMessage = null; 2644 string disallowUpgradeErrorMessage = null;
2784 Wix.MajorUpgrade majorUpgrade = new Wix.MajorUpgrade(); 2645 var majorUpgrade = new Wix.MajorUpgrade();
2785 2646
2786 // find the DowngradePreventedCondition launch condition message 2647 // find the DowngradePreventedCondition launch condition message
2787 if (null != launchConditionTable && 0 < launchConditionTable.Rows.Count) 2648 if (null != launchConditionTable && 0 < launchConditionTable.Rows.Count)
2788 { 2649 {
2789 foreach (Row launchRow in launchConditionTable.Rows) 2650 foreach (var launchRow in launchConditionTable.Rows)
2790 { 2651 {
2791 if (Compiler.DowngradePreventedCondition == Convert.ToString(launchRow[0])) 2652 if (Common.DowngradePreventedCondition == Convert.ToString(launchRow[0]))
2792 { 2653 {
2793 downgradeErrorMessage = Convert.ToString(launchRow[1]); 2654 downgradeErrorMessage = Convert.ToString(launchRow[1]);
2794 } 2655 }
2795 else if (Compiler.UpgradePreventedCondition == Convert.ToString(launchRow[0])) 2656 else if (Common.UpgradePreventedCondition == Convert.ToString(launchRow[0]))
2796 { 2657 {
2797 disallowUpgradeErrorMessage = Convert.ToString(launchRow[1]); 2658 disallowUpgradeErrorMessage = Convert.ToString(launchRow[1]);
2798 } 2659 }
@@ -2801,17 +2662,17 @@ namespace WixToolset.Core.WindowsInstaller
2801 2662
2802 if (null != upgradeTable && 0 < upgradeTable.Rows.Count) 2663 if (null != upgradeTable && 0 < upgradeTable.Rows.Count)
2803 { 2664 {
2804 bool hasMajorUpgrade = false; 2665 var hasMajorUpgrade = false;
2805 2666
2806 foreach (Row row in upgradeTable.Rows) 2667 foreach (var row in upgradeTable.Rows)
2807 { 2668 {
2808 UpgradeRow upgradeRow = (UpgradeRow)row; 2669 var upgradeRow = (UpgradeRow)row;
2809 2670
2810 if (Compiler.UpgradeDetectedProperty == upgradeRow.ActionProperty) 2671 if (Common.UpgradeDetectedProperty == upgradeRow.ActionProperty)
2811 { 2672 {
2812 hasMajorUpgrade = true; 2673 hasMajorUpgrade = true;
2813 int attr = upgradeRow.Attributes; 2674 var attr = upgradeRow.Attributes;
2814 string removeFeatures = upgradeRow.Remove; 2675 var removeFeatures = upgradeRow.Remove;
2815 2676
2816 if (MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive == (attr & MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive)) 2677 if (MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive == (attr & MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive))
2817 { 2678 {
@@ -2833,7 +2694,7 @@ namespace WixToolset.Core.WindowsInstaller
2833 majorUpgrade.RemoveFeatures = removeFeatures; 2694 majorUpgrade.RemoveFeatures = removeFeatures;
2834 } 2695 }
2835 } 2696 }
2836 else if (Compiler.DowngradeDetectedProperty == upgradeRow.ActionProperty) 2697 else if (Common.DowngradeDetectedProperty == upgradeRow.ActionProperty)
2837 { 2698 {
2838 hasMajorUpgrade = true; 2699 hasMajorUpgrade = true;
2839 majorUpgrade.DowngradeErrorMessage = downgradeErrorMessage; 2700 majorUpgrade.DowngradeErrorMessage = downgradeErrorMessage;
@@ -2853,7 +2714,12 @@ namespace WixToolset.Core.WindowsInstaller
2853 majorUpgrade.DisallowUpgradeErrorMessage = disallowUpgradeErrorMessage; 2714 majorUpgrade.DisallowUpgradeErrorMessage = disallowUpgradeErrorMessage;
2854 } 2715 }
2855 2716
2856 majorUpgrade.Schedule = DetermineMajorUpgradeScheduling(tables); 2717 var scheduledType = DetermineMajorUpgradeScheduling(tables);
2718 if (Wix.MajorUpgrade.ScheduleType.afterInstallValidate != scheduledType)
2719 {
2720 majorUpgrade.Schedule = scheduledType;
2721 }
2722
2857 this.core.RootElement.AddChild(majorUpgrade); 2723 this.core.RootElement.AddChild(majorUpgrade);
2858 } 2724 }
2859 } 2725 }
@@ -2870,16 +2736,16 @@ namespace WixToolset.Core.WindowsInstaller
2870 /// </remarks> 2736 /// </remarks>
2871 private void FinalizeVerbTable(TableIndexedCollection tables) 2737 private void FinalizeVerbTable(TableIndexedCollection tables)
2872 { 2738 {
2873 Table extensionTable = tables["Extension"]; 2739 var extensionTable = tables["Extension"];
2874 Table verbTable = tables["Verb"]; 2740 var verbTable = tables["Verb"];
2875 2741
2876 Hashtable extensionElements = new Hashtable(); 2742 var extensionElements = new Hashtable();
2877 2743
2878 if (null != extensionTable) 2744 if (null != extensionTable)
2879 { 2745 {
2880 foreach (Row row in extensionTable.Rows) 2746 foreach (var row in extensionTable.Rows)
2881 { 2747 {
2882 Wix.Extension extension = (Wix.Extension)this.core.GetIndexedElement(row); 2748 var extension = (Wix.Extension)this.core.GetIndexedElement(row);
2883 2749
2884 if (!extensionElements.Contains(row[0])) 2750 if (!extensionElements.Contains(row[0]))
2885 { 2751 {
@@ -2892,11 +2758,11 @@ namespace WixToolset.Core.WindowsInstaller
2892 2758
2893 if (null != verbTable) 2759 if (null != verbTable)
2894 { 2760 {
2895 foreach (Row row in verbTable.Rows) 2761 foreach (var row in verbTable.Rows)
2896 { 2762 {
2897 Wix.Verb verb = (Wix.Verb)this.core.GetIndexedElement(row); 2763 var verb = (Wix.Verb)this.core.GetIndexedElement(row);
2898 2764
2899 ArrayList extensionsArray = (ArrayList)extensionElements[row[0]]; 2765 var extensionsArray = (ArrayList)extensionElements[row[0]];
2900 if (null != extensionsArray) 2766 if (null != extensionsArray)
2901 { 2767 {
2902 foreach (Wix.Extension extension in extensionsArray) 2768 foreach (Wix.Extension extension in extensionsArray)
@@ -2906,7 +2772,7 @@ namespace WixToolset.Core.WindowsInstaller
2906 } 2772 }
2907 else 2773 else
2908 { 2774 {
2909 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, verbTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Extension_", Convert.ToString(row[0]), "Extension")); 2775 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, verbTable.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Extension_", Convert.ToString(row[0]), "Extension"));
2910 } 2776 }
2911 } 2777 }
2912 } 2778 }
@@ -2919,11 +2785,11 @@ namespace WixToolset.Core.WindowsInstaller
2919 /// <returns>The path to the file in the source image.</returns> 2785 /// <returns>The path to the file in the source image.</returns>
2920 private string GetSourcePath(Wix.File file) 2786 private string GetSourcePath(Wix.File file)
2921 { 2787 {
2922 StringBuilder sourcePath = new StringBuilder(); 2788 var sourcePath = new StringBuilder();
2923 2789
2924 Wix.Component component = (Wix.Component)file.ParentElement; 2790 var component = (Wix.Component)file.ParentElement;
2925 2791
2926 for (Wix.Directory directory = (Wix.Directory)component.ParentElement; null != directory; directory = directory.ParentElement as Wix.Directory) 2792 for (var directory = (Wix.Directory)component.ParentElement; null != directory; directory = directory.ParentElement as Wix.Directory)
2927 { 2793 {
2928 string name; 2794 string name;
2929 2795
@@ -2968,7 +2834,7 @@ namespace WixToolset.Core.WindowsInstaller
2968 { 2834 {
2969 unsortedTableNames.Remove(tableName); 2835 unsortedTableNames.Remove(tableName);
2970 2836
2971 foreach (ColumnDefinition columnDefinition in this.tableDefinitions[tableName].Columns) 2837 foreach (var columnDefinition in this.tableDefinitions[tableName].Columns)
2972 { 2838 {
2973 // no dependency to resolve because this column doesn't reference another table 2839 // no dependency to resolve because this column doesn't reference another table
2974 if (null == columnDefinition.KeyTable) 2840 if (null == columnDefinition.KeyTable)
@@ -2976,7 +2842,7 @@ namespace WixToolset.Core.WindowsInstaller
2976 continue; 2842 continue;
2977 } 2843 }
2978 2844
2979 foreach (string keyTable in columnDefinition.KeyTable.Split(';')) 2845 foreach (var keyTable in columnDefinition.KeyTable.Split(';'))
2980 { 2846 {
2981 if (tableName == keyTable) 2847 if (tableName == keyTable)
2982 { 2848 {
@@ -2988,7 +2854,7 @@ namespace WixToolset.Core.WindowsInstaller
2988 } 2854 }
2989 else if (!this.tableDefinitions.Contains(keyTable)) 2855 else if (!this.tableDefinitions.Contains(keyTable))
2990 { 2856 {
2991 this.core.OnMessage(WixErrors.MissingTableDefinition(keyTable)); 2857 this.Messaging.Write(ErrorMessages.MissingTableDefinition(keyTable));
2992 } 2858 }
2993 else if (unsortedTableNames.Contains(keyTable)) 2859 else if (unsortedTableNames.Contains(keyTable))
2994 { 2860 {
@@ -3012,11 +2878,11 @@ namespace WixToolset.Core.WindowsInstaller
3012 /// <returns>A StringCollection containing the ordered table names.</returns> 2878 /// <returns>A StringCollection containing the ordered table names.</returns>
3013 private StringCollection GetSortedTableNames() 2879 private StringCollection GetSortedTableNames()
3014 { 2880 {
3015 StringCollection sortedTableNames = new StringCollection(); 2881 var sortedTableNames = new StringCollection();
3016 SortedList unsortedTableNames = new SortedList(); 2882 var unsortedTableNames = new SortedList();
3017 2883
3018 // index the table names 2884 // index the table names
3019 foreach (TableDefinition tableDefinition in this.tableDefinitions) 2885 foreach (var tableDefinition in this.tableDefinitions)
3020 { 2886 {
3021 unsortedTableNames.Add(tableDefinition.Name, tableDefinition.Name); 2887 unsortedTableNames.Add(tableDefinition.Name, tableDefinition.Name);
3022 } 2888 }
@@ -3034,7 +2900,7 @@ namespace WixToolset.Core.WindowsInstaller
3034 /// Initialize decompilation. 2900 /// Initialize decompilation.
3035 /// </summary> 2901 /// </summary>
3036 /// <param name="tables">The collection of all tables.</param> 2902 /// <param name="tables">The collection of all tables.</param>
3037 private void InitializeDecompile(TableIndexedCollection tables) 2903 private void InitializeDecompile(TableIndexedCollection tables, int codepage)
3038 { 2904 {
3039 // reset all the state information 2905 // reset all the state information
3040 this.compressed = false; 2906 this.compressed = false;
@@ -3043,31 +2909,32 @@ namespace WixToolset.Core.WindowsInstaller
3043 this.shortNames = false; 2909 this.shortNames = false;
3044 2910
3045 // set the codepage if its not neutral (0) 2911 // set the codepage if its not neutral (0)
3046 if (0 != this.codepage) 2912 if (0 != codepage)
3047 { 2913 {
3048 switch (this.outputType) 2914 switch (this.OutputType)
3049 { 2915 {
3050 case OutputType.Module: 2916 case OutputType.Module:
3051 ((Wix.Module)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture); 2917 ((Wix.Module)this.core.RootElement).Codepage = codepage.ToString(CultureInfo.InvariantCulture);
3052 break; 2918 break;
3053 case OutputType.PatchCreation: 2919 case OutputType.PatchCreation:
3054 ((Wix.PatchCreation)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture); 2920 ((Wix.PatchCreation)this.core.RootElement).Codepage = codepage.ToString(CultureInfo.InvariantCulture);
3055 break; 2921 break;
3056 case OutputType.Product: 2922 case OutputType.Product:
3057 ((Wix.Product)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture); 2923 ((Wix.Product)this.core.RootElement).Codepage = codepage.ToString(CultureInfo.InvariantCulture);
3058 break; 2924 break;
3059 } 2925 }
3060 } 2926 }
3061 2927
3062 // index the rows from the extension libraries 2928 // index the rows from the extension libraries
3063 Dictionary<string, HashSet<string>> indexedExtensionTables = new Dictionary<string, HashSet<string>>(); 2929 var indexedExtensionTables = new Dictionary<string, HashSet<string>>();
2930#if TODO_DECOMPILER_EXTENSIONS
3064 foreach (IDecompilerExtension extension in this.extensions) 2931 foreach (IDecompilerExtension extension in this.extensions)
3065 { 2932 {
3066 // Get the optional library from the extension with the rows to be removed. 2933 // Get the optional library from the extension with the rows to be removed.
3067 Library library = extension.GetLibraryToRemove(this.tableDefinitions); 2934 Library library = extension.GetLibraryToRemove(this.tableDefinitions);
3068 if (null != library) 2935 if (null != library)
3069 { 2936 {
3070 foreach (Section section in library.Sections) 2937 foreach (var section in library.Sections)
3071 { 2938 {
3072 foreach (Table table in section.Tables) 2939 foreach (Table table in section.Tables)
3073 { 2940 {
@@ -3112,22 +2979,23 @@ namespace WixToolset.Core.WindowsInstaller
3112 } 2979 }
3113 } 2980 }
3114 } 2981 }
2982#endif
3115 2983
3116 // remove the rows from the extension libraries (to allow full round-tripping) 2984 // remove the rows from the extension libraries (to allow full round-tripping)
3117 foreach (var kvp in indexedExtensionTables) 2985 foreach (var kvp in indexedExtensionTables)
3118 { 2986 {
3119 string tableName = kvp.Key; 2987 var tableName = kvp.Key;
3120 HashSet<string> indexedExtensionRows = kvp.Value; 2988 var indexedExtensionRows = kvp.Value;
3121 2989
3122 Table table = tables[tableName]; 2990 var table = tables[tableName];
3123 if (null != table) 2991 if (null != table)
3124 { 2992 {
3125 RowDictionary<Row> originalRows = new RowDictionary<Row>(table); 2993 var originalRows = new RowDictionary<Row>(table);
3126 2994
3127 // remove the original rows so that they can be added back if they should remain 2995 // remove the original rows so that they can be added back if they should remain
3128 table.Rows.Clear(); 2996 table.Rows.Clear();
3129 2997
3130 foreach (Row row in originalRows.Values) 2998 foreach (var row in originalRows.Values)
3131 { 2999 {
3132 if (!indexedExtensionRows.Contains(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter))) 3000 if (!indexedExtensionRows.Contains(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)))
3133 { 3001 {
@@ -3144,11 +3012,11 @@ namespace WixToolset.Core.WindowsInstaller
3144 /// <param name="output">The output being decompiled.</param> 3012 /// <param name="output">The output being decompiled.</param>
3145 private void DecompileTables(Output output) 3013 private void DecompileTables(Output output)
3146 { 3014 {
3147 StringCollection sortedTableNames = this.GetSortedTableNames(); 3015 var sortedTableNames = this.GetSortedTableNames();
3148 3016
3149 foreach (string tableName in sortedTableNames) 3017 foreach (var tableName in sortedTableNames)
3150 { 3018 {
3151 Table table = output.Tables[tableName]; 3019 var table = output.Tables[tableName];
3152 3020
3153 // table does not exist in this database or should not be decompiled 3021 // table does not exist in this database or should not be decompiled
3154 if (null == table || !this.DecompilableTable(output, tableName)) 3022 if (null == table || !this.DecompilableTable(output, tableName))
@@ -3156,438 +3024,440 @@ namespace WixToolset.Core.WindowsInstaller
3156 continue; 3024 continue;
3157 } 3025 }
3158 3026
3159 this.core.OnMessage(WixVerboses.DecompilingTable(table.Name)); 3027 this.Messaging.Write(VerboseMessages.DecompilingTable(table.Name));
3160 3028
3161 // empty tables may be kept with EnsureTable if the user set the proper option 3029 // empty tables may be kept with EnsureTable if the user set the proper option
3162 if (0 == table.Rows.Count && this.suppressDroppingEmptyTables) 3030 if (0 == table.Rows.Count && this.SuppressDroppingEmptyTables)
3163 { 3031 {
3164 Wix.EnsureTable ensureTable = new Wix.EnsureTable(); 3032 var ensureTable = new Wix.EnsureTable();
3165 ensureTable.Id = table.Name; 3033 ensureTable.Id = table.Name;
3166 this.core.RootElement.AddChild(ensureTable); 3034 this.core.RootElement.AddChild(ensureTable);
3167 } 3035 }
3168 3036
3169 switch (table.Name) 3037 switch (table.Name)
3170 { 3038 {
3171 case "_SummaryInformation": 3039 case "_SummaryInformation":
3172 this.Decompile_SummaryInformationTable(table); 3040 this.Decompile_SummaryInformationTable(table);
3173 break; 3041 break;
3174 case "AdminExecuteSequence": 3042 case "AdminExecuteSequence":
3175 case "AdminUISequence": 3043 case "AdminUISequence":
3176 case "AdvtExecuteSequence": 3044 case "AdvtExecuteSequence":
3177 case "InstallExecuteSequence": 3045 case "InstallExecuteSequence":
3178 case "InstallUISequence": 3046 case "InstallUISequence":
3179 case "ModuleAdminExecuteSequence": 3047 case "ModuleAdminExecuteSequence":
3180 case "ModuleAdminUISequence": 3048 case "ModuleAdminUISequence":
3181 case "ModuleAdvtExecuteSequence": 3049 case "ModuleAdvtExecuteSequence":
3182 case "ModuleInstallExecuteSequence": 3050 case "ModuleInstallExecuteSequence":
3183 case "ModuleInstallUISequence": 3051 case "ModuleInstallUISequence":
3184 // handled in FinalizeSequenceTables 3052 // handled in FinalizeSequenceTables
3185 break; 3053 break;
3186 case "ActionText":
3187 this.DecompileActionTextTable(table);
3188 break;
3189 case "AdvtUISequence":
3190 this.core.OnMessage(WixWarnings.DeprecatedTable(table.Name));
3191 break;
3192 case "AppId":
3193 this.DecompileAppIdTable(table);
3194 break;
3195 case "AppSearch":
3196 // handled in FinalizeSearchTables
3197 break;
3198 case "BBControl":
3199 this.DecompileBBControlTable(table);
3200 break;
3201 case "Billboard":
3202 this.DecompileBillboardTable(table);
3203 break;
3204 case "Binary":
3205 this.DecompileBinaryTable(table);
3206 break;
3207 case "BindImage":
3208 this.DecompileBindImageTable(table);
3209 break;
3210 case "CCPSearch":
3211 // handled in FinalizeSearchTables
3212 break;
3213 case "CheckBox":
3214 // handled in FinalizeCheckBoxTable
3215 break;
3216 case "Class":
3217 this.DecompileClassTable(table);
3218 break;
3219 case "ComboBox":
3220 this.DecompileComboBoxTable(table);
3221 break;
3222 case "Control":
3223 this.DecompileControlTable(table);
3224 break;
3225 case "ControlCondition":
3226 this.DecompileControlConditionTable(table);
3227 break;
3228 case "ControlEvent":
3229 this.DecompileControlEventTable(table);
3230 break;
3231 case "CreateFolder":
3232 this.DecompileCreateFolderTable(table);
3233 break;
3234 case "CustomAction":
3235 this.DecompileCustomActionTable(table);
3236 break;
3237 case "CompLocator":
3238 this.DecompileCompLocatorTable(table);
3239 break;
3240 case "Complus":
3241 this.DecompileComplusTable(table);
3242 break;
3243 case "Component":
3244 this.DecompileComponentTable(table);
3245 break;
3246 case "Condition":
3247 this.DecompileConditionTable(table);
3248 break;
3249 case "Dialog":
3250 this.DecompileDialogTable(table);
3251 break;
3252 case "Directory":
3253 this.DecompileDirectoryTable(table);
3254 break;
3255 case "DrLocator":
3256 this.DecompileDrLocatorTable(table);
3257 break;
3258 case "DuplicateFile":
3259 this.DecompileDuplicateFileTable(table);
3260 break;
3261 case "Environment":
3262 this.DecompileEnvironmentTable(table);
3263 break;
3264 case "Error":
3265 this.DecompileErrorTable(table);
3266 break;
3267 case "EventMapping":
3268 this.DecompileEventMappingTable(table);
3269 break;
3270 case "Extension":
3271 this.DecompileExtensionTable(table);
3272 break;
3273 case "ExternalFiles":
3274 this.DecompileExternalFilesTable(table);
3275 break;
3276 case "FamilyFileRanges":
3277 // handled in FinalizeFamilyFileRangesTable
3278 break;
3279 case "Feature":
3280 this.DecompileFeatureTable(table);
3281 break;
3282 case "FeatureComponents":
3283 this.DecompileFeatureComponentsTable(table);
3284 break;
3285 case "File":
3286 this.DecompileFileTable(table);
3287 break;
3288 case "FileSFPCatalog":
3289 this.DecompileFileSFPCatalogTable(table);
3290 break;
3291 case "Font":
3292 this.DecompileFontTable(table);
3293 break;
3294 case "Icon":
3295 this.DecompileIconTable(table);
3296 break;
3297 case "ImageFamilies":
3298 this.DecompileImageFamiliesTable(table);
3299 break;
3300 case "IniFile":
3301 this.DecompileIniFileTable(table);
3302 break;
3303 case "IniLocator":
3304 this.DecompileIniLocatorTable(table);
3305 break;
3306 case "IsolatedComponent":
3307 this.DecompileIsolatedComponentTable(table);
3308 break;
3309 case "LaunchCondition":
3310 this.DecompileLaunchConditionTable(table);
3311 break;
3312 case "ListBox":
3313 this.DecompileListBoxTable(table);
3314 break;
3315 case "ListView":
3316 this.DecompileListViewTable(table);
3317 break;
3318 case "LockPermissions":
3319 this.DecompileLockPermissionsTable(table);
3320 break;
3321 case "Media":
3322 this.DecompileMediaTable(table);
3323 break;
3324 case "MIME":
3325 this.DecompileMIMETable(table);
3326 break;
3327 case "ModuleAdvtUISequence":
3328 this.core.OnMessage(WixWarnings.DeprecatedTable(table.Name));
3329 break;
3330 case "ModuleComponents":
3331 // handled by DecompileComponentTable (since the ModuleComponents table
3332 // rows are created by nesting components under the Module element)
3333 break;
3334 case "ModuleConfiguration":
3335 this.DecompileModuleConfigurationTable(table);
3336 break;
3337 case "ModuleDependency":
3338 this.DecompileModuleDependencyTable(table);
3339 break;
3340 case "ModuleExclusion":
3341 this.DecompileModuleExclusionTable(table);
3342 break;
3343 case "ModuleIgnoreTable":
3344 this.DecompileModuleIgnoreTableTable(table);
3345 break;
3346 case "ModuleSignature":
3347 this.DecompileModuleSignatureTable(table);
3348 break;
3349 case "ModuleSubstitution":
3350 this.DecompileModuleSubstitutionTable(table);
3351 break;
3352 case "MoveFile":
3353 this.DecompileMoveFileTable(table);
3354 break;
3355 case "MsiAssembly":
3356 // handled in FinalizeFileTable
3357 break;
3358 case "MsiDigitalCertificate":
3359 this.DecompileMsiDigitalCertificateTable(table);
3360 break;
3361 case "MsiDigitalSignature":
3362 this.DecompileMsiDigitalSignatureTable(table);
3363 break;
3364 case "MsiEmbeddedChainer":
3365 this.DecompileMsiEmbeddedChainerTable(table);
3366 break;
3367 case "MsiEmbeddedUI":
3368 this.DecompileMsiEmbeddedUITable(table);
3369 break;
3370 case "MsiLockPermissionsEx":
3371 this.DecompileMsiLockPermissionsExTable(table);
3372 break;
3373 case "MsiPackageCertificate":
3374 this.DecompileMsiPackageCertificateTable(table);
3375 break;
3376 case "MsiPatchCertificate":
3377 this.DecompileMsiPatchCertificateTable(table);
3378 break;
3379 case "MsiShortcutProperty":
3380 this.DecompileMsiShortcutPropertyTable(table);
3381 break;
3382 case "ODBCAttribute":
3383 this.DecompileODBCAttributeTable(table);
3384 break;
3385 case "ODBCDataSource":
3386 this.DecompileODBCDataSourceTable(table);
3387 break;
3388 case "ODBCDriver":
3389 this.DecompileODBCDriverTable(table);
3390 break;
3391 case "ODBCSourceAttribute":
3392 this.DecompileODBCSourceAttributeTable(table);
3393 break;
3394 case "ODBCTranslator":
3395 this.DecompileODBCTranslatorTable(table);
3396 break;
3397 case "PatchMetadata":
3398 this.DecompilePatchMetadataTable(table);
3399 break;
3400 case "PatchSequence":
3401 this.DecompilePatchSequenceTable(table);
3402 break;
3403 case "ProgId":
3404 this.DecompileProgIdTable(table);
3405 break;
3406 case "Properties":
3407 this.DecompilePropertiesTable(table);
3408 break;
3409 case "Property":
3410 this.DecompilePropertyTable(table);
3411 break;
3412 case "PublishComponent":
3413 this.DecompilePublishComponentTable(table);
3414 break;
3415 case "RadioButton":
3416 this.DecompileRadioButtonTable(table);
3417 break;
3418 case "Registry":
3419 this.DecompileRegistryTable(table);
3420 break;
3421 case "RegLocator":
3422 this.DecompileRegLocatorTable(table);
3423 break;
3424 case "RemoveFile":
3425 this.DecompileRemoveFileTable(table);
3426 break;
3427 case "RemoveIniFile":
3428 this.DecompileRemoveIniFileTable(table);
3429 break;
3430 case "RemoveRegistry":
3431 this.DecompileRemoveRegistryTable(table);
3432 break;
3433 case "ReserveCost":
3434 this.DecompileReserveCostTable(table);
3435 break;
3436 case "SelfReg":
3437 this.DecompileSelfRegTable(table);
3438 break;
3439 case "ServiceControl":
3440 this.DecompileServiceControlTable(table);
3441 break;
3442 case "ServiceInstall":
3443 this.DecompileServiceInstallTable(table);
3444 break;
3445 case "SFPCatalog":
3446 this.DecompileSFPCatalogTable(table);
3447 break;
3448 case "Shortcut":
3449 this.DecompileShortcutTable(table);
3450 break;
3451 case "Signature":
3452 this.DecompileSignatureTable(table);
3453 break;
3454 case "TargetFiles_OptionalData":
3455 this.DecompileTargetFiles_OptionalDataTable(table);
3456 break;
3457 case "TargetImages":
3458 this.DecompileTargetImagesTable(table);
3459 break;
3460 case "TextStyle":
3461 this.DecompileTextStyleTable(table);
3462 break;
3463 case "TypeLib":
3464 this.DecompileTypeLibTable(table);
3465 break;
3466 case "Upgrade":
3467 this.DecompileUpgradeTable(table);
3468 break;
3469 case "UpgradedFiles_OptionalData":
3470 this.DecompileUpgradedFiles_OptionalDataTable(table);
3471 break;
3472 case "UpgradedFilesToIgnore":
3473 this.DecompileUpgradedFilesToIgnoreTable(table);
3474 break;
3475 case "UpgradedImages":
3476 this.DecompileUpgradedImagesTable(table);
3477 break;
3478 case "UIText":
3479 this.DecompileUITextTable(table);
3480 break;
3481 case "Verb":
3482 this.DecompileVerbTable(table);
3483 break;
3484 default:
3485 DecompilerExtension extension = (DecompilerExtension)this.extensionsByTableName[table.Name];
3486
3487 if (null != extension)
3488 {
3489 extension.DecompileTable(table);
3490 }
3491 else if (!this.suppressCustomTables)
3492 {
3493 this.DecompileCustomTable(table);
3494 }
3495 break;
3496 }
3497 }
3498 }
3499
3500 /// <summary>
3501 /// Determine if a particular table should be decompiled with the current settings.
3502 /// </summary>
3503 /// <param name="output">The output being decompiled.</param>
3504 /// <param name="tableName">The name of a table.</param>
3505 /// <returns>true if the table should be decompiled; false otherwise.</returns>
3506 private bool DecompilableTable(Output output, string tableName)
3507 {
3508 switch (tableName)
3509 {
3510 case "ActionText": 3054 case "ActionText":
3055 this.DecompileActionTextTable(table);
3056 break;
3057 case "AdvtUISequence":
3058 this.Messaging.Write(WarningMessages.DeprecatedTable(table.Name));
3059 break;
3060 case "AppId":
3061 this.DecompileAppIdTable(table);
3062 break;
3063 case "AppSearch":
3064 // handled in FinalizeSearchTables
3065 break;
3511 case "BBControl": 3066 case "BBControl":
3067 this.DecompileBBControlTable(table);
3068 break;
3512 case "Billboard": 3069 case "Billboard":
3070 this.DecompileBillboardTable(table);
3071 break;
3072 case "Binary":
3073 this.DecompileBinaryTable(table);
3074 break;
3075 case "BindImage":
3076 this.DecompileBindImageTable(table);
3077 break;
3078 case "CCPSearch":
3079 // handled in FinalizeSearchTables
3080 break;
3513 case "CheckBox": 3081 case "CheckBox":
3082 // handled in FinalizeCheckBoxTable
3083 break;
3084 case "Class":
3085 this.DecompileClassTable(table);
3086 break;
3087 case "ComboBox":
3088 this.DecompileComboBoxTable(table);
3089 break;
3514 case "Control": 3090 case "Control":
3091 this.DecompileControlTable(table);
3092 break;
3515 case "ControlCondition": 3093 case "ControlCondition":
3094 this.DecompileControlConditionTable(table);
3095 break;
3516 case "ControlEvent": 3096 case "ControlEvent":
3097 this.DecompileControlEventTable(table);
3098 break;
3099 case "CreateFolder":
3100 this.DecompileCreateFolderTable(table);
3101 break;
3102 case "CustomAction":
3103 this.DecompileCustomActionTable(table);
3104 break;
3105 case "CompLocator":
3106 this.DecompileCompLocatorTable(table);
3107 break;
3108 case "Complus":
3109 this.DecompileComplusTable(table);
3110 break;
3111 case "Component":
3112 this.DecompileComponentTable(table);
3113 break;
3114 case "Condition":
3115 this.DecompileConditionTable(table);
3116 break;
3517 case "Dialog": 3117 case "Dialog":
3118 this.DecompileDialogTable(table);
3119 break;
3120 case "Directory":
3121 this.DecompileDirectoryTable(table);
3122 break;
3123 case "DrLocator":
3124 this.DecompileDrLocatorTable(table);
3125 break;
3126 case "DuplicateFile":
3127 this.DecompileDuplicateFileTable(table);
3128 break;
3129 case "Environment":
3130 this.DecompileEnvironmentTable(table);
3131 break;
3518 case "Error": 3132 case "Error":
3133 this.DecompileErrorTable(table);
3134 break;
3519 case "EventMapping": 3135 case "EventMapping":
3520 case "RadioButton": 3136 this.DecompileEventMappingTable(table);
3521 case "TextStyle": 3137 break;
3522 case "UIText": 3138 case "Extension":
3523 return !this.suppressUI; 3139 this.DecompileExtensionTable(table);
3524 case "ModuleAdminExecuteSequence": 3140 break;
3525 case "ModuleAdminUISequence": 3141 case "ExternalFiles":
3526 case "ModuleAdvtExecuteSequence": 3142 this.DecompileExternalFilesTable(table);
3143 break;
3144 case "FamilyFileRanges":
3145 // handled in FinalizeFamilyFileRangesTable
3146 break;
3147 case "Feature":
3148 this.DecompileFeatureTable(table);
3149 break;
3150 case "FeatureComponents":
3151 this.DecompileFeatureComponentsTable(table);
3152 break;
3153 case "File":
3154 this.DecompileFileTable(table);
3155 break;
3156 case "FileSFPCatalog":
3157 this.DecompileFileSFPCatalogTable(table);
3158 break;
3159 case "Font":
3160 this.DecompileFontTable(table);
3161 break;
3162 case "Icon":
3163 this.DecompileIconTable(table);
3164 break;
3165 case "ImageFamilies":
3166 this.DecompileImageFamiliesTable(table);
3167 break;
3168 case "IniFile":
3169 this.DecompileIniFileTable(table);
3170 break;
3171 case "IniLocator":
3172 this.DecompileIniLocatorTable(table);
3173 break;
3174 case "IsolatedComponent":
3175 this.DecompileIsolatedComponentTable(table);
3176 break;
3177 case "LaunchCondition":
3178 this.DecompileLaunchConditionTable(table);
3179 break;
3180 case "ListBox":
3181 this.DecompileListBoxTable(table);
3182 break;
3183 case "ListView":
3184 this.DecompileListViewTable(table);
3185 break;
3186 case "LockPermissions":
3187 this.DecompileLockPermissionsTable(table);
3188 break;
3189 case "Media":
3190 this.DecompileMediaTable(table);
3191 break;
3192 case "MIME":
3193 this.DecompileMIMETable(table);
3194 break;
3527 case "ModuleAdvtUISequence": 3195 case "ModuleAdvtUISequence":
3196 this.Messaging.Write(WarningMessages.DeprecatedTable(table.Name));
3197 break;
3528 case "ModuleComponents": 3198 case "ModuleComponents":
3199 // handled by DecompileComponentTable (since the ModuleComponents table
3200 // rows are created by nesting components under the Module element)
3201 break;
3529 case "ModuleConfiguration": 3202 case "ModuleConfiguration":
3203 this.DecompileModuleConfigurationTable(table);
3204 break;
3530 case "ModuleDependency": 3205 case "ModuleDependency":
3531 case "ModuleIgnoreTable": 3206 this.DecompileModuleDependencyTable(table);
3532 case "ModuleInstallExecuteSequence": 3207 break;
3533 case "ModuleInstallUISequence":
3534 case "ModuleExclusion": 3208 case "ModuleExclusion":
3209 this.DecompileModuleExclusionTable(table);
3210 break;
3211 case "ModuleIgnoreTable":
3212 this.DecompileModuleIgnoreTableTable(table);
3213 break;
3535 case "ModuleSignature": 3214 case "ModuleSignature":
3215 this.DecompileModuleSignatureTable(table);
3216 break;
3536 case "ModuleSubstitution": 3217 case "ModuleSubstitution":
3537 if (OutputType.Module != output.Type) 3218 this.DecompileModuleSubstitutionTable(table);
3538 { 3219 break;
3539 this.core.OnMessage(WixWarnings.SkippingMergeModuleTable(output.SourceLineNumbers, tableName)); 3220 case "MoveFile":
3540 return false; 3221 this.DecompileMoveFileTable(table);
3541 } 3222 break;
3542 else 3223 case "MsiAssembly":
3543 { 3224 // handled in FinalizeFileTable
3544 return true; 3225 break;
3545 } 3226 case "MsiDigitalCertificate":
3546 case "ExternalFiles": 3227 this.DecompileMsiDigitalCertificateTable(table);
3547 case "FamilyFileRanges": 3228 break;
3548 case "ImageFamilies": 3229 case "MsiDigitalSignature":
3230 this.DecompileMsiDigitalSignatureTable(table);
3231 break;
3232 case "MsiEmbeddedChainer":
3233 this.DecompileMsiEmbeddedChainerTable(table);
3234 break;
3235 case "MsiEmbeddedUI":
3236 this.DecompileMsiEmbeddedUITable(table);
3237 break;
3238 case "MsiLockPermissionsEx":
3239 this.DecompileMsiLockPermissionsExTable(table);
3240 break;
3241 case "MsiPackageCertificate":
3242 this.DecompileMsiPackageCertificateTable(table);
3243 break;
3244 case "MsiPatchCertificate":
3245 this.DecompileMsiPatchCertificateTable(table);
3246 break;
3247 case "MsiShortcutProperty":
3248 this.DecompileMsiShortcutPropertyTable(table);
3249 break;
3250 case "ODBCAttribute":
3251 this.DecompileODBCAttributeTable(table);
3252 break;
3253 case "ODBCDataSource":
3254 this.DecompileODBCDataSourceTable(table);
3255 break;
3256 case "ODBCDriver":
3257 this.DecompileODBCDriverTable(table);
3258 break;
3259 case "ODBCSourceAttribute":
3260 this.DecompileODBCSourceAttributeTable(table);
3261 break;
3262 case "ODBCTranslator":
3263 this.DecompileODBCTranslatorTable(table);
3264 break;
3549 case "PatchMetadata": 3265 case "PatchMetadata":
3266 this.DecompilePatchMetadataTable(table);
3267 break;
3550 case "PatchSequence": 3268 case "PatchSequence":
3269 this.DecompilePatchSequenceTable(table);
3270 break;
3271 case "ProgId":
3272 this.DecompileProgIdTable(table);
3273 break;
3551 case "Properties": 3274 case "Properties":
3275 this.DecompilePropertiesTable(table);
3276 break;
3277 case "Property":
3278 this.DecompilePropertyTable(table);
3279 break;
3280 case "PublishComponent":
3281 this.DecompilePublishComponentTable(table);
3282 break;
3283 case "RadioButton":
3284 this.DecompileRadioButtonTable(table);
3285 break;
3286 case "Registry":
3287 this.DecompileRegistryTable(table);
3288 break;
3289 case "RegLocator":
3290 this.DecompileRegLocatorTable(table);
3291 break;
3292 case "RemoveFile":
3293 this.DecompileRemoveFileTable(table);
3294 break;
3295 case "RemoveIniFile":
3296 this.DecompileRemoveIniFileTable(table);
3297 break;
3298 case "RemoveRegistry":
3299 this.DecompileRemoveRegistryTable(table);
3300 break;
3301 case "ReserveCost":
3302 this.DecompileReserveCostTable(table);
3303 break;
3304 case "SelfReg":
3305 this.DecompileSelfRegTable(table);
3306 break;
3307 case "ServiceControl":
3308 this.DecompileServiceControlTable(table);
3309 break;
3310 case "ServiceInstall":
3311 this.DecompileServiceInstallTable(table);
3312 break;
3313 case "SFPCatalog":
3314 this.DecompileSFPCatalogTable(table);
3315 break;
3316 case "Shortcut":
3317 this.DecompileShortcutTable(table);
3318 break;
3319 case "Signature":
3320 this.DecompileSignatureTable(table);
3321 break;
3552 case "TargetFiles_OptionalData": 3322 case "TargetFiles_OptionalData":
3323 this.DecompileTargetFiles_OptionalDataTable(table);
3324 break;
3553 case "TargetImages": 3325 case "TargetImages":
3326 this.DecompileTargetImagesTable(table);
3327 break;
3328 case "TextStyle":
3329 this.DecompileTextStyleTable(table);
3330 break;
3331 case "TypeLib":
3332 this.DecompileTypeLibTable(table);
3333 break;
3334 case "Upgrade":
3335 this.DecompileUpgradeTable(table);
3336 break;
3554 case "UpgradedFiles_OptionalData": 3337 case "UpgradedFiles_OptionalData":
3338 this.DecompileUpgradedFiles_OptionalDataTable(table);
3339 break;
3555 case "UpgradedFilesToIgnore": 3340 case "UpgradedFilesToIgnore":
3341 this.DecompileUpgradedFilesToIgnoreTable(table);
3342 break;
3556 case "UpgradedImages": 3343 case "UpgradedImages":
3557 if (OutputType.PatchCreation != output.Type) 3344 this.DecompileUpgradedImagesTable(table);
3345 break;
3346 case "UIText":
3347 this.DecompileUITextTable(table);
3348 break;
3349 case "Verb":
3350 this.DecompileVerbTable(table);
3351 break;
3352
3353 default:
3354#if TODO_DECOMPILER_EXTENSIONS
3355 if (this.ExtensionsByTableName.TryGetValue(table.Name, out var extension)
3558 { 3356 {
3559 this.core.OnMessage(WixWarnings.SkippingPatchCreationTable(output.SourceLineNumbers, tableName)); 3357 extension.DecompileTable(table);
3560 return false;
3561 } 3358 }
3562 else 3359 else
3360#endif
3361 if (!this.SuppressCustomTables)
3563 { 3362 {
3564 return true; 3363 this.DecompileCustomTable(table);
3565 } 3364 }
3566 case "MsiPatchHeaders": 3365 break;
3567 case "MsiPatchMetadata": 3366 }
3568 case "MsiPatchOldAssemblyName": 3367 }
3569 case "MsiPatchOldAssemblyFile": 3368 }
3570 case "MsiPatchSequence": 3369
3571 case "Patch": 3370 /// <summary>
3572 case "PatchPackage": 3371 /// Determine if a particular table should be decompiled with the current settings.
3573 this.core.OnMessage(WixWarnings.PatchTable(output.SourceLineNumbers, tableName)); 3372 /// </summary>
3373 /// <param name="output">The output being decompiled.</param>
3374 /// <param name="tableName">The name of a table.</param>
3375 /// <returns>true if the table should be decompiled; false otherwise.</returns>
3376 private bool DecompilableTable(Output output, string tableName)
3377 {
3378 switch (tableName)
3379 {
3380 case "ActionText":
3381 case "BBControl":
3382 case "Billboard":
3383 case "CheckBox":
3384 case "Control":
3385 case "ControlCondition":
3386 case "ControlEvent":
3387 case "Dialog":
3388 case "Error":
3389 case "EventMapping":
3390 case "RadioButton":
3391 case "TextStyle":
3392 case "UIText":
3393 return !this.SuppressUI;
3394 case "ModuleAdminExecuteSequence":
3395 case "ModuleAdminUISequence":
3396 case "ModuleAdvtExecuteSequence":
3397 case "ModuleAdvtUISequence":
3398 case "ModuleComponents":
3399 case "ModuleConfiguration":
3400 case "ModuleDependency":
3401 case "ModuleIgnoreTable":
3402 case "ModuleInstallExecuteSequence":
3403 case "ModuleInstallUISequence":
3404 case "ModuleExclusion":
3405 case "ModuleSignature":
3406 case "ModuleSubstitution":
3407 if (OutputType.Module != output.Type)
3408 {
3409 this.Messaging.Write(WarningMessages.SkippingMergeModuleTable(output.SourceLineNumbers, tableName));
3574 return false; 3410 return false;
3575 case "_SummaryInformation": 3411 }
3412 else
3413 {
3576 return true; 3414 return true;
3577 case "_Validation": 3415 }
3578 case "MsiAssemblyName": 3416 case "ExternalFiles":
3579 case "MsiFileHash": 3417 case "FamilyFileRanges":
3418 case "ImageFamilies":
3419 case "PatchMetadata":
3420 case "PatchSequence":
3421 case "Properties":
3422 case "TargetFiles_OptionalData":
3423 case "TargetImages":
3424 case "UpgradedFiles_OptionalData":
3425 case "UpgradedFilesToIgnore":
3426 case "UpgradedImages":
3427 if (OutputType.PatchCreation != output.Type)
3428 {
3429 this.Messaging.Write(WarningMessages.SkippingPatchCreationTable(output.SourceLineNumbers, tableName));
3580 return false; 3430 return false;
3581 default: // all other tables are allowed in any output except for a patch creation package 3431 }
3582 if (OutputType.PatchCreation == output.Type) 3432 else
3583 { 3433 {
3584 this.core.OnMessage(WixWarnings.IllegalPatchCreationTable(output.SourceLineNumbers, tableName)); 3434 return true;
3585 return false; 3435 }
3586 } 3436 case "MsiPatchHeaders":
3587 else 3437 case "MsiPatchMetadata":
3588 { 3438 case "MsiPatchOldAssemblyName":
3589 return true; 3439 case "MsiPatchOldAssemblyFile":
3590 } 3440 case "MsiPatchSequence":
3441 case "Patch":
3442 case "PatchPackage":
3443 this.Messaging.Write(WarningMessages.PatchTable(output.SourceLineNumbers, tableName));
3444 return false;
3445 case "_SummaryInformation":
3446 return true;
3447 case "_Validation":
3448 case "MsiAssemblyName":
3449 case "MsiFileHash":
3450 return false;
3451 default: // all other tables are allowed in any output except for a patch creation package
3452 if (OutputType.PatchCreation == output.Type)
3453 {
3454 this.Messaging.Write(WarningMessages.IllegalPatchCreationTable(output.SourceLineNumbers, tableName));
3455 return false;
3456 }
3457 else
3458 {
3459 return true;
3460 }
3591 } 3461 }
3592 } 3462 }
3593 3463
@@ -3597,113 +3467,116 @@ namespace WixToolset.Core.WindowsInstaller
3597 /// <param name="table">The table to decompile.</param> 3467 /// <param name="table">The table to decompile.</param>
3598 private void Decompile_SummaryInformationTable(Table table) 3468 private void Decompile_SummaryInformationTable(Table table)
3599 { 3469 {
3600 if (OutputType.Module == this.outputType || OutputType.Product == this.outputType) 3470 if (OutputType.Module == this.OutputType || OutputType.Product == this.OutputType)
3601 { 3471 {
3602 Wix.Package package = new Wix.Package(); 3472 var package = new Wix.Package();
3603 3473
3604 foreach (Row row in table.Rows) 3474 foreach (var row in table.Rows)
3605 { 3475 {
3606 string value = Convert.ToString(row[1]); 3476 var value = Convert.ToString(row[1]);
3607 3477
3608 if (null != value && 0 < value.Length) 3478 if (null != value && 0 < value.Length)
3609 { 3479 {
3610 switch (Convert.ToInt32(row[0])) 3480 switch (Convert.ToInt32(row[0]))
3611 { 3481 {
3612 case 1: 3482 case 1:
3613 if ("1252" != value) 3483 if ("1252" != value)
3614 { 3484 {
3615 package.SummaryCodepage = value; 3485 package.SummaryCodepage = value;
3616 } 3486 }
3617 break; 3487 break;
3618 case 3: 3488 case 3:
3619 package.Description = value; 3489 package.Description = value;
3620 break; 3490 break;
3621 case 4: 3491 case 4:
3622 package.Manufacturer = value; 3492 package.Manufacturer = value;
3623 break; 3493 break;
3624 case 5: 3494 case 5:
3625 if ("Installer" != value) 3495 if ("Installer" != value)
3626 { 3496 {
3627 package.Keywords = value; 3497 package.Keywords = value;
3628 } 3498 }
3629 break; 3499 break;
3630 case 6: 3500 case 6:
3501 if (!value.StartsWith("This installer database contains the logic and data required to install "))
3502 {
3631 package.Comments = value; 3503 package.Comments = value;
3632 break; 3504 }
3633 case 7: 3505 break;
3634 string[] template = value.Split(';'); 3506 case 7:
3635 if (0 < template.Length && 0 < template[template.Length - 1].Length) 3507 var template = value.Split(';');
3636 { 3508 if (0 < template.Length && 0 < template[template.Length - 1].Length)
3637 package.Languages = template[template.Length - 1]; 3509 {
3638 } 3510 package.Languages = template[template.Length - 1];
3511 }
3639 3512
3640 if (1 < template.Length && null != template[0] && 0 < template[0].Length) 3513 if (1 < template.Length && null != template[0] && 0 < template[0].Length)
3641 { 3514 {
3642 switch (template[0]) 3515 switch (template[0])
3643 {
3644 case "Intel":
3645 package.Platform = WixToolset.Data.Serialize.Package.PlatformType.x86;
3646 break;
3647 case "Intel64":
3648 package.Platform = WixToolset.Data.Serialize.Package.PlatformType.ia64;
3649 break;
3650 case "x64":
3651 package.Platform = WixToolset.Data.Serialize.Package.PlatformType.x64;
3652 break;
3653 }
3654 }
3655 break;
3656 case 9:
3657 if (OutputType.Module == this.outputType)
3658 {
3659 this.modularizationGuid = value;
3660 package.Id = value;
3661 }
3662 break;
3663 case 14:
3664 package.InstallerVersion = Convert.ToInt32(row[1], CultureInfo.InvariantCulture);
3665 break;
3666 case 15:
3667 int wordCount = Convert.ToInt32(row[1], CultureInfo.InvariantCulture);
3668 if (0x1 == (wordCount & 0x1))
3669 { 3516 {
3670 this.shortNames = true; 3517 case "Intel":
3671 package.ShortNames = Wix.YesNoType.yes; 3518 package.Platform = WixToolset.Data.Serialize.Package.PlatformType.x86;
3519 break;
3520 case "Intel64":
3521 package.Platform = WixToolset.Data.Serialize.Package.PlatformType.ia64;
3522 break;
3523 case "x64":
3524 package.Platform = WixToolset.Data.Serialize.Package.PlatformType.x64;
3525 break;
3672 } 3526 }
3527 }
3528 break;
3529 case 9:
3530 if (OutputType.Module == this.OutputType)
3531 {
3532 this.modularizationGuid = value;
3533 package.Id = value;
3534 }
3535 break;
3536 case 14:
3537 package.InstallerVersion = Convert.ToInt32(row[1], CultureInfo.InvariantCulture);
3538 break;
3539 case 15:
3540 var wordCount = Convert.ToInt32(row[1], CultureInfo.InvariantCulture);
3541 if (0x1 == (wordCount & 0x1))
3542 {
3543 this.shortNames = true;
3544 package.ShortNames = Wix.YesNoType.yes;
3545 }
3673 3546
3674 if (0x2 == (wordCount & 0x2)) 3547 if (0x2 == (wordCount & 0x2))
3675 { 3548 {
3676 this.compressed = true; 3549 this.compressed = true;
3677
3678 if (OutputType.Product == this.outputType)
3679 {
3680 package.Compressed = Wix.YesNoType.yes;
3681 }
3682 }
3683 3550
3684 if (0x4 == (wordCount & 0x4)) 3551 if (OutputType.Product == this.OutputType)
3685 { 3552 {
3686 package.AdminImage = Wix.YesNoType.yes; 3553 package.Compressed = Wix.YesNoType.yes;
3687 } 3554 }
3555 }
3688 3556
3689 if (0x8 == (wordCount & 0x8)) 3557 if (0x4 == (wordCount & 0x4))
3690 { 3558 {
3691 package.InstallPrivileges = Wix.Package.InstallPrivilegesType.limited; 3559 package.AdminImage = Wix.YesNoType.yes;
3692 } 3560 }
3561
3562 if (0x8 == (wordCount & 0x8))
3563 {
3564 package.InstallPrivileges = Wix.Package.InstallPrivilegesType.limited;
3565 }
3693 3566
3567 break;
3568 case 19:
3569 var security = Convert.ToInt32(row[1], CultureInfo.InvariantCulture);
3570 switch (security)
3571 {
3572 case 0:
3573 package.ReadOnly = Wix.YesNoDefaultType.no;
3694 break; 3574 break;
3695 case 19: 3575 case 4:
3696 int security = Convert.ToInt32(row[1], CultureInfo.InvariantCulture); 3576 package.ReadOnly = Wix.YesNoDefaultType.yes;
3697 switch (security)
3698 {
3699 case 0:
3700 package.ReadOnly = Wix.YesNoDefaultType.no;
3701 break;
3702 case 4:
3703 package.ReadOnly = Wix.YesNoDefaultType.yes;
3704 break;
3705 }
3706 break; 3577 break;
3578 }
3579 break;
3707 } 3580 }
3708 } 3581 }
3709 } 3582 }
@@ -3712,79 +3585,79 @@ namespace WixToolset.Core.WindowsInstaller
3712 } 3585 }
3713 else 3586 else
3714 { 3587 {
3715 Wix.PatchInformation patchInformation = new Wix.PatchInformation(); 3588 var patchInformation = new Wix.PatchInformation();
3716 3589
3717 foreach (Row row in table.Rows) 3590 foreach (var row in table.Rows)
3718 { 3591 {
3719 int propertyId = Convert.ToInt32(row[0]); 3592 var propertyId = Convert.ToInt32(row[0]);
3720 string value = Convert.ToString(row[1]); 3593 var value = Convert.ToString(row[1]);
3721 3594
3722 if (null != row[1] && 0 < value.Length) 3595 if (null != row[1] && 0 < value.Length)
3723 { 3596 {
3724 switch (propertyId) 3597 switch (propertyId)
3725 { 3598 {
3726 case 1: 3599 case 1:
3727 if ("1252" != value) 3600 if ("1252" != value)
3728 { 3601 {
3729 patchInformation.SummaryCodepage = value; 3602 patchInformation.SummaryCodepage = value;
3730 } 3603 }
3731 break; 3604 break;
3732 case 3: 3605 case 3:
3733 patchInformation.Description = value; 3606 patchInformation.Description = value;
3734 break; 3607 break;
3735 case 4: 3608 case 4:
3736 patchInformation.Manufacturer = value; 3609 patchInformation.Manufacturer = value;
3737 break; 3610 break;
3738 case 5: 3611 case 5:
3739 if ("Installer,Patching,PCP,Database" != value) 3612 if ("Installer,Patching,PCP,Database" != value)
3740 { 3613 {
3741 patchInformation.Keywords = value; 3614 patchInformation.Keywords = value;
3742 } 3615 }
3743 break; 3616 break;
3744 case 6: 3617 case 6:
3745 patchInformation.Comments = value; 3618 patchInformation.Comments = value;
3746 break; 3619 break;
3747 case 7: 3620 case 7:
3748 string[] template = value.Split(';'); 3621 var template = value.Split(';');
3749 if (0 < template.Length && 0 < template[template.Length - 1].Length) 3622 if (0 < template.Length && 0 < template[template.Length - 1].Length)
3750 { 3623 {
3751 patchInformation.Languages = template[template.Length - 1]; 3624 patchInformation.Languages = template[template.Length - 1];
3752 } 3625 }
3753 3626
3754 if (1 < template.Length && null != template[0] && 0 < template[0].Length) 3627 if (1 < template.Length && null != template[0] && 0 < template[0].Length)
3755 { 3628 {
3756 patchInformation.Platforms = template[0]; 3629 patchInformation.Platforms = template[0];
3757 } 3630 }
3758 break; 3631 break;
3759 case 15: 3632 case 15:
3760 int wordCount = Convert.ToInt32(value, CultureInfo.InvariantCulture); 3633 var wordCount = Convert.ToInt32(value, CultureInfo.InvariantCulture);
3761 if (0x1 == (wordCount & 0x1)) 3634 if (0x1 == (wordCount & 0x1))
3762 { 3635 {
3763 patchInformation.ShortNames = Wix.YesNoType.yes; 3636 patchInformation.ShortNames = Wix.YesNoType.yes;
3764 } 3637 }
3765 3638
3766 if (0x2 == (wordCount & 0x2)) 3639 if (0x2 == (wordCount & 0x2))
3767 { 3640 {
3768 patchInformation.Compressed = Wix.YesNoType.yes; 3641 patchInformation.Compressed = Wix.YesNoType.yes;
3769 } 3642 }
3770 3643
3771 if (0x4 == (wordCount & 0x4)) 3644 if (0x4 == (wordCount & 0x4))
3772 { 3645 {
3773 patchInformation.AdminImage = Wix.YesNoType.yes; 3646 patchInformation.AdminImage = Wix.YesNoType.yes;
3774 } 3647 }
3648 break;
3649 case 19:
3650 var security = Convert.ToInt32(value, CultureInfo.InvariantCulture);
3651 switch (security)
3652 {
3653 case 0:
3654 patchInformation.ReadOnly = Wix.YesNoDefaultType.no;
3775 break; 3655 break;
3776 case 19: 3656 case 4:
3777 int security = Convert.ToInt32(value, CultureInfo.InvariantCulture); 3657 patchInformation.ReadOnly = Wix.YesNoDefaultType.yes;
3778 switch (security)
3779 {
3780 case 0:
3781 patchInformation.ReadOnly = Wix.YesNoDefaultType.no;
3782 break;
3783 case 4:
3784 patchInformation.ReadOnly = Wix.YesNoDefaultType.yes;
3785 break;
3786 }
3787 break; 3658 break;
3659 }
3660 break;
3788 } 3661 }
3789 } 3662 }
3790 } 3663 }
@@ -3799,9 +3672,9 @@ namespace WixToolset.Core.WindowsInstaller
3799 /// <param name="table">The table to decompile.</param> 3672 /// <param name="table">The table to decompile.</param>
3800 private void DecompileActionTextTable(Table table) 3673 private void DecompileActionTextTable(Table table)
3801 { 3674 {
3802 foreach (Row row in table.Rows) 3675 foreach (var row in table.Rows)
3803 { 3676 {
3804 Wix.ProgressText progressText = new Wix.ProgressText(); 3677 var progressText = new Wix.ProgressText();
3805 3678
3806 progressText.Action = Convert.ToString(row[0]); 3679 progressText.Action = Convert.ToString(row[0]);
3807 3680
@@ -3825,9 +3698,9 @@ namespace WixToolset.Core.WindowsInstaller
3825 /// <param name="table">The table to decompile.</param> 3698 /// <param name="table">The table to decompile.</param>
3826 private void DecompileAppIdTable(Table table) 3699 private void DecompileAppIdTable(Table table)
3827 { 3700 {
3828 foreach (Row row in table.Rows) 3701 foreach (var row in table.Rows)
3829 { 3702 {
3830 Wix.AppId appId = new Wix.AppId(); 3703 var appId = new Wix.AppId();
3831 3704
3832 appId.Advertise = Wix.YesNoType.yes; 3705 appId.Advertise = Wix.YesNoType.yes;
3833 3706
@@ -3876,7 +3749,7 @@ namespace WixToolset.Core.WindowsInstaller
3876 { 3749 {
3877 foreach (BBControlRow bbControlRow in table.Rows) 3750 foreach (BBControlRow bbControlRow in table.Rows)
3878 { 3751 {
3879 Wix.Control control = new Wix.Control(); 3752 var control = new Wix.Control();
3880 3753
3881 control.Id = bbControlRow.BBControl; 3754 control.Id = bbControlRow.BBControl;
3882 3755
@@ -3900,14 +3773,14 @@ namespace WixToolset.Core.WindowsInstaller
3900 control.Text = bbControlRow.Text; 3773 control.Text = bbControlRow.Text;
3901 } 3774 }
3902 3775
3903 Wix.Billboard billboard = (Wix.Billboard)this.core.GetIndexedElement("Billboard", bbControlRow.Billboard); 3776 var billboard = (Wix.Billboard)this.core.GetIndexedElement("Billboard", bbControlRow.Billboard);
3904 if (null != billboard) 3777 if (null != billboard)
3905 { 3778 {
3906 billboard.AddChild(control); 3779 billboard.AddChild(control);
3907 } 3780 }
3908 else 3781 else
3909 { 3782 {
3910 this.core.OnMessage(WixWarnings.ExpectedForeignRow(bbControlRow.SourceLineNumbers, table.Name, bbControlRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Billboard_", bbControlRow.Billboard, "Billboard")); 3783 this.Messaging.Write(WarningMessages.ExpectedForeignRow(bbControlRow.SourceLineNumbers, table.Name, bbControlRow.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Billboard_", bbControlRow.Billboard, "Billboard"));
3911 } 3784 }
3912 } 3785 }
3913 } 3786 }
@@ -3918,12 +3791,12 @@ namespace WixToolset.Core.WindowsInstaller
3918 /// <param name="table">The table to decompile.</param> 3791 /// <param name="table">The table to decompile.</param>
3919 private void DecompileBillboardTable(Table table) 3792 private void DecompileBillboardTable(Table table)
3920 { 3793 {
3921 Hashtable billboardActions = new Hashtable(); 3794 var billboardActions = new Hashtable();
3922 SortedList billboards = new SortedList(); 3795 var billboards = new SortedList();
3923 3796
3924 foreach (Row row in table.Rows) 3797 foreach (var row in table.Rows)
3925 { 3798 {
3926 Wix.Billboard billboard = new Wix.Billboard(); 3799 var billboard = new Wix.Billboard();
3927 3800
3928 billboard.Id = Convert.ToString(row[0]); 3801 billboard.Id = Convert.ToString(row[0]);
3929 3802
@@ -3935,8 +3808,8 @@ namespace WixToolset.Core.WindowsInstaller
3935 3808
3936 foreach (Row row in billboards.Values) 3809 foreach (Row row in billboards.Values)
3937 { 3810 {
3938 Wix.Billboard billboard = (Wix.Billboard)this.core.GetIndexedElement(row); 3811 var billboard = (Wix.Billboard)this.core.GetIndexedElement(row);
3939 Wix.BillboardAction billboardAction = (Wix.BillboardAction)billboardActions[row[2]]; 3812 var billboardAction = (Wix.BillboardAction)billboardActions[row[2]];
3940 3813
3941 if (null == billboardAction) 3814 if (null == billboardAction)
3942 { 3815 {
@@ -3958,9 +3831,9 @@ namespace WixToolset.Core.WindowsInstaller
3958 /// <param name="table">The table to decompile.</param> 3831 /// <param name="table">The table to decompile.</param>
3959 private void DecompileBinaryTable(Table table) 3832 private void DecompileBinaryTable(Table table)
3960 { 3833 {
3961 foreach (Row row in table.Rows) 3834 foreach (var row in table.Rows)
3962 { 3835 {
3963 Wix.Binary binary = new Wix.Binary(); 3836 var binary = new Wix.Binary();
3964 3837
3965 binary.Id = Convert.ToString(row[0]); 3838 binary.Id = Convert.ToString(row[0]);
3966 3839
@@ -3976,9 +3849,9 @@ namespace WixToolset.Core.WindowsInstaller
3976 /// <param name="table">The table to decompile.</param> 3849 /// <param name="table">The table to decompile.</param>
3977 private void DecompileBindImageTable(Table table) 3850 private void DecompileBindImageTable(Table table)
3978 { 3851 {
3979 foreach (Row row in table.Rows) 3852 foreach (var row in table.Rows)
3980 { 3853 {
3981 Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0])); 3854 var file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0]));
3982 3855
3983 if (null != file) 3856 if (null != file)
3984 { 3857 {
@@ -3986,7 +3859,7 @@ namespace WixToolset.Core.WindowsInstaller
3986 } 3859 }
3987 else 3860 else
3988 { 3861 {
3989 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File")); 3862 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File"));
3990 } 3863 }
3991 } 3864 }
3992 } 3865 }
@@ -3997,9 +3870,9 @@ namespace WixToolset.Core.WindowsInstaller
3997 /// <param name="table">The table to decompile.</param> 3870 /// <param name="table">The table to decompile.</param>
3998 private void DecompileClassTable(Table table) 3871 private void DecompileClassTable(Table table)
3999 { 3872 {
4000 foreach (Row row in table.Rows) 3873 foreach (var row in table.Rows)
4001 { 3874 {
4002 Wix.Class wixClass = new Wix.Class(); 3875 var wixClass = new Wix.Class();
4003 3876
4004 wixClass.Advertise = Wix.YesNoType.yes; 3877 wixClass.Advertise = Wix.YesNoType.yes;
4005 3878
@@ -4007,21 +3880,21 @@ namespace WixToolset.Core.WindowsInstaller
4007 3880
4008 switch (Convert.ToString(row[1])) 3881 switch (Convert.ToString(row[1]))
4009 { 3882 {
4010 case "LocalServer": 3883 case "LocalServer":
4011 wixClass.Context = Wix.Class.ContextType.LocalServer; 3884 wixClass.Context = Wix.Class.ContextType.LocalServer;
4012 break; 3885 break;
4013 case "LocalServer32": 3886 case "LocalServer32":
4014 wixClass.Context = Wix.Class.ContextType.LocalServer32; 3887 wixClass.Context = Wix.Class.ContextType.LocalServer32;
4015 break; 3888 break;
4016 case "InprocServer": 3889 case "InprocServer":
4017 wixClass.Context = Wix.Class.ContextType.InprocServer; 3890 wixClass.Context = Wix.Class.ContextType.InprocServer;
4018 break; 3891 break;
4019 case "InprocServer32": 3892 case "InprocServer32":
4020 wixClass.Context = Wix.Class.ContextType.InprocServer32; 3893 wixClass.Context = Wix.Class.ContextType.InprocServer32;
4021 break; 3894 break;
4022 default: 3895 default:
4023 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 3896 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
4024 break; 3897 break;
4025 } 3898 }
4026 3899
4027 // ProgId children are handled in FinalizeProgIdTable 3900 // ProgId children are handled in FinalizeProgIdTable
@@ -4038,17 +3911,17 @@ namespace WixToolset.Core.WindowsInstaller
4038 3911
4039 if (null != row[6]) 3912 if (null != row[6])
4040 { 3913 {
4041 string[] fileTypeMaskStrings = (Convert.ToString(row[6])).Split(';'); 3914 var fileTypeMaskStrings = (Convert.ToString(row[6])).Split(';');
4042 3915
4043 try 3916 try
4044 { 3917 {
4045 foreach (string fileTypeMaskString in fileTypeMaskStrings) 3918 foreach (var fileTypeMaskString in fileTypeMaskStrings)
4046 { 3919 {
4047 string[] fileTypeMaskParts = fileTypeMaskString.Split(','); 3920 var fileTypeMaskParts = fileTypeMaskString.Split(',');
4048 3921
4049 if (4 == fileTypeMaskParts.Length) 3922 if (4 == fileTypeMaskParts.Length)
4050 { 3923 {
4051 Wix.FileTypeMask fileTypeMask = new Wix.FileTypeMask(); 3924 var fileTypeMask = new Wix.FileTypeMask();
4052 3925
4053 fileTypeMask.Offset = Convert.ToInt32(fileTypeMaskParts[0], CultureInfo.InvariantCulture); 3926 fileTypeMask.Offset = Convert.ToInt32(fileTypeMaskParts[0], CultureInfo.InvariantCulture);
4054 3927
@@ -4066,11 +3939,11 @@ namespace WixToolset.Core.WindowsInstaller
4066 } 3939 }
4067 catch (FormatException) 3940 catch (FormatException)
4068 { 3941 {
4069 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); 3942 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6]));
4070 } 3943 }
4071 catch (OverflowException) 3944 catch (OverflowException)
4072 { 3945 {
4073 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); 3946 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6]));
4074 } 3947 }
4075 } 3948 }
4076 3949
@@ -4102,18 +3975,18 @@ namespace WixToolset.Core.WindowsInstaller
4102 } 3975 }
4103 else 3976 else
4104 { 3977 {
4105 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[12].Column.Name, row[12])); 3978 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[12].Column.Name, row[12]));
4106 } 3979 }
4107 } 3980 }
4108 3981
4109 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2])); 3982 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2]));
4110 if (null != component) 3983 if (null != component)
4111 { 3984 {
4112 component.AddChild(wixClass); 3985 component.AddChild(wixClass);
4113 } 3986 }
4114 else 3987 else
4115 { 3988 {
4116 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[2]), "Component")); 3989 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[2]), "Component"));
4117 } 3990 }
4118 3991
4119 this.core.IndexElement(row, wixClass); 3992 this.core.IndexElement(row, wixClass);
@@ -4127,10 +4000,10 @@ namespace WixToolset.Core.WindowsInstaller
4127 private void DecompileComboBoxTable(Table table) 4000 private void DecompileComboBoxTable(Table table)
4128 { 4001 {
4129 Wix.ComboBox comboBox = null; 4002 Wix.ComboBox comboBox = null;
4130 SortedList comboBoxRows = new SortedList(); 4003 var comboBoxRows = new SortedList();
4131 4004
4132 // sort the combo boxes by their property and order 4005 // sort the combo boxes by their property and order
4133 foreach (Row row in table.Rows) 4006 foreach (var row in table.Rows)
4134 { 4007 {
4135 comboBoxRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row); 4008 comboBoxRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row);
4136 } 4009 }
@@ -4146,7 +4019,7 @@ namespace WixToolset.Core.WindowsInstaller
4146 this.core.UIElement.AddChild(comboBox); 4019 this.core.UIElement.AddChild(comboBox);
4147 } 4020 }
4148 4021
4149 Wix.ListItem listItem = new Wix.ListItem(); 4022 var listItem = new Wix.ListItem();
4150 4023
4151 listItem.Value = Convert.ToString(row[2]); 4024 listItem.Value = Convert.ToString(row[2]);
4152 4025
@@ -4167,7 +4040,7 @@ namespace WixToolset.Core.WindowsInstaller
4167 { 4040 {
4168 foreach (ControlRow controlRow in table.Rows) 4041 foreach (ControlRow controlRow in table.Rows)
4169 { 4042 {
4170 Wix.Control control = new Wix.Control(); 4043 var control = new Wix.Control();
4171 4044
4172 control.Id = controlRow.Control; 4045 control.Id = controlRow.Control;
4173 4046
@@ -4190,64 +4063,64 @@ namespace WixToolset.Core.WindowsInstaller
4190 4063
4191 switch (control.Type) 4064 switch (control.Type)
4192 { 4065 {
4193 case "Bitmap": 4066 case "Bitmap":
4194 specialAttributes = MsiInterop.BitmapControlAttributes; 4067 specialAttributes = MsiInterop.BitmapControlAttributes;
4195 break; 4068 break;
4196 case "CheckBox": 4069 case "CheckBox":
4197 specialAttributes = MsiInterop.CheckboxControlAttributes; 4070 specialAttributes = MsiInterop.CheckboxControlAttributes;
4198 break; 4071 break;
4199 case "ComboBox": 4072 case "ComboBox":
4200 specialAttributes = MsiInterop.ComboboxControlAttributes; 4073 specialAttributes = MsiInterop.ComboboxControlAttributes;
4201 break; 4074 break;
4202 case "DirectoryCombo": 4075 case "DirectoryCombo":
4203 specialAttributes = MsiInterop.VolumeControlAttributes; 4076 specialAttributes = MsiInterop.VolumeControlAttributes;
4204 break; 4077 break;
4205 case "Edit": 4078 case "Edit":
4206 specialAttributes = MsiInterop.EditControlAttributes; 4079 specialAttributes = MsiInterop.EditControlAttributes;
4207 break; 4080 break;
4208 case "Icon": 4081 case "Icon":
4209 specialAttributes = MsiInterop.IconControlAttributes; 4082 specialAttributes = MsiInterop.IconControlAttributes;
4210 break; 4083 break;
4211 case "ListBox": 4084 case "ListBox":
4212 specialAttributes = MsiInterop.ListboxControlAttributes; 4085 specialAttributes = MsiInterop.ListboxControlAttributes;
4213 break; 4086 break;
4214 case "ListView": 4087 case "ListView":
4215 specialAttributes = MsiInterop.ListviewControlAttributes; 4088 specialAttributes = MsiInterop.ListviewControlAttributes;
4216 break; 4089 break;
4217 case "MaskedEdit": 4090 case "MaskedEdit":
4218 specialAttributes = MsiInterop.EditControlAttributes; 4091 specialAttributes = MsiInterop.EditControlAttributes;
4219 break; 4092 break;
4220 case "PathEdit": 4093 case "PathEdit":
4221 specialAttributes = MsiInterop.EditControlAttributes; 4094 specialAttributes = MsiInterop.EditControlAttributes;
4222 break; 4095 break;
4223 case "ProgressBar": 4096 case "ProgressBar":
4224 specialAttributes = MsiInterop.ProgressControlAttributes; 4097 specialAttributes = MsiInterop.ProgressControlAttributes;
4225 break; 4098 break;
4226 case "PushButton": 4099 case "PushButton":
4227 specialAttributes = MsiInterop.ButtonControlAttributes; 4100 specialAttributes = MsiInterop.ButtonControlAttributes;
4228 break; 4101 break;
4229 case "RadioButtonGroup": 4102 case "RadioButtonGroup":
4230 specialAttributes = MsiInterop.RadioControlAttributes; 4103 specialAttributes = MsiInterop.RadioControlAttributes;
4231 break; 4104 break;
4232 case "Text": 4105 case "Text":
4233 specialAttributes = MsiInterop.TextControlAttributes; 4106 specialAttributes = MsiInterop.TextControlAttributes;
4234 break; 4107 break;
4235 case "VolumeCostList": 4108 case "VolumeCostList":
4236 specialAttributes = MsiInterop.VolumeControlAttributes; 4109 specialAttributes = MsiInterop.VolumeControlAttributes;
4237 break; 4110 break;
4238 case "VolumeSelectCombo": 4111 case "VolumeSelectCombo":
4239 specialAttributes = MsiInterop.VolumeControlAttributes; 4112 specialAttributes = MsiInterop.VolumeControlAttributes;
4240 break; 4113 break;
4241 default: 4114 default:
4242 specialAttributes = null; 4115 specialAttributes = null;
4243 break; 4116 break;
4244 } 4117 }
4245 4118
4246 if (null != specialAttributes) 4119 if (null != specialAttributes)
4247 { 4120 {
4248 bool iconSizeSet = false; 4121 var iconSizeSet = false;
4249 4122
4250 for (int i = 16; 32 > i; i++) 4123 for (var i = 16; 32 > i; i++)
4251 { 4124 {
4252 if (1 == ((controlRow.Attributes >> i) & 1)) 4125 if (1 == ((controlRow.Attributes >> i) & 1))
4253 { 4126 {
@@ -4261,115 +4134,115 @@ namespace WixToolset.Core.WindowsInstaller
4261 // unknown attribute 4134 // unknown attribute
4262 if (null == attribute) 4135 if (null == attribute)
4263 { 4136 {
4264 this.core.OnMessage(WixWarnings.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes)); 4137 this.Messaging.Write(WarningMessages.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes));
4265 continue; 4138 continue;
4266 } 4139 }
4267 4140
4268 switch (attribute) 4141 switch (attribute)
4269 { 4142 {
4270 case "Bitmap": 4143 case "Bitmap":
4271 control.Bitmap = Wix.YesNoType.yes; 4144 control.Bitmap = Wix.YesNoType.yes;
4272 break; 4145 break;
4273 case "CDROM": 4146 case "CDROM":
4274 control.CDROM = Wix.YesNoType.yes; 4147 control.CDROM = Wix.YesNoType.yes;
4275 break; 4148 break;
4276 case "ComboList": 4149 case "ComboList":
4277 control.ComboList = Wix.YesNoType.yes; 4150 control.ComboList = Wix.YesNoType.yes;
4278 break; 4151 break;
4279 case "ElevationShield": 4152 case "ElevationShield":
4280 control.ElevationShield = Wix.YesNoType.yes; 4153 control.ElevationShield = Wix.YesNoType.yes;
4281 break; 4154 break;
4282 case "Fixed": 4155 case "Fixed":
4283 control.Fixed = Wix.YesNoType.yes; 4156 control.Fixed = Wix.YesNoType.yes;
4284 break; 4157 break;
4285 case "FixedSize": 4158 case "FixedSize":
4286 control.FixedSize = Wix.YesNoType.yes; 4159 control.FixedSize = Wix.YesNoType.yes;
4287 break; 4160 break;
4288 case "Floppy": 4161 case "Floppy":
4289 control.Floppy = Wix.YesNoType.yes; 4162 control.Floppy = Wix.YesNoType.yes;
4290 break; 4163 break;
4291 case "FormatSize": 4164 case "FormatSize":
4292 control.FormatSize = Wix.YesNoType.yes; 4165 control.FormatSize = Wix.YesNoType.yes;
4293 break; 4166 break;
4294 case "HasBorder": 4167 case "HasBorder":
4295 control.HasBorder = Wix.YesNoType.yes; 4168 control.HasBorder = Wix.YesNoType.yes;
4296 break; 4169 break;
4297 case "Icon": 4170 case "Icon":
4298 control.Icon = Wix.YesNoType.yes; 4171 control.Icon = Wix.YesNoType.yes;
4299 break; 4172 break;
4300 case "Icon16": 4173 case "Icon16":
4301 if (iconSizeSet) 4174 if (iconSizeSet)
4302 { 4175 {
4303 control.IconSize = Wix.Control.IconSizeType.Item48; 4176 control.IconSize = Wix.Control.IconSizeType.Item48;
4304 } 4177 }
4305 else 4178 else
4306 { 4179 {
4307 iconSizeSet = true; 4180 iconSizeSet = true;
4308 control.IconSize = Wix.Control.IconSizeType.Item16; 4181 control.IconSize = Wix.Control.IconSizeType.Item16;
4309 } 4182 }
4310 break; 4183 break;
4311 case "Icon32": 4184 case "Icon32":
4312 if (iconSizeSet) 4185 if (iconSizeSet)
4313 { 4186 {
4314 control.IconSize = Wix.Control.IconSizeType.Item48; 4187 control.IconSize = Wix.Control.IconSizeType.Item48;
4315 } 4188 }
4316 else 4189 else
4317 { 4190 {
4318 iconSizeSet = true; 4191 iconSizeSet = true;
4319 control.IconSize = Wix.Control.IconSizeType.Item32; 4192 control.IconSize = Wix.Control.IconSizeType.Item32;
4320 } 4193 }
4321 break; 4194 break;
4322 case "Image": 4195 case "Image":
4323 control.Image = Wix.YesNoType.yes; 4196 control.Image = Wix.YesNoType.yes;
4324 break; 4197 break;
4325 case "Multiline": 4198 case "Multiline":
4326 control.Multiline = Wix.YesNoType.yes; 4199 control.Multiline = Wix.YesNoType.yes;
4327 break; 4200 break;
4328 case "NoPrefix": 4201 case "NoPrefix":
4329 control.NoPrefix = Wix.YesNoType.yes; 4202 control.NoPrefix = Wix.YesNoType.yes;
4330 break; 4203 break;
4331 case "NoWrap": 4204 case "NoWrap":
4332 control.NoWrap = Wix.YesNoType.yes; 4205 control.NoWrap = Wix.YesNoType.yes;
4333 break; 4206 break;
4334 case "Password": 4207 case "Password":
4335 control.Password = Wix.YesNoType.yes; 4208 control.Password = Wix.YesNoType.yes;
4336 break; 4209 break;
4337 case "ProgressBlocks": 4210 case "ProgressBlocks":
4338 control.ProgressBlocks = Wix.YesNoType.yes; 4211 control.ProgressBlocks = Wix.YesNoType.yes;
4339 break; 4212 break;
4340 case "PushLike": 4213 case "PushLike":
4341 control.PushLike = Wix.YesNoType.yes; 4214 control.PushLike = Wix.YesNoType.yes;
4342 break; 4215 break;
4343 case "RAMDisk": 4216 case "RAMDisk":
4344 control.RAMDisk = Wix.YesNoType.yes; 4217 control.RAMDisk = Wix.YesNoType.yes;
4345 break; 4218 break;
4346 case "Remote": 4219 case "Remote":
4347 control.Remote = Wix.YesNoType.yes; 4220 control.Remote = Wix.YesNoType.yes;
4348 break; 4221 break;
4349 case "Removable": 4222 case "Removable":
4350 control.Removable = Wix.YesNoType.yes; 4223 control.Removable = Wix.YesNoType.yes;
4351 break; 4224 break;
4352 case "ShowRollbackCost": 4225 case "ShowRollbackCost":
4353 control.ShowRollbackCost = Wix.YesNoType.yes; 4226 control.ShowRollbackCost = Wix.YesNoType.yes;
4354 break; 4227 break;
4355 case "Sorted": 4228 case "Sorted":
4356 control.Sorted = Wix.YesNoType.yes; 4229 control.Sorted = Wix.YesNoType.yes;
4357 break; 4230 break;
4358 case "Transparent": 4231 case "Transparent":
4359 control.Transparent = Wix.YesNoType.yes; 4232 control.Transparent = Wix.YesNoType.yes;
4360 break; 4233 break;
4361 case "UserLanguage": 4234 case "UserLanguage":
4362 control.UserLanguage = Wix.YesNoType.yes; 4235 control.UserLanguage = Wix.YesNoType.yes;
4363 break; 4236 break;
4364 default: 4237 default:
4365 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknowControlAttribute, attribute)); 4238 throw new InvalidOperationException($"Unknown control attribute: '{attribute}'.");
4366 } 4239 }
4367 } 4240 }
4368 } 4241 }
4369 } 4242 }
4370 else if (0 < (controlRow.Attributes & 0xFFFF0000)) 4243 else if (0 < (controlRow.Attributes & 0xFFFF0000))
4371 { 4244 {
4372 this.core.OnMessage(WixWarnings.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes)); 4245 this.Messaging.Write(WarningMessages.IllegalColumnValue(controlRow.SourceLineNumbers, table.Name, controlRow.Fields[7].Column.Name, controlRow.Attributes));
4373 } 4246 }
4374 } 4247 }
4375 4248
@@ -4386,7 +4259,7 @@ namespace WixToolset.Core.WindowsInstaller
4386 4259
4387 if (null != controlRow.Help) 4260 if (null != controlRow.Help)
4388 { 4261 {
4389 string[] help = controlRow.Help.Split('|'); 4262 var help = controlRow.Help.Split('|');
4390 4263
4391 if (2 == help.Length) 4264 if (2 == help.Length)
4392 { 4265 {
@@ -4412,42 +4285,42 @@ namespace WixToolset.Core.WindowsInstaller
4412 /// <param name="table">The table to decompile.</param> 4285 /// <param name="table">The table to decompile.</param>
4413 private void DecompileControlConditionTable(Table table) 4286 private void DecompileControlConditionTable(Table table)
4414 { 4287 {
4415 foreach (Row row in table.Rows) 4288 foreach (var row in table.Rows)
4416 { 4289 {
4417 Wix.Condition condition = new Wix.Condition(); 4290 var condition = new Wix.Condition();
4418 4291
4419 switch (Convert.ToString(row[2])) 4292 switch (Convert.ToString(row[2]))
4420 { 4293 {
4421 case "Default": 4294 case "Default":
4422 condition.Action = Wix.Condition.ActionType.@default; 4295 condition.Action = Wix.Condition.ActionType.@default;
4423 break; 4296 break;
4424 case "Disable": 4297 case "Disable":
4425 condition.Action = Wix.Condition.ActionType.disable; 4298 condition.Action = Wix.Condition.ActionType.disable;
4426 break; 4299 break;
4427 case "Enable": 4300 case "Enable":
4428 condition.Action = Wix.Condition.ActionType.enable; 4301 condition.Action = Wix.Condition.ActionType.enable;
4429 break; 4302 break;
4430 case "Hide": 4303 case "Hide":
4431 condition.Action = Wix.Condition.ActionType.hide; 4304 condition.Action = Wix.Condition.ActionType.hide;
4432 break; 4305 break;
4433 case "Show": 4306 case "Show":
4434 condition.Action = Wix.Condition.ActionType.show; 4307 condition.Action = Wix.Condition.ActionType.show;
4435 break; 4308 break;
4436 default: 4309 default:
4437 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2])); 4310 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2]));
4438 break; 4311 break;
4439 } 4312 }
4440 4313
4441 condition.Content = Convert.ToString(row[3]); 4314 condition.Content = Convert.ToString(row[3]);
4442 4315
4443 Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1])); 4316 var control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1]));
4444 if (null != control) 4317 if (null != control)
4445 { 4318 {
4446 control.AddChild(condition); 4319 control.AddChild(condition);
4447 } 4320 }
4448 else 4321 else
4449 { 4322 {
4450 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control")); 4323 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control"));
4451 } 4324 }
4452 } 4325 }
4453 } 4326 }
@@ -4458,13 +4331,13 @@ namespace WixToolset.Core.WindowsInstaller
4458 /// <param name="table">The table to decompile.</param> 4331 /// <param name="table">The table to decompile.</param>
4459 private void DecompileControlEventTable(Table table) 4332 private void DecompileControlEventTable(Table table)
4460 { 4333 {
4461 SortedList controlEvents = new SortedList(); 4334 var controlEvents = new SortedList();
4462 4335
4463 foreach (Row row in table.Rows) 4336 foreach (var row in table.Rows)
4464 { 4337 {
4465 Wix.Publish publish = new Wix.Publish(); 4338 var publish = new Wix.Publish();
4466 4339
4467 string publishEvent = Convert.ToString(row[2]); 4340 var publishEvent = Convert.ToString(row[2]);
4468 if (publishEvent.StartsWith("[", StringComparison.Ordinal) && publishEvent.EndsWith("]", StringComparison.Ordinal)) 4341 if (publishEvent.StartsWith("[", StringComparison.Ordinal) && publishEvent.EndsWith("]", StringComparison.Ordinal))
4469 { 4342 {
4470 publish.Property = publishEvent.Substring(1, publishEvent.Length - 2); 4343 publish.Property = publishEvent.Substring(1, publishEvent.Length - 2);
@@ -4492,8 +4365,8 @@ namespace WixToolset.Core.WindowsInstaller
4492 4365
4493 foreach (Row row in controlEvents.Values) 4366 foreach (Row row in controlEvents.Values)
4494 { 4367 {
4495 Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1])); 4368 var control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1]));
4496 Wix.Publish publish = (Wix.Publish)this.core.GetIndexedElement(row); 4369 var publish = (Wix.Publish)this.core.GetIndexedElement(row);
4497 4370
4498 if (null != control) 4371 if (null != control)
4499 { 4372 {
@@ -4501,7 +4374,7 @@ namespace WixToolset.Core.WindowsInstaller
4501 } 4374 }
4502 else 4375 else
4503 { 4376 {
4504 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control")); 4377 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control"));
4505 } 4378 }
4506 } 4379 }
4507 } 4380 }
@@ -4512,17 +4385,17 @@ namespace WixToolset.Core.WindowsInstaller
4512 /// <param name="table">The table to decompile.</param> 4385 /// <param name="table">The table to decompile.</param>
4513 private void DecompileCustomTable(Table table) 4386 private void DecompileCustomTable(Table table)
4514 { 4387 {
4515 if (0 < table.Rows.Count || this.suppressDroppingEmptyTables) 4388 if (0 < table.Rows.Count || this.SuppressDroppingEmptyTables)
4516 { 4389 {
4517 Wix.CustomTable customTable = new Wix.CustomTable(); 4390 var customTable = new Wix.CustomTable();
4518 4391
4519 this.core.OnMessage(WixWarnings.DecompilingAsCustomTable(table.Rows[0].SourceLineNumbers, table.Name)); 4392 this.Messaging.Write(WarningMessages.DecompilingAsCustomTable(table.Rows[0].SourceLineNumbers, table.Name));
4520 4393
4521 customTable.Id = table.Name; 4394 customTable.Id = table.Name;
4522 4395
4523 foreach (ColumnDefinition columnDefinition in table.Definition.Columns) 4396 foreach (var columnDefinition in table.Definition.Columns)
4524 { 4397 {
4525 Wix.Column column = new Wix.Column(); 4398 var column = new Wix.Column();
4526 4399
4527 column.Id = columnDefinition.Name; 4400 column.Id = columnDefinition.Name;
4528 4401
@@ -4530,86 +4403,86 @@ namespace WixToolset.Core.WindowsInstaller
4530 { 4403 {
4531 switch (columnDefinition.Category) 4404 switch (columnDefinition.Category)
4532 { 4405 {
4533 case ColumnCategory.Text: 4406 case ColumnCategory.Text:
4534 column.Category = Wix.Column.CategoryType.Text; 4407 column.Category = Wix.Column.CategoryType.Text;
4535 break; 4408 break;
4536 case ColumnCategory.UpperCase: 4409 case ColumnCategory.UpperCase:
4537 column.Category = Wix.Column.CategoryType.UpperCase; 4410 column.Category = Wix.Column.CategoryType.UpperCase;
4538 break; 4411 break;
4539 case ColumnCategory.LowerCase: 4412 case ColumnCategory.LowerCase:
4540 column.Category = Wix.Column.CategoryType.LowerCase; 4413 column.Category = Wix.Column.CategoryType.LowerCase;
4541 break; 4414 break;
4542 case ColumnCategory.Integer: 4415 case ColumnCategory.Integer:
4543 column.Category = Wix.Column.CategoryType.Integer; 4416 column.Category = Wix.Column.CategoryType.Integer;
4544 break; 4417 break;
4545 case ColumnCategory.DoubleInteger: 4418 case ColumnCategory.DoubleInteger:
4546 column.Category = Wix.Column.CategoryType.DoubleInteger; 4419 column.Category = Wix.Column.CategoryType.DoubleInteger;
4547 break; 4420 break;
4548 case ColumnCategory.TimeDate: 4421 case ColumnCategory.TimeDate:
4549 column.Category = Wix.Column.CategoryType.TimeDate; 4422 column.Category = Wix.Column.CategoryType.TimeDate;
4550 break; 4423 break;
4551 case ColumnCategory.Identifier: 4424 case ColumnCategory.Identifier:
4552 column.Category = Wix.Column.CategoryType.Identifier; 4425 column.Category = Wix.Column.CategoryType.Identifier;
4553 break; 4426 break;
4554 case ColumnCategory.Property: 4427 case ColumnCategory.Property:
4555 column.Category = Wix.Column.CategoryType.Property; 4428 column.Category = Wix.Column.CategoryType.Property;
4556 break; 4429 break;
4557 case ColumnCategory.Filename: 4430 case ColumnCategory.Filename:
4558 column.Category = Wix.Column.CategoryType.Filename; 4431 column.Category = Wix.Column.CategoryType.Filename;
4559 break; 4432 break;
4560 case ColumnCategory.WildCardFilename: 4433 case ColumnCategory.WildCardFilename:
4561 column.Category = Wix.Column.CategoryType.WildCardFilename; 4434 column.Category = Wix.Column.CategoryType.WildCardFilename;
4562 break; 4435 break;
4563 case ColumnCategory.Path: 4436 case ColumnCategory.Path:
4564 column.Category = Wix.Column.CategoryType.Path; 4437 column.Category = Wix.Column.CategoryType.Path;
4565 break; 4438 break;
4566 case ColumnCategory.Paths: 4439 case ColumnCategory.Paths:
4567 column.Category = Wix.Column.CategoryType.Paths; 4440 column.Category = Wix.Column.CategoryType.Paths;
4568 break; 4441 break;
4569 case ColumnCategory.AnyPath: 4442 case ColumnCategory.AnyPath:
4570 column.Category = Wix.Column.CategoryType.AnyPath; 4443 column.Category = Wix.Column.CategoryType.AnyPath;
4571 break; 4444 break;
4572 case ColumnCategory.DefaultDir: 4445 case ColumnCategory.DefaultDir:
4573 column.Category = Wix.Column.CategoryType.DefaultDir; 4446 column.Category = Wix.Column.CategoryType.DefaultDir;
4574 break; 4447 break;
4575 case ColumnCategory.RegPath: 4448 case ColumnCategory.RegPath:
4576 column.Category = Wix.Column.CategoryType.RegPath; 4449 column.Category = Wix.Column.CategoryType.RegPath;
4577 break; 4450 break;
4578 case ColumnCategory.Formatted: 4451 case ColumnCategory.Formatted:
4579 column.Category = Wix.Column.CategoryType.Formatted; 4452 column.Category = Wix.Column.CategoryType.Formatted;
4580 break; 4453 break;
4581 case ColumnCategory.FormattedSDDLText: 4454 case ColumnCategory.FormattedSDDLText:
4582 column.Category = Wix.Column.CategoryType.FormattedSddl; 4455 column.Category = Wix.Column.CategoryType.FormattedSddl;
4583 break; 4456 break;
4584 case ColumnCategory.Template: 4457 case ColumnCategory.Template:
4585 column.Category = Wix.Column.CategoryType.Template; 4458 column.Category = Wix.Column.CategoryType.Template;
4586 break; 4459 break;
4587 case ColumnCategory.Condition: 4460 case ColumnCategory.Condition:
4588 column.Category = Wix.Column.CategoryType.Condition; 4461 column.Category = Wix.Column.CategoryType.Condition;
4589 break; 4462 break;
4590 case ColumnCategory.Guid: 4463 case ColumnCategory.Guid:
4591 column.Category = Wix.Column.CategoryType.Guid; 4464 column.Category = Wix.Column.CategoryType.Guid;
4592 break; 4465 break;
4593 case ColumnCategory.Version: 4466 case ColumnCategory.Version:
4594 column.Category = Wix.Column.CategoryType.Version; 4467 column.Category = Wix.Column.CategoryType.Version;
4595 break; 4468 break;
4596 case ColumnCategory.Language: 4469 case ColumnCategory.Language:
4597 column.Category = Wix.Column.CategoryType.Language; 4470 column.Category = Wix.Column.CategoryType.Language;
4598 break; 4471 break;
4599 case ColumnCategory.Binary: 4472 case ColumnCategory.Binary:
4600 column.Category = Wix.Column.CategoryType.Binary; 4473 column.Category = Wix.Column.CategoryType.Binary;
4601 break; 4474 break;
4602 case ColumnCategory.CustomSource: 4475 case ColumnCategory.CustomSource:
4603 column.Category = Wix.Column.CategoryType.CustomSource; 4476 column.Category = Wix.Column.CategoryType.CustomSource;
4604 break; 4477 break;
4605 case ColumnCategory.Cabinet: 4478 case ColumnCategory.Cabinet:
4606 column.Category = Wix.Column.CategoryType.Cabinet; 4479 column.Category = Wix.Column.CategoryType.Cabinet;
4607 break; 4480 break;
4608 case ColumnCategory.Shortcut: 4481 case ColumnCategory.Shortcut:
4609 column.Category = Wix.Column.CategoryType.Shortcut; 4482 column.Category = Wix.Column.CategoryType.Shortcut;
4610 break; 4483 break;
4611 default: 4484 default:
4612 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnCategory, columnDefinition.Category.ToString())); 4485 throw new InvalidOperationException($"Unknown custom column category '{columnDefinition.Category.ToString()}'.");
4613 } 4486 }
4614 } 4487 }
4615 4488
@@ -4618,9 +4491,9 @@ namespace WixToolset.Core.WindowsInstaller
4618 column.Description = columnDefinition.Description; 4491 column.Description = columnDefinition.Description;
4619 } 4492 }
4620 4493
4621 if (columnDefinition.IsKeyColumnSet) 4494 if (columnDefinition.KeyColumn.HasValue)
4622 { 4495 {
4623 column.KeyColumn = columnDefinition.KeyColumn; 4496 column.KeyColumn = columnDefinition.KeyColumn.Value;
4624 } 4497 }
4625 4498
4626 if (null != columnDefinition.KeyTable) 4499 if (null != columnDefinition.KeyTable)
@@ -4633,37 +4506,37 @@ namespace WixToolset.Core.WindowsInstaller
4633 column.Localizable = Wix.YesNoType.yes; 4506 column.Localizable = Wix.YesNoType.yes;
4634 } 4507 }
4635 4508
4636 if (columnDefinition.IsMaxValueSet) 4509 if (columnDefinition.MaxValue.HasValue)
4637 { 4510 {
4638 column.MaxValue = columnDefinition.MaxValue; 4511 column.MaxValue = columnDefinition.MaxValue.Value;
4639 } 4512 }
4640 4513
4641 if (columnDefinition.IsMinValueSet) 4514 if (columnDefinition.MinValue.HasValue)
4642 { 4515 {
4643 column.MinValue = columnDefinition.MinValue; 4516 column.MinValue = columnDefinition.MinValue.Value;
4644 } 4517 }
4645 4518
4646 if (ColumnModularizeType.None != columnDefinition.ModularizeType) 4519 if (ColumnModularizeType.None != columnDefinition.ModularizeType)
4647 { 4520 {
4648 switch (columnDefinition.ModularizeType) 4521 switch (columnDefinition.ModularizeType)
4649 { 4522 {
4650 case ColumnModularizeType.Column: 4523 case ColumnModularizeType.Column:
4651 column.Modularize = Wix.Column.ModularizeType.Column; 4524 column.Modularize = Wix.Column.ModularizeType.Column;
4652 break; 4525 break;
4653 case ColumnModularizeType.Condition: 4526 case ColumnModularizeType.Condition:
4654 column.Modularize = Wix.Column.ModularizeType.Condition; 4527 column.Modularize = Wix.Column.ModularizeType.Condition;
4655 break; 4528 break;
4656 case ColumnModularizeType.Icon: 4529 case ColumnModularizeType.Icon:
4657 column.Modularize = Wix.Column.ModularizeType.Icon; 4530 column.Modularize = Wix.Column.ModularizeType.Icon;
4658 break; 4531 break;
4659 case ColumnModularizeType.Property: 4532 case ColumnModularizeType.Property:
4660 column.Modularize = Wix.Column.ModularizeType.Property; 4533 column.Modularize = Wix.Column.ModularizeType.Property;
4661 break; 4534 break;
4662 case ColumnModularizeType.SemicolonDelimited: 4535 case ColumnModularizeType.SemicolonDelimited:
4663 column.Modularize = Wix.Column.ModularizeType.SemicolonDelimited; 4536 column.Modularize = Wix.Column.ModularizeType.SemicolonDelimited;
4664 break; 4537 break;
4665 default: 4538 default:
4666 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnModularizationType, columnDefinition.ModularizeType.ToString())); 4539 throw new InvalidOperationException($"Unknown custom column modularization type '{columnDefinition.ModularizeType.ToString()}'.");
4667 } 4540 }
4668 } 4541 }
4669 4542
@@ -4686,22 +4559,22 @@ namespace WixToolset.Core.WindowsInstaller
4686 { 4559 {
4687 switch (columnDefinition.Type) 4560 switch (columnDefinition.Type)
4688 { 4561 {
4689 case ColumnType.Localized: 4562 case ColumnType.Localized:
4690 column.Localizable = Wix.YesNoType.yes; 4563 column.Localizable = Wix.YesNoType.yes;
4691 column.Type = Wix.Column.TypeType.@string; 4564 column.Type = Wix.Column.TypeType.@string;
4692 break; 4565 break;
4693 case ColumnType.Number: 4566 case ColumnType.Number:
4694 column.Type = Wix.Column.TypeType.@int; 4567 column.Type = Wix.Column.TypeType.@int;
4695 break; 4568 break;
4696 case ColumnType.Object: 4569 case ColumnType.Object:
4697 column.Type = Wix.Column.TypeType.binary; 4570 column.Type = Wix.Column.TypeType.binary;
4698 break; 4571 break;
4699 case ColumnType.Preserved: 4572 case ColumnType.Preserved:
4700 case ColumnType.String: 4573 case ColumnType.String:
4701 column.Type = Wix.Column.TypeType.@string; 4574 column.Type = Wix.Column.TypeType.@string;
4702 break; 4575 break;
4703 default: 4576 default:
4704 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnType, columnDefinition.Type.ToString())); 4577 throw new InvalidOperationException($"Unknown custom column type '{columnDefinition.Type.ToString()}'.");
4705 } 4578 }
4706 } 4579 }
4707 4580
@@ -4710,13 +4583,13 @@ namespace WixToolset.Core.WindowsInstaller
4710 customTable.AddChild(column); 4583 customTable.AddChild(column);
4711 } 4584 }
4712 4585
4713 foreach (Row row in table.Rows) 4586 foreach (var row in table.Rows)
4714 { 4587 {
4715 Wix.Row wixRow = new Wix.Row(); 4588 var wixRow = new Wix.Row();
4716 4589
4717 foreach (Field field in row.Fields) 4590 foreach (var field in row.Fields)
4718 { 4591 {
4719 Wix.Data data = new Wix.Data(); 4592 var data = new Wix.Data();
4720 4593
4721 data.Column = field.Column.Name; 4594 data.Column = field.Column.Name;
4722 4595
@@ -4738,20 +4611,20 @@ namespace WixToolset.Core.WindowsInstaller
4738 /// <param name="table">The table to decompile.</param> 4611 /// <param name="table">The table to decompile.</param>
4739 private void DecompileCreateFolderTable(Table table) 4612 private void DecompileCreateFolderTable(Table table)
4740 { 4613 {
4741 foreach (Row row in table.Rows) 4614 foreach (var row in table.Rows)
4742 { 4615 {
4743 Wix.CreateFolder createFolder = new Wix.CreateFolder(); 4616 var createFolder = new Wix.CreateFolder();
4744 4617
4745 createFolder.Directory = Convert.ToString(row[0]); 4618 createFolder.Directory = Convert.ToString(row[0]);
4746 4619
4747 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 4620 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
4748 if (null != component) 4621 if (null != component)
4749 { 4622 {
4750 component.AddChild(createFolder); 4623 component.AddChild(createFolder);
4751 } 4624 }
4752 else 4625 else
4753 { 4626 {
4754 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 4627 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
4755 } 4628 }
4756 this.core.IndexElement(row, createFolder); 4629 this.core.IndexElement(row, createFolder);
4757 } 4630 }
@@ -4763,13 +4636,13 @@ namespace WixToolset.Core.WindowsInstaller
4763 /// <param name="table">The table to decompile.</param> 4636 /// <param name="table">The table to decompile.</param>
4764 private void DecompileCustomActionTable(Table table) 4637 private void DecompileCustomActionTable(Table table)
4765 { 4638 {
4766 foreach (Row row in table.Rows) 4639 foreach (var row in table.Rows)
4767 { 4640 {
4768 Wix.CustomAction customAction = new Wix.CustomAction(); 4641 var customAction = new Wix.CustomAction();
4769 4642
4770 customAction.Id = Convert.ToString(row[0]); 4643 customAction.Id = Convert.ToString(row[0]);
4771 4644
4772 int type = Convert.ToInt32(row[1]); 4645 var type = Convert.ToInt32(row[1]);
4773 4646
4774 if (MsiInterop.MsidbCustomActionTypeHideTarget == (type & MsiInterop.MsidbCustomActionTypeHideTarget)) 4647 if (MsiInterop.MsidbCustomActionTypeHideTarget == (type & MsiInterop.MsidbCustomActionTypeHideTarget))
4775 { 4648 {
@@ -4793,126 +4666,126 @@ namespace WixToolset.Core.WindowsInstaller
4793 4666
4794 switch (type & MsiInterop.MsidbCustomActionTypeExecuteBits) 4667 switch (type & MsiInterop.MsidbCustomActionTypeExecuteBits)
4795 { 4668 {
4796 case 0: 4669 case 0:
4797 // this is the default value 4670 // this is the default value
4798 break; 4671 break;
4799 case MsiInterop.MsidbCustomActionTypeFirstSequence: 4672 case MsiInterop.MsidbCustomActionTypeFirstSequence:
4800 customAction.Execute = Wix.CustomAction.ExecuteType.firstSequence; 4673 customAction.Execute = Wix.CustomAction.ExecuteType.firstSequence;
4801 break; 4674 break;
4802 case MsiInterop.MsidbCustomActionTypeOncePerProcess: 4675 case MsiInterop.MsidbCustomActionTypeOncePerProcess:
4803 customAction.Execute = Wix.CustomAction.ExecuteType.oncePerProcess; 4676 customAction.Execute = Wix.CustomAction.ExecuteType.oncePerProcess;
4804 break; 4677 break;
4805 case MsiInterop.MsidbCustomActionTypeClientRepeat: 4678 case MsiInterop.MsidbCustomActionTypeClientRepeat:
4806 customAction.Execute = Wix.CustomAction.ExecuteType.secondSequence; 4679 customAction.Execute = Wix.CustomAction.ExecuteType.secondSequence;
4807 break; 4680 break;
4808 case MsiInterop.MsidbCustomActionTypeInScript: 4681 case MsiInterop.MsidbCustomActionTypeInScript:
4809 customAction.Execute = Wix.CustomAction.ExecuteType.deferred; 4682 customAction.Execute = Wix.CustomAction.ExecuteType.deferred;
4810 break; 4683 break;
4811 case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeRollback: 4684 case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeRollback:
4812 customAction.Execute = Wix.CustomAction.ExecuteType.rollback; 4685 customAction.Execute = Wix.CustomAction.ExecuteType.rollback;
4813 break; 4686 break;
4814 case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeCommit: 4687 case MsiInterop.MsidbCustomActionTypeInScript + MsiInterop.MsidbCustomActionTypeCommit:
4815 customAction.Execute = Wix.CustomAction.ExecuteType.commit; 4688 customAction.Execute = Wix.CustomAction.ExecuteType.commit;
4816 break; 4689 break;
4817 default: 4690 default:
4818 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 4691 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
4819 break; 4692 break;
4820 } 4693 }
4821 4694
4822 switch (type & MsiInterop.MsidbCustomActionTypeReturnBits) 4695 switch (type & MsiInterop.MsidbCustomActionTypeReturnBits)
4823 { 4696 {
4824 case 0: 4697 case 0:
4825 // this is the default value 4698 // this is the default value
4826 break; 4699 break;
4827 case MsiInterop.MsidbCustomActionTypeContinue: 4700 case MsiInterop.MsidbCustomActionTypeContinue:
4828 customAction.Return = Wix.CustomAction.ReturnType.ignore; 4701 customAction.Return = Wix.CustomAction.ReturnType.ignore;
4829 break; 4702 break;
4830 case MsiInterop.MsidbCustomActionTypeAsync: 4703 case MsiInterop.MsidbCustomActionTypeAsync:
4831 customAction.Return = Wix.CustomAction.ReturnType.asyncWait; 4704 customAction.Return = Wix.CustomAction.ReturnType.asyncWait;
4832 break; 4705 break;
4833 case MsiInterop.MsidbCustomActionTypeAsync + MsiInterop.MsidbCustomActionTypeContinue: 4706 case MsiInterop.MsidbCustomActionTypeAsync + MsiInterop.MsidbCustomActionTypeContinue:
4834 customAction.Return = Wix.CustomAction.ReturnType.asyncNoWait; 4707 customAction.Return = Wix.CustomAction.ReturnType.asyncNoWait;
4835 break; 4708 break;
4836 default: 4709 default:
4837 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 4710 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
4838 break; 4711 break;
4839 } 4712 }
4840 4713
4841 int source = type & MsiInterop.MsidbCustomActionTypeSourceBits; 4714 var source = type & MsiInterop.MsidbCustomActionTypeSourceBits;
4842 switch (source) 4715 switch (source)
4843 { 4716 {
4844 case MsiInterop.MsidbCustomActionTypeBinaryData: 4717 case MsiInterop.MsidbCustomActionTypeBinaryData:
4845 customAction.BinaryKey = Convert.ToString(row[2]); 4718 customAction.BinaryKey = Convert.ToString(row[2]);
4846 break; 4719 break;
4847 case MsiInterop.MsidbCustomActionTypeSourceFile: 4720 case MsiInterop.MsidbCustomActionTypeSourceFile:
4848 if (null != row[2]) 4721 if (null != row[2])
4849 { 4722 {
4850 customAction.FileKey = Convert.ToString(row[2]); 4723 customAction.FileKey = Convert.ToString(row[2]);
4851 } 4724 }
4852 break; 4725 break;
4853 case MsiInterop.MsidbCustomActionTypeDirectory: 4726 case MsiInterop.MsidbCustomActionTypeDirectory:
4854 if (null != row[2]) 4727 if (null != row[2])
4855 { 4728 {
4856 customAction.Directory = Convert.ToString(row[2]); 4729 customAction.Directory = Convert.ToString(row[2]);
4857 } 4730 }
4858 break; 4731 break;
4859 case MsiInterop.MsidbCustomActionTypeProperty: 4732 case MsiInterop.MsidbCustomActionTypeProperty:
4860 customAction.Property = Convert.ToString(row[2]); 4733 customAction.Property = Convert.ToString(row[2]);
4861 break; 4734 break;
4862 default: 4735 default:
4863 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 4736 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
4864 break; 4737 break;
4865 } 4738 }
4866 4739
4867 switch (type & MsiInterop.MsidbCustomActionTypeTargetBits) 4740 switch (type & MsiInterop.MsidbCustomActionTypeTargetBits)
4868 { 4741 {
4869 case MsiInterop.MsidbCustomActionTypeDll: 4742 case MsiInterop.MsidbCustomActionTypeDll:
4870 customAction.DllEntry = Convert.ToString(row[3]); 4743 customAction.DllEntry = Convert.ToString(row[3]);
4871 break; 4744 break;
4872 case MsiInterop.MsidbCustomActionTypeExe: 4745 case MsiInterop.MsidbCustomActionTypeExe:
4873 customAction.ExeCommand = Convert.ToString(row[3]); 4746 customAction.ExeCommand = Convert.ToString(row[3]);
4874 break; 4747 break;
4875 case MsiInterop.MsidbCustomActionTypeTextData: 4748 case MsiInterop.MsidbCustomActionTypeTextData:
4876 if (MsiInterop.MsidbCustomActionTypeSourceFile == source) 4749 if (MsiInterop.MsidbCustomActionTypeSourceFile == source)
4877 { 4750 {
4878 customAction.Error = Convert.ToString(row[3]); 4751 customAction.Error = Convert.ToString(row[3]);
4879 } 4752 }
4880 else 4753 else
4881 { 4754 {
4882 customAction.Value = Convert.ToString(row[3]); 4755 customAction.Value = Convert.ToString(row[3]);
4883 } 4756 }
4884 break; 4757 break;
4885 case MsiInterop.MsidbCustomActionTypeJScript: 4758 case MsiInterop.MsidbCustomActionTypeJScript:
4886 if (MsiInterop.MsidbCustomActionTypeDirectory == source) 4759 if (MsiInterop.MsidbCustomActionTypeDirectory == source)
4887 { 4760 {
4888 customAction.Script = Wix.CustomAction.ScriptType.jscript; 4761 customAction.Script = Wix.CustomAction.ScriptType.jscript;
4889 customAction.Content = Convert.ToString(row[3]); 4762 customAction.Content = Convert.ToString(row[3]);
4890 } 4763 }
4891 else 4764 else
4892 { 4765 {
4893 customAction.JScriptCall = Convert.ToString(row[3]); 4766 customAction.JScriptCall = Convert.ToString(row[3]);
4894 } 4767 }
4895 break; 4768 break;
4896 case MsiInterop.MsidbCustomActionTypeVBScript: 4769 case MsiInterop.MsidbCustomActionTypeVBScript:
4897 if (MsiInterop.MsidbCustomActionTypeDirectory == source) 4770 if (MsiInterop.MsidbCustomActionTypeDirectory == source)
4898 { 4771 {
4899 customAction.Script = Wix.CustomAction.ScriptType.vbscript; 4772 customAction.Script = Wix.CustomAction.ScriptType.vbscript;
4900 customAction.Content = Convert.ToString(row[3]); 4773 customAction.Content = Convert.ToString(row[3]);
4901 } 4774 }
4902 else 4775 else
4903 { 4776 {
4904 customAction.VBScriptCall = Convert.ToString(row[3]); 4777 customAction.VBScriptCall = Convert.ToString(row[3]);
4905 } 4778 }
4906 break; 4779 break;
4907 case MsiInterop.MsidbCustomActionTypeInstall: 4780 case MsiInterop.MsidbCustomActionTypeInstall:
4908 this.core.OnMessage(WixWarnings.NestedInstall(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 4781 this.Messaging.Write(WarningMessages.NestedInstall(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
4909 continue; 4782 continue;
4910 default: 4783 default:
4911 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 4784 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
4912 break; 4785 break;
4913 } 4786 }
4914 4787
4915 int extype = 4 < row.Fields.Length && null != row[4] ? Convert.ToInt32(row[4]) : 0; 4788 var extype = 4 < row.Fields.Length && null != row[4] ? Convert.ToInt32(row[4]) : 0;
4916 if (MsiInterop.MsidbCustomActionTypePatchUninstall == (extype & MsiInterop.MsidbCustomActionTypePatchUninstall)) 4789 if (MsiInterop.MsidbCustomActionTypePatchUninstall == (extype & MsiInterop.MsidbCustomActionTypePatchUninstall))
4917 { 4790 {
4918 customAction.PatchUninstall = Wix.YesNoType.yes; 4791 customAction.PatchUninstall = Wix.YesNoType.yes;
@@ -4929,9 +4802,9 @@ namespace WixToolset.Core.WindowsInstaller
4929 /// <param name="table">The table to decompile.</param> 4802 /// <param name="table">The table to decompile.</param>
4930 private void DecompileCompLocatorTable(Table table) 4803 private void DecompileCompLocatorTable(Table table)
4931 { 4804 {
4932 foreach (Row row in table.Rows) 4805 foreach (var row in table.Rows)
4933 { 4806 {
4934 Wix.ComponentSearch componentSearch = new Wix.ComponentSearch(); 4807 var componentSearch = new Wix.ComponentSearch();
4935 4808
4936 componentSearch.Id = Convert.ToString(row[0]); 4809 componentSearch.Id = Convert.ToString(row[0]);
4937 4810
@@ -4941,15 +4814,15 @@ namespace WixToolset.Core.WindowsInstaller
4941 { 4814 {
4942 switch (Convert.ToInt32(row[2])) 4815 switch (Convert.ToInt32(row[2]))
4943 { 4816 {
4944 case MsiInterop.MsidbLocatorTypeDirectory: 4817 case MsiInterop.MsidbLocatorTypeDirectory:
4945 componentSearch.Type = Wix.ComponentSearch.TypeType.directory; 4818 componentSearch.Type = Wix.ComponentSearch.TypeType.directory;
4946 break; 4819 break;
4947 case MsiInterop.MsidbLocatorTypeFileName: 4820 case MsiInterop.MsidbLocatorTypeFileName:
4948 // this is the default value 4821 // this is the default value
4949 break; 4822 break;
4950 default: 4823 default:
4951 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2])); 4824 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2]));
4952 break; 4825 break;
4953 } 4826 }
4954 } 4827 }
4955 4828
@@ -4963,11 +4836,11 @@ namespace WixToolset.Core.WindowsInstaller
4963 /// <param name="table">The table to decompile.</param> 4836 /// <param name="table">The table to decompile.</param>
4964 private void DecompileComplusTable(Table table) 4837 private void DecompileComplusTable(Table table)
4965 { 4838 {
4966 foreach (Row row in table.Rows) 4839 foreach (var row in table.Rows)
4967 { 4840 {
4968 if (null != row[1]) 4841 if (null != row[1])
4969 { 4842 {
4970 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0])); 4843 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[0]));
4971 4844
4972 if (null != component) 4845 if (null != component)
4973 { 4846 {
@@ -4975,7 +4848,7 @@ namespace WixToolset.Core.WindowsInstaller
4975 } 4848 }
4976 else 4849 else
4977 { 4850 {
4978 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[0]), "Component")); 4851 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[0]), "Component"));
4979 } 4852 }
4980 } 4853 }
4981 } 4854 }
@@ -4987,15 +4860,15 @@ namespace WixToolset.Core.WindowsInstaller
4987 /// <param name="table">The table to decompile.</param> 4860 /// <param name="table">The table to decompile.</param>
4988 private void DecompileComponentTable(Table table) 4861 private void DecompileComponentTable(Table table)
4989 { 4862 {
4990 foreach (Row row in table.Rows) 4863 foreach (var row in table.Rows)
4991 { 4864 {
4992 Wix.Component component = new Wix.Component(); 4865 var component = new Wix.Component();
4993 4866
4994 component.Id = Convert.ToString(row[0]); 4867 component.Id = Convert.ToString(row[0]);
4995 4868
4996 component.Guid = Convert.ToString(row[1]); 4869 component.Guid = Convert.ToString(row[1]);
4997 4870
4998 int attributes = Convert.ToInt32(row[3]); 4871 var attributes = Convert.ToInt32(row[3]);
4999 4872
5000 if (MsiInterop.MsidbComponentAttributesSourceOnly == (attributes & MsiInterop.MsidbComponentAttributesSourceOnly)) 4873 if (MsiInterop.MsidbComponentAttributesSourceOnly == (attributes & MsiInterop.MsidbComponentAttributesSourceOnly))
5001 { 4874 {
@@ -5048,21 +4921,21 @@ namespace WixToolset.Core.WindowsInstaller
5048 4921
5049 if (null != row[4]) 4922 if (null != row[4])
5050 { 4923 {
5051 Wix.Condition condition = new Wix.Condition(); 4924 var condition = new Wix.Condition();
5052 4925
5053 condition.Content = Convert.ToString(row[4]); 4926 condition.Content = Convert.ToString(row[4]);
5054 4927
5055 component.AddChild(condition); 4928 component.AddChild(condition);
5056 } 4929 }
5057 4930
5058 Wix.Directory directory = (Wix.Directory)this.core.GetIndexedElement("Directory", Convert.ToString(row[2])); 4931 var directory = (Wix.Directory)this.core.GetIndexedElement("Directory", Convert.ToString(row[2]));
5059 if (null != directory) 4932 if (null != directory)
5060 { 4933 {
5061 directory.AddChild(component); 4934 directory.AddChild(component);
5062 } 4935 }
5063 else 4936 else
5064 { 4937 {
5065 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Directory_", Convert.ToString(row[2]), "Directory")); 4938 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Directory_", Convert.ToString(row[2]), "Directory"));
5066 } 4939 }
5067 this.core.IndexElement(row, component); 4940 this.core.IndexElement(row, component);
5068 } 4941 }
@@ -5074,9 +4947,9 @@ namespace WixToolset.Core.WindowsInstaller
5074 /// <param name="table">The table to decompile.</param> 4947 /// <param name="table">The table to decompile.</param>
5075 private void DecompileConditionTable(Table table) 4948 private void DecompileConditionTable(Table table)
5076 { 4949 {
5077 foreach (Row row in table.Rows) 4950 foreach (var row in table.Rows)
5078 { 4951 {
5079 Wix.Condition condition = new Wix.Condition(); 4952 var condition = new Wix.Condition();
5080 4953
5081 condition.Level = Convert.ToInt32(row[1]); 4954 condition.Level = Convert.ToInt32(row[1]);
5082 4955
@@ -5085,14 +4958,14 @@ namespace WixToolset.Core.WindowsInstaller
5085 condition.Content = Convert.ToString(row[2]); 4958 condition.Content = Convert.ToString(row[2]);
5086 } 4959 }
5087 4960
5088 Wix.Feature feature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0])); 4961 var feature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0]));
5089 if (null != feature) 4962 if (null != feature)
5090 { 4963 {
5091 feature.AddChild(condition); 4964 feature.AddChild(condition);
5092 } 4965 }
5093 else 4966 else
5094 { 4967 {
5095 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_", Convert.ToString(row[0]), "Feature")); 4968 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_", Convert.ToString(row[0]), "Feature"));
5096 } 4969 }
5097 } 4970 }
5098 } 4971 }
@@ -5103,9 +4976,9 @@ namespace WixToolset.Core.WindowsInstaller
5103 /// <param name="table">The table to decompile.</param> 4976 /// <param name="table">The table to decompile.</param>
5104 private void DecompileDialogTable(Table table) 4977 private void DecompileDialogTable(Table table)
5105 { 4978 {
5106 foreach (Row row in table.Rows) 4979 foreach (var row in table.Rows)
5107 { 4980 {
5108 Wix.Dialog dialog = new Wix.Dialog(); 4981 var dialog = new Wix.Dialog();
5109 4982
5110 dialog.Id = Convert.ToString(row[0]); 4983 dialog.Id = Convert.ToString(row[0]);
5111 4984
@@ -5119,7 +4992,7 @@ namespace WixToolset.Core.WindowsInstaller
5119 4992
5120 if (null != row[5]) 4993 if (null != row[5])
5121 { 4994 {
5122 int attributes = Convert.ToInt32(row[5]); 4995 var attributes = Convert.ToInt32(row[5]);
5123 4996
5124 if (0 == (attributes & MsiInterop.MsidbDialogAttributesVisible)) 4997 if (0 == (attributes & MsiInterop.MsidbDialogAttributesVisible))
5125 { 4998 {
@@ -5193,17 +5066,17 @@ namespace WixToolset.Core.WindowsInstaller
5193 /// <param name="table">The table to decompile.</param> 5066 /// <param name="table">The table to decompile.</param>
5194 private void DecompileDirectoryTable(Table table) 5067 private void DecompileDirectoryTable(Table table)
5195 { 5068 {
5196 foreach (Row row in table.Rows) 5069 foreach (var row in table.Rows)
5197 { 5070 {
5198 Wix.Directory directory = new Wix.Directory(); 5071 var directory = new Wix.Directory();
5199 5072
5200 directory.Id = Convert.ToString(row[0]); 5073 directory.Id = Convert.ToString(row[0]);
5201 5074
5202 string[] names = Common.GetNames(Convert.ToString(row[2])); 5075 var names = Common.GetNames(Convert.ToString(row[2]));
5203 5076
5204 if (String.Equals(directory.Id, "TARGETDIR", StringComparison.Ordinal) && !String.Equals(names[0], "SourceDir", StringComparison.Ordinal)) 5077 if (String.Equals(directory.Id, "TARGETDIR", StringComparison.Ordinal) && !String.Equals(names[0], "SourceDir", StringComparison.Ordinal))
5205 { 5078 {
5206 this.core.OnMessage(WixWarnings.TargetDirCorrectedDefaultDir()); 5079 this.Messaging.Write(WarningMessages.TargetDirCorrectedDefaultDir());
5207 directory.Name = "SourceDir"; 5080 directory.Name = "SourceDir";
5208 } 5081 }
5209 else 5082 else
@@ -5247,9 +5120,9 @@ namespace WixToolset.Core.WindowsInstaller
5247 } 5120 }
5248 5121
5249 // nest the directories 5122 // nest the directories
5250 foreach (Row row in table.Rows) 5123 foreach (var row in table.Rows)
5251 { 5124 {
5252 Wix.Directory directory = (Wix.Directory)this.core.GetIndexedElement(row); 5125 var directory = (Wix.Directory)this.core.GetIndexedElement(row);
5253 5126
5254 if (null == row[1]) 5127 if (null == row[1])
5255 { 5128 {
@@ -5257,11 +5130,11 @@ namespace WixToolset.Core.WindowsInstaller
5257 } 5130 }
5258 else 5131 else
5259 { 5132 {
5260 Wix.Directory parentDirectory = (Wix.Directory)this.core.GetIndexedElement("Directory", Convert.ToString(row[1])); 5133 var parentDirectory = (Wix.Directory)this.core.GetIndexedElement("Directory", Convert.ToString(row[1]));
5261 5134
5262 if (null == parentDirectory) 5135 if (null == parentDirectory)
5263 { 5136 {
5264 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Directory_Parent", Convert.ToString(row[1]), "Directory")); 5137 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Directory_Parent", Convert.ToString(row[1]), "Directory"));
5265 } 5138 }
5266 else if (parentDirectory == directory) // another way to specify a root directory 5139 else if (parentDirectory == directory) // another way to specify a root directory
5267 { 5140 {
@@ -5281,9 +5154,9 @@ namespace WixToolset.Core.WindowsInstaller
5281 /// <param name="table">The table to decompile.</param> 5154 /// <param name="table">The table to decompile.</param>
5282 private void DecompileDrLocatorTable(Table table) 5155 private void DecompileDrLocatorTable(Table table)
5283 { 5156 {
5284 foreach (Row row in table.Rows) 5157 foreach (var row in table.Rows)
5285 { 5158 {
5286 Wix.DirectorySearch directorySearch = new Wix.DirectorySearch(); 5159 var directorySearch = new Wix.DirectorySearch();
5287 5160
5288 directorySearch.Id = Convert.ToString(row[0]); 5161 directorySearch.Id = Convert.ToString(row[0]);
5289 5162
@@ -5307,9 +5180,9 @@ namespace WixToolset.Core.WindowsInstaller
5307 /// <param name="table">The table to decompile.</param> 5180 /// <param name="table">The table to decompile.</param>
5308 private void DecompileDuplicateFileTable(Table table) 5181 private void DecompileDuplicateFileTable(Table table)
5309 { 5182 {
5310 foreach (Row row in table.Rows) 5183 foreach (var row in table.Rows)
5311 { 5184 {
5312 Wix.CopyFile copyFile = new Wix.CopyFile(); 5185 var copyFile = new Wix.CopyFile();
5313 5186
5314 copyFile.Id = Convert.ToString(row[0]); 5187 copyFile.Id = Convert.ToString(row[0]);
5315 5188
@@ -5317,7 +5190,7 @@ namespace WixToolset.Core.WindowsInstaller
5317 5190
5318 if (null != row[3]) 5191 if (null != row[3])
5319 { 5192 {
5320 string[] names = Common.GetNames(Convert.ToString(row[3])); 5193 var names = Common.GetNames(Convert.ToString(row[3]));
5321 if (null != names[0] && null != names[1]) 5194 if (null != names[0] && null != names[1])
5322 { 5195 {
5323 copyFile.DestinationShortName = names[0]; 5196 copyFile.DestinationShortName = names[0];
@@ -5331,14 +5204,14 @@ namespace WixToolset.Core.WindowsInstaller
5331 5204
5332 // destination directory/property is set in FinalizeDuplicateMoveFileTables 5205 // destination directory/property is set in FinalizeDuplicateMoveFileTables
5333 5206
5334 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 5207 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
5335 if (null != component) 5208 if (null != component)
5336 { 5209 {
5337 component.AddChild(copyFile); 5210 component.AddChild(copyFile);
5338 } 5211 }
5339 else 5212 else
5340 { 5213 {
5341 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 5214 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
5342 } 5215 }
5343 this.core.IndexElement(row, copyFile); 5216 this.core.IndexElement(row, copyFile);
5344 } 5217 }
@@ -5350,38 +5223,38 @@ namespace WixToolset.Core.WindowsInstaller
5350 /// <param name="table">The table to decompile.</param> 5223 /// <param name="table">The table to decompile.</param>
5351 private void DecompileEnvironmentTable(Table table) 5224 private void DecompileEnvironmentTable(Table table)
5352 { 5225 {
5353 foreach (Row row in table.Rows) 5226 foreach (var row in table.Rows)
5354 { 5227 {
5355 Wix.Environment environment = new Wix.Environment(); 5228 var environment = new Wix.Environment();
5356 5229
5357 environment.Id = Convert.ToString(row[0]); 5230 environment.Id = Convert.ToString(row[0]);
5358 5231
5359 bool done = false; 5232 var done = false;
5360 bool permanent = true; 5233 var permanent = true;
5361 string name = Convert.ToString(row[1]); 5234 var name = Convert.ToString(row[1]);
5362 for (int i = 0; i < name.Length && !done; i++) 5235 for (var i = 0; i < name.Length && !done; i++)
5363 { 5236 {
5364 switch (name[i]) 5237 switch (name[i])
5365 { 5238 {
5366 case '=': 5239 case '=':
5367 environment.Action = Wix.Environment.ActionType.set; 5240 environment.Action = Wix.Environment.ActionType.set;
5368 break; 5241 break;
5369 case '+': 5242 case '+':
5370 environment.Action = Wix.Environment.ActionType.create; 5243 environment.Action = Wix.Environment.ActionType.create;
5371 break; 5244 break;
5372 case '-': 5245 case '-':
5373 permanent = false; 5246 permanent = false;
5374 break; 5247 break;
5375 case '!': 5248 case '!':
5376 environment.Action = Wix.Environment.ActionType.remove; 5249 environment.Action = Wix.Environment.ActionType.remove;
5377 break; 5250 break;
5378 case '*': 5251 case '*':
5379 environment.System = Wix.YesNoType.yes; 5252 environment.System = Wix.YesNoType.yes;
5380 break; 5253 break;
5381 default: 5254 default:
5382 environment.Name = name.Substring(i); 5255 environment.Name = name.Substring(i);
5383 done = true; 5256 done = true;
5384 break; 5257 break;
5385 } 5258 }
5386 } 5259 }
5387 5260
@@ -5392,7 +5265,7 @@ namespace WixToolset.Core.WindowsInstaller
5392 5265
5393 if (null != row[2]) 5266 if (null != row[2])
5394 { 5267 {
5395 string value = Convert.ToString(row[2]); 5268 var value = Convert.ToString(row[2]);
5396 5269
5397 if (value.StartsWith("[~]", StringComparison.Ordinal)) 5270 if (value.StartsWith("[~]", StringComparison.Ordinal))
5398 { 5271 {
@@ -5420,14 +5293,14 @@ namespace WixToolset.Core.WindowsInstaller
5420 } 5293 }
5421 } 5294 }
5422 5295
5423 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[3])); 5296 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[3]));
5424 if (null != component) 5297 if (null != component)
5425 { 5298 {
5426 component.AddChild(environment); 5299 component.AddChild(environment);
5427 } 5300 }
5428 else 5301 else
5429 { 5302 {
5430 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[3]), "Component")); 5303 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[3]), "Component"));
5431 } 5304 }
5432 } 5305 }
5433 } 5306 }
@@ -5438,9 +5311,9 @@ namespace WixToolset.Core.WindowsInstaller
5438 /// <param name="table">The table to decompile.</param> 5311 /// <param name="table">The table to decompile.</param>
5439 private void DecompileErrorTable(Table table) 5312 private void DecompileErrorTable(Table table)
5440 { 5313 {
5441 foreach (Row row in table.Rows) 5314 foreach (var row in table.Rows)
5442 { 5315 {
5443 Wix.Error error = new Wix.Error(); 5316 var error = new Wix.Error();
5444 5317
5445 error.Id = Convert.ToInt32(row[0]); 5318 error.Id = Convert.ToInt32(row[0]);
5446 5319
@@ -5456,22 +5329,22 @@ namespace WixToolset.Core.WindowsInstaller
5456 /// <param name="table">The table to decompile.</param> 5329 /// <param name="table">The table to decompile.</param>
5457 private void DecompileEventMappingTable(Table table) 5330 private void DecompileEventMappingTable(Table table)
5458 { 5331 {
5459 foreach (Row row in table.Rows) 5332 foreach (var row in table.Rows)
5460 { 5333 {
5461 Wix.Subscribe subscribe = new Wix.Subscribe(); 5334 var subscribe = new Wix.Subscribe();
5462 5335
5463 subscribe.Event = Convert.ToString(row[2]); 5336 subscribe.Event = Convert.ToString(row[2]);
5464 5337
5465 subscribe.Attribute = Convert.ToString(row[3]); 5338 subscribe.Attribute = Convert.ToString(row[3]);
5466 5339
5467 Wix.Control control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1])); 5340 var control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1]));
5468 if (null != control) 5341 if (null != control)
5469 { 5342 {
5470 control.AddChild(subscribe); 5343 control.AddChild(subscribe);
5471 } 5344 }
5472 else 5345 else
5473 { 5346 {
5474 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control")); 5347 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Dialog_", Convert.ToString(row[0]), "Control_", Convert.ToString(row[1]), "Control"));
5475 } 5348 }
5476 } 5349 }
5477 } 5350 }
@@ -5482,9 +5355,9 @@ namespace WixToolset.Core.WindowsInstaller
5482 /// <param name="table">The table to decompile.</param> 5355 /// <param name="table">The table to decompile.</param>
5483 private void DecompileExtensionTable(Table table) 5356 private void DecompileExtensionTable(Table table)
5484 { 5357 {
5485 foreach (Row row in table.Rows) 5358 foreach (var row in table.Rows)
5486 { 5359 {
5487 Wix.Extension extension = new Wix.Extension(); 5360 var extension = new Wix.Extension();
5488 5361
5489 extension.Advertise = Wix.YesNoType.yes; 5362 extension.Advertise = Wix.YesNoType.yes;
5490 5363
@@ -5492,7 +5365,7 @@ namespace WixToolset.Core.WindowsInstaller
5492 5365
5493 if (null != row[3]) 5366 if (null != row[3])
5494 { 5367 {
5495 Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement("MIME", Convert.ToString(row[3])); 5368 var mime = (Wix.MIME)this.core.GetIndexedElement("MIME", Convert.ToString(row[3]));
5496 5369
5497 if (null != mime) 5370 if (null != mime)
5498 { 5371 {
@@ -5500,13 +5373,13 @@ namespace WixToolset.Core.WindowsInstaller
5500 } 5373 }
5501 else 5374 else
5502 { 5375 {
5503 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "MIME_", Convert.ToString(row[3]), "MIME")); 5376 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "MIME_", Convert.ToString(row[3]), "MIME"));
5504 } 5377 }
5505 } 5378 }
5506 5379
5507 if (null != row[2]) 5380 if (null != row[2])
5508 { 5381 {
5509 Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[2])); 5382 var progId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[2]));
5510 5383
5511 if (null != progId) 5384 if (null != progId)
5512 { 5385 {
@@ -5514,12 +5387,12 @@ namespace WixToolset.Core.WindowsInstaller
5514 } 5387 }
5515 else 5388 else
5516 { 5389 {
5517 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_", Convert.ToString(row[2]), "ProgId")); 5390 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_", Convert.ToString(row[2]), "ProgId"));
5518 } 5391 }
5519 } 5392 }
5520 else 5393 else
5521 { 5394 {
5522 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 5395 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
5523 5396
5524 if (null != component) 5397 if (null != component)
5525 { 5398 {
@@ -5527,7 +5400,7 @@ namespace WixToolset.Core.WindowsInstaller
5527 } 5400 }
5528 else 5401 else
5529 { 5402 {
5530 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 5403 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
5531 } 5404 }
5532 } 5405 }
5533 5406
@@ -5541,9 +5414,9 @@ namespace WixToolset.Core.WindowsInstaller
5541 /// <param name="table">The table to decompile.</param> 5414 /// <param name="table">The table to decompile.</param>
5542 private void DecompileExternalFilesTable(Table table) 5415 private void DecompileExternalFilesTable(Table table)
5543 { 5416 {
5544 foreach (Row row in table.Rows) 5417 foreach (var row in table.Rows)
5545 { 5418 {
5546 Wix.ExternalFile externalFile = new Wix.ExternalFile(); 5419 var externalFile = new Wix.ExternalFile();
5547 5420
5548 externalFile.File = Convert.ToString(row[1]); 5421 externalFile.File = Convert.ToString(row[1]);
5549 5422
@@ -5551,11 +5424,11 @@ namespace WixToolset.Core.WindowsInstaller
5551 5424
5552 if (null != row[3]) 5425 if (null != row[3])
5553 { 5426 {
5554 string[] symbolPaths = (Convert.ToString(row[3])).Split(';'); 5427 var symbolPaths = (Convert.ToString(row[3])).Split(';');
5555 5428
5556 foreach (string symbolPathString in symbolPaths) 5429 foreach (var symbolPathString in symbolPaths)
5557 { 5430 {
5558 Wix.SymbolPath symbolPath = new Wix.SymbolPath(); 5431 var symbolPath = new Wix.SymbolPath();
5559 5432
5560 symbolPath.Path = symbolPathString; 5433 symbolPath.Path = symbolPathString;
5561 5434
@@ -5565,14 +5438,14 @@ namespace WixToolset.Core.WindowsInstaller
5565 5438
5566 if (null != row[4] && null != row[5]) 5439 if (null != row[4] && null != row[5])
5567 { 5440 {
5568 string[] ignoreOffsets = (Convert.ToString(row[4])).Split(','); 5441 var ignoreOffsets = (Convert.ToString(row[4])).Split(',');
5569 string[] ignoreLengths = (Convert.ToString(row[5])).Split(','); 5442 var ignoreLengths = (Convert.ToString(row[5])).Split(',');
5570 5443
5571 if (ignoreOffsets.Length == ignoreLengths.Length) 5444 if (ignoreOffsets.Length == ignoreLengths.Length)
5572 { 5445 {
5573 for (int i = 0; i < ignoreOffsets.Length; i++) 5446 for (var i = 0; i < ignoreOffsets.Length; i++)
5574 { 5447 {
5575 Wix.IgnoreRange ignoreRange = new Wix.IgnoreRange(); 5448 var ignoreRange = new Wix.IgnoreRange();
5576 5449
5577 if (ignoreOffsets[i].StartsWith("0x", StringComparison.Ordinal)) 5450 if (ignoreOffsets[i].StartsWith("0x", StringComparison.Ordinal))
5578 { 5451 {
@@ -5612,14 +5485,14 @@ namespace WixToolset.Core.WindowsInstaller
5612 externalFile.Order = Convert.ToInt32(row[7]); 5485 externalFile.Order = Convert.ToInt32(row[7]);
5613 } 5486 }
5614 5487
5615 Wix.Family family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[0])); 5488 var family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[0]));
5616 if (null != family) 5489 if (null != family)
5617 { 5490 {
5618 family.AddChild(externalFile); 5491 family.AddChild(externalFile);
5619 } 5492 }
5620 else 5493 else
5621 { 5494 {
5622 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[0]), "ImageFamilies")); 5495 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[0]), "ImageFamilies"));
5623 } 5496 }
5624 this.core.IndexElement(row, externalFile); 5497 this.core.IndexElement(row, externalFile);
5625 } 5498 }
@@ -5631,11 +5504,11 @@ namespace WixToolset.Core.WindowsInstaller
5631 /// <param name="table">The table to decompile.</param> 5504 /// <param name="table">The table to decompile.</param>
5632 private void DecompileFeatureTable(Table table) 5505 private void DecompileFeatureTable(Table table)
5633 { 5506 {
5634 SortedList sortedFeatures = new SortedList(); 5507 var sortedFeatures = new SortedList();
5635 5508
5636 foreach (Row row in table.Rows) 5509 foreach (var row in table.Rows)
5637 { 5510 {
5638 Wix.Feature feature = new Wix.Feature(); 5511 var feature = new Wix.Feature();
5639 5512
5640 feature.Id = Convert.ToString(row[0]); 5513 feature.Id = Convert.ToString(row[0]);
5641 5514
@@ -5655,7 +5528,7 @@ namespace WixToolset.Core.WindowsInstaller
5655 } 5528 }
5656 else 5529 else
5657 { 5530 {
5658 int display = Convert.ToInt32(row[4]); 5531 var display = Convert.ToInt32(row[4]);
5659 5532
5660 if (0 == display) 5533 if (0 == display)
5661 { 5534 {
@@ -5674,7 +5547,7 @@ namespace WixToolset.Core.WindowsInstaller
5674 feature.ConfigurableDirectory = Convert.ToString(row[6]); 5547 feature.ConfigurableDirectory = Convert.ToString(row[6]);
5675 } 5548 }
5676 5549
5677 int attributes = Convert.ToInt32(row[7]); 5550 var attributes = Convert.ToInt32(row[7]);
5678 5551
5679 if (MsiInterop.MsidbFeatureAttributesFavorSource == (attributes & MsiInterop.MsidbFeatureAttributesFavorSource) && MsiInterop.MsidbFeatureAttributesFollowParent == (attributes & MsiInterop.MsidbFeatureAttributesFollowParent)) 5552 if (MsiInterop.MsidbFeatureAttributesFavorSource == (attributes & MsiInterop.MsidbFeatureAttributesFavorSource) && MsiInterop.MsidbFeatureAttributesFollowParent == (attributes & MsiInterop.MsidbFeatureAttributesFollowParent))
5680 { 5553 {
@@ -5697,7 +5570,7 @@ namespace WixToolset.Core.WindowsInstaller
5697 if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise) && 5570 if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise) &&
5698 MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise)) 5571 MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise))
5699 { 5572 {
5700 this.core.OnMessage(WixWarnings.InvalidAttributeCombination(row.SourceLineNumbers, "msidbFeatureAttributesDisallowAdvertise", "msidbFeatureAttributesNoUnsupportedAdvertise", "Feature.AllowAdvertiseType", "no")); 5573 this.Messaging.Write(WarningMessages.InvalidAttributeCombination(row.SourceLineNumbers, "msidbFeatureAttributesDisallowAdvertise", "msidbFeatureAttributesNoUnsupportedAdvertise", "Feature.AllowAdvertiseType", "no"));
5701 feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no; 5574 feature.AllowAdvertise = Wix.Feature.AllowAdvertiseType.no;
5702 } 5575 }
5703 else if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise)) 5576 else if (MsiInterop.MsidbFeatureAttributesDisallowAdvertise == (attributes & MsiInterop.MsidbFeatureAttributesDisallowAdvertise))
@@ -5723,7 +5596,7 @@ namespace WixToolset.Core.WindowsInstaller
5723 // nest the features 5596 // nest the features
5724 foreach (Row row in sortedFeatures.Values) 5597 foreach (Row row in sortedFeatures.Values)
5725 { 5598 {
5726 Wix.Feature feature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0])); 5599 var feature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0]));
5727 5600
5728 if (null == row[1]) 5601 if (null == row[1])
5729 { 5602 {
@@ -5731,11 +5604,11 @@ namespace WixToolset.Core.WindowsInstaller
5731 } 5604 }
5732 else 5605 else
5733 { 5606 {
5734 Wix.Feature parentFeature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[1])); 5607 var parentFeature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[1]));
5735 5608
5736 if (null == parentFeature) 5609 if (null == parentFeature)
5737 { 5610 {
5738 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_Parent", Convert.ToString(row[1]), "Feature")); 5611 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_Parent", Convert.ToString(row[1]), "Feature"));
5739 } 5612 }
5740 else if (parentFeature == feature) 5613 else if (parentFeature == feature)
5741 { 5614 {
@@ -5755,20 +5628,20 @@ namespace WixToolset.Core.WindowsInstaller
5755 /// <param name="table">The table to decompile.</param> 5628 /// <param name="table">The table to decompile.</param>
5756 private void DecompileFeatureComponentsTable(Table table) 5629 private void DecompileFeatureComponentsTable(Table table)
5757 { 5630 {
5758 foreach (Row row in table.Rows) 5631 foreach (var row in table.Rows)
5759 { 5632 {
5760 Wix.ComponentRef componentRef = new Wix.ComponentRef(); 5633 var componentRef = new Wix.ComponentRef();
5761 5634
5762 componentRef.Id = Convert.ToString(row[1]); 5635 componentRef.Id = Convert.ToString(row[1]);
5763 5636
5764 Wix.Feature parentFeature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0])); 5637 var parentFeature = (Wix.Feature)this.core.GetIndexedElement("Feature", Convert.ToString(row[0]));
5765 if (null != parentFeature) 5638 if (null != parentFeature)
5766 { 5639 {
5767 parentFeature.AddChild(componentRef); 5640 parentFeature.AddChild(componentRef);
5768 } 5641 }
5769 else 5642 else
5770 { 5643 {
5771 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_", Convert.ToString(row[0]), "Feature")); 5644 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Feature_", Convert.ToString(row[0]), "Feature"));
5772 } 5645 }
5773 this.core.IndexElement(row, componentRef); 5646 this.core.IndexElement(row, componentRef);
5774 } 5647 }
@@ -5782,11 +5655,11 @@ namespace WixToolset.Core.WindowsInstaller
5782 { 5655 {
5783 foreach (FileRow fileRow in table.Rows) 5656 foreach (FileRow fileRow in table.Rows)
5784 { 5657 {
5785 Wix.File file = new Wix.File(); 5658 var file = new Wix.File();
5786 5659
5787 file.Id = fileRow.File; 5660 file.Id = fileRow.File;
5788 5661
5789 string[] names = Common.GetNames(fileRow.FileName); 5662 var names = Common.GetNames(fileRow.FileName);
5790 if (null != names[0] && null != names[1]) 5663 if (null != names[0] && null != names[1])
5791 { 5664 {
5792 file.ShortName = names[0]; 5665 file.ShortName = names[0];
@@ -5854,20 +5727,20 @@ namespace WixToolset.Core.WindowsInstaller
5854 /// <param name="table">The table to decompile.</param> 5727 /// <param name="table">The table to decompile.</param>
5855 private void DecompileFileSFPCatalogTable(Table table) 5728 private void DecompileFileSFPCatalogTable(Table table)
5856 { 5729 {
5857 foreach (Row row in table.Rows) 5730 foreach (var row in table.Rows)
5858 { 5731 {
5859 Wix.SFPFile sfpFile = new Wix.SFPFile(); 5732 var sfpFile = new Wix.SFPFile();
5860 5733
5861 sfpFile.Id = Convert.ToString(row[0]); 5734 sfpFile.Id = Convert.ToString(row[0]);
5862 5735
5863 Wix.SFPCatalog sfpCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement("SFPCatalog", Convert.ToString(row[1])); 5736 var sfpCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement("SFPCatalog", Convert.ToString(row[1]));
5864 if (null != sfpCatalog) 5737 if (null != sfpCatalog)
5865 { 5738 {
5866 sfpCatalog.AddChild(sfpFile); 5739 sfpCatalog.AddChild(sfpFile);
5867 } 5740 }
5868 else 5741 else
5869 { 5742 {
5870 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "SFPCatalog_", Convert.ToString(row[1]), "SFPCatalog")); 5743 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "SFPCatalog_", Convert.ToString(row[1]), "SFPCatalog"));
5871 } 5744 }
5872 } 5745 }
5873 } 5746 }
@@ -5878,9 +5751,9 @@ namespace WixToolset.Core.WindowsInstaller
5878 /// <param name="table">The table to decompile.</param> 5751 /// <param name="table">The table to decompile.</param>
5879 private void DecompileFontTable(Table table) 5752 private void DecompileFontTable(Table table)
5880 { 5753 {
5881 foreach (Row row in table.Rows) 5754 foreach (var row in table.Rows)
5882 { 5755 {
5883 Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0])); 5756 var file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0]));
5884 5757
5885 if (null != file) 5758 if (null != file)
5886 { 5759 {
@@ -5895,7 +5768,7 @@ namespace WixToolset.Core.WindowsInstaller
5895 } 5768 }
5896 else 5769 else
5897 { 5770 {
5898 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File")); 5771 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File"));
5899 } 5772 }
5900 } 5773 }
5901 } 5774 }
@@ -5906,9 +5779,9 @@ namespace WixToolset.Core.WindowsInstaller
5906 /// <param name="table">The table to decompile.</param> 5779 /// <param name="table">The table to decompile.</param>
5907 private void DecompileIconTable(Table table) 5780 private void DecompileIconTable(Table table)
5908 { 5781 {
5909 foreach (Row row in table.Rows) 5782 foreach (var row in table.Rows)
5910 { 5783 {
5911 Wix.Icon icon = new Wix.Icon(); 5784 var icon = new Wix.Icon();
5912 5785
5913 icon.Id = Convert.ToString(row[0]); 5786 icon.Id = Convert.ToString(row[0]);
5914 5787
@@ -5924,9 +5797,9 @@ namespace WixToolset.Core.WindowsInstaller
5924 /// <param name="table">The table to decompile.</param> 5797 /// <param name="table">The table to decompile.</param>
5925 private void DecompileImageFamiliesTable(Table table) 5798 private void DecompileImageFamiliesTable(Table table)
5926 { 5799 {
5927 foreach (Row row in table.Rows) 5800 foreach (var row in table.Rows)
5928 { 5801 {
5929 Wix.Family family = new Wix.Family(); 5802 var family = new Wix.Family();
5930 5803
5931 family.Name = Convert.ToString(row[0]); 5804 family.Name = Convert.ToString(row[0]);
5932 5805
@@ -5966,13 +5839,13 @@ namespace WixToolset.Core.WindowsInstaller
5966 /// <param name="table">The table to decompile.</param> 5839 /// <param name="table">The table to decompile.</param>
5967 private void DecompileIniFileTable(Table table) 5840 private void DecompileIniFileTable(Table table)
5968 { 5841 {
5969 foreach (Row row in table.Rows) 5842 foreach (var row in table.Rows)
5970 { 5843 {
5971 Wix.IniFile iniFile = new Wix.IniFile(); 5844 var iniFile = new Wix.IniFile();
5972 5845
5973 iniFile.Id = Convert.ToString(row[0]); 5846 iniFile.Id = Convert.ToString(row[0]);
5974 5847
5975 string[] names = Common.GetNames(Convert.ToString(row[1])); 5848 var names = Common.GetNames(Convert.ToString(row[1]));
5976 5849
5977 if (null != names[0]) 5850 if (null != names[0])
5978 { 5851 {
@@ -6004,28 +5877,28 @@ namespace WixToolset.Core.WindowsInstaller
6004 5877
6005 switch (Convert.ToInt32(row[6])) 5878 switch (Convert.ToInt32(row[6]))
6006 { 5879 {
6007 case MsiInterop.MsidbIniFileActionAddLine: 5880 case MsiInterop.MsidbIniFileActionAddLine:
6008 iniFile.Action = Wix.IniFile.ActionType.addLine; 5881 iniFile.Action = Wix.IniFile.ActionType.addLine;
6009 break; 5882 break;
6010 case MsiInterop.MsidbIniFileActionCreateLine: 5883 case MsiInterop.MsidbIniFileActionCreateLine:
6011 iniFile.Action = Wix.IniFile.ActionType.createLine; 5884 iniFile.Action = Wix.IniFile.ActionType.createLine;
6012 break; 5885 break;
6013 case MsiInterop.MsidbIniFileActionAddTag: 5886 case MsiInterop.MsidbIniFileActionAddTag:
6014 iniFile.Action = Wix.IniFile.ActionType.addTag; 5887 iniFile.Action = Wix.IniFile.ActionType.addTag;
6015 break; 5888 break;
6016 default: 5889 default:
6017 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); 5890 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6]));
6018 break; 5891 break;
6019 } 5892 }
6020 5893
6021 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[7])); 5894 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[7]));
6022 if (null != component) 5895 if (null != component)
6023 { 5896 {
6024 component.AddChild(iniFile); 5897 component.AddChild(iniFile);
6025 } 5898 }
6026 else 5899 else
6027 { 5900 {
6028 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[7]), "Component")); 5901 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[7]), "Component"));
6029 } 5902 }
6030 } 5903 }
6031 } 5904 }
@@ -6036,13 +5909,13 @@ namespace WixToolset.Core.WindowsInstaller
6036 /// <param name="table">The table to decompile.</param> 5909 /// <param name="table">The table to decompile.</param>
6037 private void DecompileIniLocatorTable(Table table) 5910 private void DecompileIniLocatorTable(Table table)
6038 { 5911 {
6039 foreach (Row row in table.Rows) 5912 foreach (var row in table.Rows)
6040 { 5913 {
6041 Wix.IniFileSearch iniFileSearch = new Wix.IniFileSearch(); 5914 var iniFileSearch = new Wix.IniFileSearch();
6042 5915
6043 iniFileSearch.Id = Convert.ToString(row[0]); 5916 iniFileSearch.Id = Convert.ToString(row[0]);
6044 5917
6045 string[] names = Common.GetNames(Convert.ToString(row[1])); 5918 var names = Common.GetNames(Convert.ToString(row[1]));
6046 if (null != names[0] && null != names[1]) 5919 if (null != names[0] && null != names[1])
6047 { 5920 {
6048 iniFileSearch.ShortName = names[0]; 5921 iniFileSearch.ShortName = names[0];
@@ -6059,7 +5932,7 @@ namespace WixToolset.Core.WindowsInstaller
6059 5932
6060 if (null != row[4]) 5933 if (null != row[4])
6061 { 5934 {
6062 int field = Convert.ToInt32(row[4]); 5935 var field = Convert.ToInt32(row[4]);
6063 5936
6064 if (0 != field) 5937 if (0 != field)
6065 { 5938 {
@@ -6071,18 +5944,18 @@ namespace WixToolset.Core.WindowsInstaller
6071 { 5944 {
6072 switch (Convert.ToInt32(row[5])) 5945 switch (Convert.ToInt32(row[5]))
6073 { 5946 {
6074 case MsiInterop.MsidbLocatorTypeDirectory: 5947 case MsiInterop.MsidbLocatorTypeDirectory:
6075 iniFileSearch.Type = Wix.IniFileSearch.TypeType.directory; 5948 iniFileSearch.Type = Wix.IniFileSearch.TypeType.directory;
6076 break; 5949 break;
6077 case MsiInterop.MsidbLocatorTypeFileName: 5950 case MsiInterop.MsidbLocatorTypeFileName:
6078 // this is the default value 5951 // this is the default value
6079 break; 5952 break;
6080 case MsiInterop.MsidbLocatorTypeRawValue: 5953 case MsiInterop.MsidbLocatorTypeRawValue:
6081 iniFileSearch.Type = Wix.IniFileSearch.TypeType.raw; 5954 iniFileSearch.Type = Wix.IniFileSearch.TypeType.raw;
6082 break; 5955 break;
6083 default: 5956 default:
6084 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[5].Column.Name, row[5])); 5957 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[5].Column.Name, row[5]));
6085 break; 5958 break;
6086 } 5959 }
6087 } 5960 }
6088 5961
@@ -6096,20 +5969,20 @@ namespace WixToolset.Core.WindowsInstaller
6096 /// <param name="table">The table to decompile.</param> 5969 /// <param name="table">The table to decompile.</param>
6097 private void DecompileIsolatedComponentTable(Table table) 5970 private void DecompileIsolatedComponentTable(Table table)
6098 { 5971 {
6099 foreach (Row row in table.Rows) 5972 foreach (var row in table.Rows)
6100 { 5973 {
6101 Wix.IsolateComponent isolateComponent = new Wix.IsolateComponent(); 5974 var isolateComponent = new Wix.IsolateComponent();
6102 5975
6103 isolateComponent.Shared = Convert.ToString(row[0]); 5976 isolateComponent.Shared = Convert.ToString(row[0]);
6104 5977
6105 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 5978 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
6106 if (null != component) 5979 if (null != component)
6107 { 5980 {
6108 component.AddChild(isolateComponent); 5981 component.AddChild(isolateComponent);
6109 } 5982 }
6110 else 5983 else
6111 { 5984 {
6112 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 5985 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
6113 } 5986 }
6114 } 5987 }
6115 } 5988 }
@@ -6120,14 +5993,14 @@ namespace WixToolset.Core.WindowsInstaller
6120 /// <param name="table">The table to decompile.</param> 5993 /// <param name="table">The table to decompile.</param>
6121 private void DecompileLaunchConditionTable(Table table) 5994 private void DecompileLaunchConditionTable(Table table)
6122 { 5995 {
6123 foreach (Row row in table.Rows) 5996 foreach (var row in table.Rows)
6124 { 5997 {
6125 if (Compiler.DowngradePreventedCondition == Convert.ToString(row[0]) || Compiler.UpgradePreventedCondition == Convert.ToString(row[0])) 5998 if (Common.DowngradePreventedCondition == Convert.ToString(row[0]) || Common.UpgradePreventedCondition == Convert.ToString(row[0]))
6126 { 5999 {
6127 continue; // MajorUpgrade rows processed in FinalizeUpgradeTable 6000 continue; // MajorUpgrade rows processed in FinalizeUpgradeTable
6128 } 6001 }
6129 6002
6130 Wix.Condition condition = new Wix.Condition(); 6003 var condition = new Wix.Condition();
6131 6004
6132 condition.Content = Convert.ToString(row[0]); 6005 condition.Content = Convert.ToString(row[0]);
6133 6006
@@ -6144,10 +6017,10 @@ namespace WixToolset.Core.WindowsInstaller
6144 private void DecompileListBoxTable(Table table) 6017 private void DecompileListBoxTable(Table table)
6145 { 6018 {
6146 Wix.ListBox listBox = null; 6019 Wix.ListBox listBox = null;
6147 SortedList listBoxRows = new SortedList(); 6020 var listBoxRows = new SortedList();
6148 6021
6149 // sort the list boxes by their property and order 6022 // sort the list boxes by their property and order
6150 foreach (Row row in table.Rows) 6023 foreach (var row in table.Rows)
6151 { 6024 {
6152 listBoxRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row); 6025 listBoxRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row);
6153 } 6026 }
@@ -6163,7 +6036,7 @@ namespace WixToolset.Core.WindowsInstaller
6163 this.core.UIElement.AddChild(listBox); 6036 this.core.UIElement.AddChild(listBox);
6164 } 6037 }
6165 6038
6166 Wix.ListItem listItem = new Wix.ListItem(); 6039 var listItem = new Wix.ListItem();
6167 6040
6168 listItem.Value = Convert.ToString(row[2]); 6041 listItem.Value = Convert.ToString(row[2]);
6169 6042
@@ -6183,10 +6056,10 @@ namespace WixToolset.Core.WindowsInstaller
6183 private void DecompileListViewTable(Table table) 6056 private void DecompileListViewTable(Table table)
6184 { 6057 {
6185 Wix.ListView listView = null; 6058 Wix.ListView listView = null;
6186 SortedList listViewRows = new SortedList(); 6059 var listViewRows = new SortedList();
6187 6060
6188 // sort the list views by their property and order 6061 // sort the list views by their property and order
6189 foreach (Row row in table.Rows) 6062 foreach (var row in table.Rows)
6190 { 6063 {
6191 listViewRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row); 6064 listViewRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row);
6192 } 6065 }
@@ -6202,7 +6075,7 @@ namespace WixToolset.Core.WindowsInstaller
6202 this.core.UIElement.AddChild(listView); 6075 this.core.UIElement.AddChild(listView);
6203 } 6076 }
6204 6077
6205 Wix.ListItem listItem = new Wix.ListItem(); 6078 var listItem = new Wix.ListItem();
6206 6079
6207 listItem.Value = Convert.ToString(row[2]); 6080 listItem.Value = Convert.ToString(row[2]);
6208 6081
@@ -6226,29 +6099,29 @@ namespace WixToolset.Core.WindowsInstaller
6226 /// <param name="table">The table to decompile.</param> 6099 /// <param name="table">The table to decompile.</param>
6227 private void DecompileLockPermissionsTable(Table table) 6100 private void DecompileLockPermissionsTable(Table table)
6228 { 6101 {
6229 foreach (Row row in table.Rows) 6102 foreach (var row in table.Rows)
6230 { 6103 {
6231 Wix.Permission permission = new Wix.Permission(); 6104 var permission = new Wix.Permission();
6232 string[] specialPermissions; 6105 string[] specialPermissions;
6233 6106
6234 switch (Convert.ToString(row[1])) 6107 switch (Convert.ToString(row[1]))
6235 { 6108 {
6236 case "CreateFolder": 6109 case "CreateFolder":
6237 specialPermissions = Common.FolderPermissions; 6110 specialPermissions = Common.FolderPermissions;
6238 break; 6111 break;
6239 case "File": 6112 case "File":
6240 specialPermissions = Common.FilePermissions; 6113 specialPermissions = Common.FilePermissions;
6241 break; 6114 break;
6242 case "Registry": 6115 case "Registry":
6243 specialPermissions = Common.RegistryPermissions; 6116 specialPermissions = Common.RegistryPermissions;
6244 break; 6117 break;
6245 default: 6118 default:
6246 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, row.Table.Name, row.Fields[1].Column.Name, row[1])); 6119 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, row.Table.Name, row.Fields[1].Column.Name, row[1]));
6247 return; 6120 return;
6248 } 6121 }
6249 6122
6250 int permissionBits = Convert.ToInt32(row[4]); 6123 var permissionBits = Convert.ToInt32(row[4]);
6251 for (int i = 0; i < 32; i++) 6124 for (var i = 0; i < 32; i++)
6252 { 6125 {
6253 if (0 != ((permissionBits >> i) & 1)) 6126 if (0 != ((permissionBits >> i) & 1))
6254 { 6127 {
@@ -6273,95 +6146,95 @@ namespace WixToolset.Core.WindowsInstaller
6273 6146
6274 if (null == name) 6147 if (null == name)
6275 { 6148 {
6276 this.core.OnMessage(WixWarnings.UnknownPermission(row.SourceLineNumbers, row.Table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), i)); 6149 this.Messaging.Write(WarningMessages.UnknownPermission(row.SourceLineNumbers, row.Table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), i));
6277 } 6150 }
6278 else 6151 else
6279 { 6152 {
6280 switch (name) 6153 switch (name)
6281 { 6154 {
6282 case "Append": 6155 case "Append":
6283 permission.Append = Wix.YesNoType.yes; 6156 permission.Append = Wix.YesNoType.yes;
6284 break; 6157 break;
6285 case "ChangePermission": 6158 case "ChangePermission":
6286 permission.ChangePermission = Wix.YesNoType.yes; 6159 permission.ChangePermission = Wix.YesNoType.yes;
6287 break; 6160 break;
6288 case "CreateChild": 6161 case "CreateChild":
6289 permission.CreateChild = Wix.YesNoType.yes; 6162 permission.CreateChild = Wix.YesNoType.yes;
6290 break; 6163 break;
6291 case "CreateFile": 6164 case "CreateFile":
6292 permission.CreateFile = Wix.YesNoType.yes; 6165 permission.CreateFile = Wix.YesNoType.yes;
6293 break; 6166 break;
6294 case "CreateLink": 6167 case "CreateLink":
6295 permission.CreateLink = Wix.YesNoType.yes; 6168 permission.CreateLink = Wix.YesNoType.yes;
6296 break; 6169 break;
6297 case "CreateSubkeys": 6170 case "CreateSubkeys":
6298 permission.CreateSubkeys = Wix.YesNoType.yes; 6171 permission.CreateSubkeys = Wix.YesNoType.yes;
6299 break; 6172 break;
6300 case "Delete": 6173 case "Delete":
6301 permission.Delete = Wix.YesNoType.yes; 6174 permission.Delete = Wix.YesNoType.yes;
6302 break; 6175 break;
6303 case "DeleteChild": 6176 case "DeleteChild":
6304 permission.DeleteChild = Wix.YesNoType.yes; 6177 permission.DeleteChild = Wix.YesNoType.yes;
6305 break; 6178 break;
6306 case "EnumerateSubkeys": 6179 case "EnumerateSubkeys":
6307 permission.EnumerateSubkeys = Wix.YesNoType.yes; 6180 permission.EnumerateSubkeys = Wix.YesNoType.yes;
6308 break; 6181 break;
6309 case "Execute": 6182 case "Execute":
6310 permission.Execute = Wix.YesNoType.yes; 6183 permission.Execute = Wix.YesNoType.yes;
6311 break; 6184 break;
6312 case "FileAllRights": 6185 case "FileAllRights":
6313 permission.FileAllRights = Wix.YesNoType.yes; 6186 permission.FileAllRights = Wix.YesNoType.yes;
6314 break; 6187 break;
6315 case "GenericAll": 6188 case "GenericAll":
6316 permission.GenericAll = Wix.YesNoType.yes; 6189 permission.GenericAll = Wix.YesNoType.yes;
6317 break; 6190 break;
6318 case "GenericExecute": 6191 case "GenericExecute":
6319 permission.GenericExecute = Wix.YesNoType.yes; 6192 permission.GenericExecute = Wix.YesNoType.yes;
6320 break; 6193 break;
6321 case "GenericRead": 6194 case "GenericRead":
6322 permission.GenericRead = Wix.YesNoType.yes; 6195 permission.GenericRead = Wix.YesNoType.yes;
6323 break; 6196 break;
6324 case "GenericWrite": 6197 case "GenericWrite":
6325 permission.GenericWrite = Wix.YesNoType.yes; 6198 permission.GenericWrite = Wix.YesNoType.yes;
6326 break; 6199 break;
6327 case "Notify": 6200 case "Notify":
6328 permission.Notify = Wix.YesNoType.yes; 6201 permission.Notify = Wix.YesNoType.yes;
6329 break; 6202 break;
6330 case "Read": 6203 case "Read":
6331 permission.Read = Wix.YesNoType.yes; 6204 permission.Read = Wix.YesNoType.yes;
6332 break; 6205 break;
6333 case "ReadAttributes": 6206 case "ReadAttributes":
6334 permission.ReadAttributes = Wix.YesNoType.yes; 6207 permission.ReadAttributes = Wix.YesNoType.yes;
6335 break; 6208 break;
6336 case "ReadExtendedAttributes": 6209 case "ReadExtendedAttributes":
6337 permission.ReadExtendedAttributes = Wix.YesNoType.yes; 6210 permission.ReadExtendedAttributes = Wix.YesNoType.yes;
6338 break; 6211 break;
6339 case "ReadPermission": 6212 case "ReadPermission":
6340 permission.ReadPermission = Wix.YesNoType.yes; 6213 permission.ReadPermission = Wix.YesNoType.yes;
6341 break; 6214 break;
6342 case "SpecificRightsAll": 6215 case "SpecificRightsAll":
6343 permission.SpecificRightsAll = Wix.YesNoType.yes; 6216 permission.SpecificRightsAll = Wix.YesNoType.yes;
6344 break; 6217 break;
6345 case "Synchronize": 6218 case "Synchronize":
6346 permission.Synchronize = Wix.YesNoType.yes; 6219 permission.Synchronize = Wix.YesNoType.yes;
6347 break; 6220 break;
6348 case "TakeOwnership": 6221 case "TakeOwnership":
6349 permission.TakeOwnership = Wix.YesNoType.yes; 6222 permission.TakeOwnership = Wix.YesNoType.yes;
6350 break; 6223 break;
6351 case "Traverse": 6224 case "Traverse":
6352 permission.Traverse = Wix.YesNoType.yes; 6225 permission.Traverse = Wix.YesNoType.yes;
6353 break; 6226 break;
6354 case "Write": 6227 case "Write":
6355 permission.Write = Wix.YesNoType.yes; 6228 permission.Write = Wix.YesNoType.yes;
6356 break; 6229 break;
6357 case "WriteAttributes": 6230 case "WriteAttributes":
6358 permission.WriteAttributes = Wix.YesNoType.yes; 6231 permission.WriteAttributes = Wix.YesNoType.yes;
6359 break; 6232 break;
6360 case "WriteExtendedAttributes": 6233 case "WriteExtendedAttributes":
6361 permission.WriteExtendedAttributes = Wix.YesNoType.yes; 6234 permission.WriteExtendedAttributes = Wix.YesNoType.yes;
6362 break; 6235 break;
6363 default: 6236 default:
6364 throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownPermissionAttribute, name)); 6237 throw new InvalidOperationException($"Unknown permission attribute '{name}'.");
6365 } 6238 }
6366 } 6239 }
6367 } 6240 }
@@ -6386,7 +6259,7 @@ namespace WixToolset.Core.WindowsInstaller
6386 { 6259 {
6387 foreach (MediaRow mediaRow in table.Rows) 6260 foreach (MediaRow mediaRow in table.Rows)
6388 { 6261 {
6389 Wix.Media media = new Wix.Media(); 6262 var media = new Wix.Media();
6390 6263
6391 media.Id = Convert.ToString(mediaRow.DiskId); 6264 media.Id = Convert.ToString(mediaRow.DiskId);
6392 6265
@@ -6397,7 +6270,7 @@ namespace WixToolset.Core.WindowsInstaller
6397 6270
6398 if (null != mediaRow.Cabinet) 6271 if (null != mediaRow.Cabinet)
6399 { 6272 {
6400 string cabinet = mediaRow.Cabinet; 6273 var cabinet = mediaRow.Cabinet;
6401 6274
6402 if (cabinet.StartsWith("#", StringComparison.Ordinal)) 6275 if (cabinet.StartsWith("#", StringComparison.Ordinal))
6403 { 6276 {
@@ -6424,9 +6297,9 @@ namespace WixToolset.Core.WindowsInstaller
6424 /// <param name="table">The table to decompile.</param> 6297 /// <param name="table">The table to decompile.</param>
6425 private void DecompileMIMETable(Table table) 6298 private void DecompileMIMETable(Table table)
6426 { 6299 {
6427 foreach (Row row in table.Rows) 6300 foreach (var row in table.Rows)
6428 { 6301 {
6429 Wix.MIME mime = new Wix.MIME(); 6302 var mime = new Wix.MIME();
6430 6303
6431 mime.ContentType = Convert.ToString(row[0]); 6304 mime.ContentType = Convert.ToString(row[0]);
6432 6305
@@ -6445,29 +6318,29 @@ namespace WixToolset.Core.WindowsInstaller
6445 /// <param name="table">The table to decompile.</param> 6318 /// <param name="table">The table to decompile.</param>
6446 private void DecompileModuleConfigurationTable(Table table) 6319 private void DecompileModuleConfigurationTable(Table table)
6447 { 6320 {
6448 foreach (Row row in table.Rows) 6321 foreach (var row in table.Rows)
6449 { 6322 {
6450 Wix.Configuration configuration = new Wix.Configuration(); 6323 var configuration = new Wix.Configuration();
6451 6324
6452 configuration.Name = Convert.ToString(row[0]); 6325 configuration.Name = Convert.ToString(row[0]);
6453 6326
6454 switch (Convert.ToInt32(row[1])) 6327 switch (Convert.ToInt32(row[1]))
6455 { 6328 {
6456 case 0: 6329 case 0:
6457 configuration.Format = Wix.Configuration.FormatType.Text; 6330 configuration.Format = Wix.Configuration.FormatType.Text;
6458 break; 6331 break;
6459 case 1: 6332 case 1:
6460 configuration.Format = Wix.Configuration.FormatType.Key; 6333 configuration.Format = Wix.Configuration.FormatType.Key;
6461 break; 6334 break;
6462 case 2: 6335 case 2:
6463 configuration.Format = Wix.Configuration.FormatType.Integer; 6336 configuration.Format = Wix.Configuration.FormatType.Integer;
6464 break; 6337 break;
6465 case 3: 6338 case 3:
6466 configuration.Format = Wix.Configuration.FormatType.Bitfield; 6339 configuration.Format = Wix.Configuration.FormatType.Bitfield;
6467 break; 6340 break;
6468 default: 6341 default:
6469 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 6342 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
6470 break; 6343 break;
6471 } 6344 }
6472 6345
6473 if (null != row[2]) 6346 if (null != row[2])
@@ -6487,7 +6360,7 @@ namespace WixToolset.Core.WindowsInstaller
6487 6360
6488 if (null != row[5]) 6361 if (null != row[5])
6489 { 6362 {
6490 int attributes = Convert.ToInt32(row[5]); 6363 var attributes = Convert.ToInt32(row[5]);
6491 6364
6492 if (MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan == (attributes & MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan)) 6365 if (MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan == (attributes & MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan))
6493 { 6366 {
@@ -6501,7 +6374,7 @@ namespace WixToolset.Core.WindowsInstaller
6501 6374
6502 if (3 < attributes) 6375 if (3 < attributes)
6503 { 6376 {
6504 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[5].Column.Name, row[5])); 6377 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[5].Column.Name, row[5]));
6505 } 6378 }
6506 } 6379 }
6507 6380
@@ -6535,9 +6408,9 @@ namespace WixToolset.Core.WindowsInstaller
6535 /// <param name="table">The table to decompile.</param> 6408 /// <param name="table">The table to decompile.</param>
6536 private void DecompileModuleDependencyTable(Table table) 6409 private void DecompileModuleDependencyTable(Table table)
6537 { 6410 {
6538 foreach (Row row in table.Rows) 6411 foreach (var row in table.Rows)
6539 { 6412 {
6540 Wix.Dependency dependency = new Wix.Dependency(); 6413 var dependency = new Wix.Dependency();
6541 6414
6542 dependency.RequiredId = Convert.ToString(row[2]); 6415 dependency.RequiredId = Convert.ToString(row[2]);
6543 6416
@@ -6558,13 +6431,13 @@ namespace WixToolset.Core.WindowsInstaller
6558 /// <param name="table">The table to decompile.</param> 6431 /// <param name="table">The table to decompile.</param>
6559 private void DecompileModuleExclusionTable(Table table) 6432 private void DecompileModuleExclusionTable(Table table)
6560 { 6433 {
6561 foreach (Row row in table.Rows) 6434 foreach (var row in table.Rows)
6562 { 6435 {
6563 Wix.Exclusion exclusion = new Wix.Exclusion(); 6436 var exclusion = new Wix.Exclusion();
6564 6437
6565 exclusion.ExcludedId = Convert.ToString(row[2]); 6438 exclusion.ExcludedId = Convert.ToString(row[2]);
6566 6439
6567 int excludedLanguage = Convert.ToInt32(Convert.ToString(row[3]), CultureInfo.InvariantCulture); 6440 var excludedLanguage = Convert.ToInt32(Convert.ToString(row[3]), CultureInfo.InvariantCulture);
6568 if (0 < excludedLanguage) 6441 if (0 < excludedLanguage)
6569 { 6442 {
6570 exclusion.ExcludeLanguage = excludedLanguage; 6443 exclusion.ExcludeLanguage = excludedLanguage;
@@ -6594,14 +6467,14 @@ namespace WixToolset.Core.WindowsInstaller
6594 /// <param name="table">The table to decompile.</param> 6467 /// <param name="table">The table to decompile.</param>
6595 private void DecompileModuleIgnoreTableTable(Table table) 6468 private void DecompileModuleIgnoreTableTable(Table table)
6596 { 6469 {
6597 foreach (Row row in table.Rows) 6470 foreach (var row in table.Rows)
6598 { 6471 {
6599 string tableName = Convert.ToString(row[0]); 6472 var tableName = Convert.ToString(row[0]);
6600 6473
6601 // the linker automatically adds a ModuleIgnoreTable row for some tables 6474 // the linker automatically adds a ModuleIgnoreTable row for some tables
6602 if ("ModuleConfiguration" != tableName && "ModuleSubstitution" != tableName) 6475 if ("ModuleConfiguration" != tableName && "ModuleSubstitution" != tableName)
6603 { 6476 {
6604 Wix.IgnoreTable ignoreTable = new Wix.IgnoreTable(); 6477 var ignoreTable = new Wix.IgnoreTable();
6605 6478
6606 ignoreTable.Id = tableName; 6479 ignoreTable.Id = tableName;
6607 6480
@@ -6618,9 +6491,9 @@ namespace WixToolset.Core.WindowsInstaller
6618 { 6491 {
6619 if (1 == table.Rows.Count) 6492 if (1 == table.Rows.Count)
6620 { 6493 {
6621 Row row = table.Rows[0]; 6494 var row = table.Rows[0];
6622 6495
6623 Wix.Module module = (Wix.Module)this.core.RootElement; 6496 var module = (Wix.Module)this.core.RootElement;
6624 6497
6625 module.Id = Convert.ToString(row[0]); 6498 module.Id = Convert.ToString(row[0]);
6626 6499
@@ -6641,9 +6514,9 @@ namespace WixToolset.Core.WindowsInstaller
6641 /// <param name="table">The table to decompile.</param> 6514 /// <param name="table">The table to decompile.</param>
6642 private void DecompileModuleSubstitutionTable(Table table) 6515 private void DecompileModuleSubstitutionTable(Table table)
6643 { 6516 {
6644 foreach (Row row in table.Rows) 6517 foreach (var row in table.Rows)
6645 { 6518 {
6646 Wix.Substitution substitution = new Wix.Substitution(); 6519 var substitution = new Wix.Substitution();
6647 6520
6648 substitution.Table = Convert.ToString(row[0]); 6521 substitution.Table = Convert.ToString(row[0]);
6649 6522
@@ -6666,9 +6539,9 @@ namespace WixToolset.Core.WindowsInstaller
6666 /// <param name="table">The table to decompile.</param> 6539 /// <param name="table">The table to decompile.</param>
6667 private void DecompileMoveFileTable(Table table) 6540 private void DecompileMoveFileTable(Table table)
6668 { 6541 {
6669 foreach (Row row in table.Rows) 6542 foreach (var row in table.Rows)
6670 { 6543 {
6671 Wix.CopyFile copyFile = new Wix.CopyFile(); 6544 var copyFile = new Wix.CopyFile();
6672 6545
6673 copyFile.Id = Convert.ToString(row[0]); 6546 copyFile.Id = Convert.ToString(row[0]);
6674 6547
@@ -6679,7 +6552,7 @@ namespace WixToolset.Core.WindowsInstaller
6679 6552
6680 if (null != row[3]) 6553 if (null != row[3])
6681 { 6554 {
6682 string[] names = Common.GetNames(Convert.ToString(row[3])); 6555 var names = Common.GetNames(Convert.ToString(row[3]));
6683 if (null != names[0] && null != names[1]) 6556 if (null != names[0] && null != names[1])
6684 { 6557 {
6685 copyFile.DestinationShortName = names[0]; 6558 copyFile.DestinationShortName = names[0];
@@ -6695,24 +6568,24 @@ namespace WixToolset.Core.WindowsInstaller
6695 6568
6696 switch (Convert.ToInt32(row[6])) 6569 switch (Convert.ToInt32(row[6]))
6697 { 6570 {
6698 case 0: 6571 case 0:
6699 break; 6572 break;
6700 case MsiInterop.MsidbMoveFileOptionsMove: 6573 case MsiInterop.MsidbMoveFileOptionsMove:
6701 copyFile.Delete = Wix.YesNoType.yes; 6574 copyFile.Delete = Wix.YesNoType.yes;
6702 break; 6575 break;
6703 default: 6576 default:
6704 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); 6577 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6]));
6705 break; 6578 break;
6706 } 6579 }
6707 6580
6708 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 6581 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
6709 if (null != component) 6582 if (null != component)
6710 { 6583 {
6711 component.AddChild(copyFile); 6584 component.AddChild(copyFile);
6712 } 6585 }
6713 else 6586 else
6714 { 6587 {
6715 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 6588 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
6716 } 6589 }
6717 this.core.IndexElement(row, copyFile); 6590 this.core.IndexElement(row, copyFile);
6718 } 6591 }
@@ -6724,9 +6597,9 @@ namespace WixToolset.Core.WindowsInstaller
6724 /// <param name="table">The table to decompile.</param> 6597 /// <param name="table">The table to decompile.</param>
6725 private void DecompileMsiDigitalCertificateTable(Table table) 6598 private void DecompileMsiDigitalCertificateTable(Table table)
6726 { 6599 {
6727 foreach (Row row in table.Rows) 6600 foreach (var row in table.Rows)
6728 { 6601 {
6729 Wix.DigitalCertificate digitalCertificate = new Wix.DigitalCertificate(); 6602 var digitalCertificate = new Wix.DigitalCertificate();
6730 6603
6731 digitalCertificate.Id = Convert.ToString(row[0]); 6604 digitalCertificate.Id = Convert.ToString(row[0]);
6732 6605
@@ -6742,33 +6615,33 @@ namespace WixToolset.Core.WindowsInstaller
6742 /// <param name="table">The table to decompile.</param> 6615 /// <param name="table">The table to decompile.</param>
6743 private void DecompileMsiDigitalSignatureTable(Table table) 6616 private void DecompileMsiDigitalSignatureTable(Table table)
6744 { 6617 {
6745 foreach (Row row in table.Rows) 6618 foreach (var row in table.Rows)
6746 { 6619 {
6747 Wix.DigitalSignature digitalSignature = new Wix.DigitalSignature(); 6620 var digitalSignature = new Wix.DigitalSignature();
6748 6621
6749 if (null != row[3]) 6622 if (null != row[3])
6750 { 6623 {
6751 digitalSignature.SourceFile = Convert.ToString(row[3]); 6624 digitalSignature.SourceFile = Convert.ToString(row[3]);
6752 } 6625 }
6753 6626
6754 Wix.DigitalCertificate digitalCertificate = (Wix.DigitalCertificate)this.core.GetIndexedElement("MsiDigitalCertificate", Convert.ToString(row[2])); 6627 var digitalCertificate = (Wix.DigitalCertificate)this.core.GetIndexedElement("MsiDigitalCertificate", Convert.ToString(row[2]));
6755 if (null != digitalCertificate) 6628 if (null != digitalCertificate)
6756 { 6629 {
6757 digitalSignature.AddChild(digitalCertificate); 6630 digitalSignature.AddChild(digitalCertificate);
6758 } 6631 }
6759 else 6632 else
6760 { 6633 {
6761 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DigitalCertificate_", Convert.ToString(row[2]), "MsiDigitalCertificate")); 6634 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DigitalCertificate_", Convert.ToString(row[2]), "MsiDigitalCertificate"));
6762 } 6635 }
6763 6636
6764 Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(Convert.ToString(row[0]), Convert.ToString(row[1])); 6637 var parentElement = (Wix.IParentElement)this.core.GetIndexedElement(Convert.ToString(row[0]), Convert.ToString(row[1]));
6765 if (null != parentElement) 6638 if (null != parentElement)
6766 { 6639 {
6767 parentElement.AddChild(digitalSignature); 6640 parentElement.AddChild(digitalSignature);
6768 } 6641 }
6769 else 6642 else
6770 { 6643 {
6771 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "SignObject", Convert.ToString(row[1]), Convert.ToString(row[0]))); 6644 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "SignObject", Convert.ToString(row[1]), Convert.ToString(row[0])));
6772 } 6645 }
6773 } 6646 }
6774 } 6647 }
@@ -6779,9 +6652,9 @@ namespace WixToolset.Core.WindowsInstaller
6779 /// <param name="table">The table to decompile.</param> 6652 /// <param name="table">The table to decompile.</param>
6780 private void DecompileMsiEmbeddedChainerTable(Table table) 6653 private void DecompileMsiEmbeddedChainerTable(Table table)
6781 { 6654 {
6782 foreach (Row row in table.Rows) 6655 foreach (var row in table.Rows)
6783 { 6656 {
6784 Wix.EmbeddedChainer embeddedChainer = new Wix.EmbeddedChainer(); 6657 var embeddedChainer = new Wix.EmbeddedChainer();
6785 6658
6786 embeddedChainer.Id = Convert.ToString(row[0]); 6659 embeddedChainer.Id = Convert.ToString(row[0]);
6787 6660
@@ -6794,18 +6667,18 @@ namespace WixToolset.Core.WindowsInstaller
6794 6667
6795 switch (Convert.ToInt32(row[4])) 6668 switch (Convert.ToInt32(row[4]))
6796 { 6669 {
6797 case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeBinaryData: 6670 case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeBinaryData:
6798 embeddedChainer.BinarySource = Convert.ToString(row[3]); 6671 embeddedChainer.BinarySource = Convert.ToString(row[3]);
6799 break; 6672 break;
6800 case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeSourceFile: 6673 case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeSourceFile:
6801 embeddedChainer.FileSource = Convert.ToString(row[3]); 6674 embeddedChainer.FileSource = Convert.ToString(row[3]);
6802 break; 6675 break;
6803 case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeProperty: 6676 case MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeProperty:
6804 embeddedChainer.PropertySource = Convert.ToString(row[3]); 6677 embeddedChainer.PropertySource = Convert.ToString(row[3]);
6805 break; 6678 break;
6806 default: 6679 default:
6807 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); 6680 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4]));
6808 break; 6681 break;
6809 } 6682 }
6810 6683
6811 this.core.RootElement.AddChild(embeddedChainer); 6684 this.core.RootElement.AddChild(embeddedChainer);
@@ -6818,26 +6691,26 @@ namespace WixToolset.Core.WindowsInstaller
6818 /// <param name="table">The table to decompile.</param> 6691 /// <param name="table">The table to decompile.</param>
6819 private void DecompileMsiEmbeddedUITable(Table table) 6692 private void DecompileMsiEmbeddedUITable(Table table)
6820 { 6693 {
6821 Wix.EmbeddedUI embeddedUI = new Wix.EmbeddedUI(); 6694 var embeddedUI = new Wix.EmbeddedUI();
6822 bool foundEmbeddedUI = false; 6695 var foundEmbeddedUI = false;
6823 bool foundEmbeddedResources = false; 6696 var foundEmbeddedResources = false;
6824 6697
6825 foreach (Row row in table.Rows) 6698 foreach (var row in table.Rows)
6826 { 6699 {
6827 int attributes = Convert.ToInt32(row[2]); 6700 var attributes = Convert.ToInt32(row[2]);
6828 6701
6829 if (MsiInterop.MsidbEmbeddedUI == (attributes & MsiInterop.MsidbEmbeddedUI)) 6702 if (MsiInterop.MsidbEmbeddedUI == (attributes & MsiInterop.MsidbEmbeddedUI))
6830 { 6703 {
6831 if (foundEmbeddedUI) 6704 if (foundEmbeddedUI)
6832 { 6705 {
6833 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2])); 6706 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2]));
6834 } 6707 }
6835 else 6708 else
6836 { 6709 {
6837 embeddedUI.Id = Convert.ToString(row[0]); 6710 embeddedUI.Id = Convert.ToString(row[0]);
6838 embeddedUI.Name = Convert.ToString(row[1]); 6711 embeddedUI.Name = Convert.ToString(row[1]);
6839 6712
6840 int messageFilter = Convert.ToInt32(row[3]); 6713 var messageFilter = Convert.ToInt32(row[3]);
6841 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_FATALEXIT)) 6714 if (0 == (messageFilter & MsiInterop.INSTALLLOGMODE_FATALEXIT))
6842 { 6715 {
6843 embeddedUI.IgnoreFatalExit = Wix.YesNoType.yes; 6716 embeddedUI.IgnoreFatalExit = Wix.YesNoType.yes;
@@ -6941,7 +6814,7 @@ namespace WixToolset.Core.WindowsInstaller
6941 } 6814 }
6942 else 6815 else
6943 { 6816 {
6944 Wix.EmbeddedUIResource embeddedResource = new Wix.EmbeddedUIResource(); 6817 var embeddedResource = new Wix.EmbeddedUIResource();
6945 6818
6946 embeddedResource.Id = Convert.ToString(row[0]); 6819 embeddedResource.Id = Convert.ToString(row[0]);
6947 embeddedResource.Name = Convert.ToString(row[1]); 6820 embeddedResource.Name = Convert.ToString(row[1]);
@@ -6964,29 +6837,29 @@ namespace WixToolset.Core.WindowsInstaller
6964 /// <param name="table">The table to decompile.</param> 6837 /// <param name="table">The table to decompile.</param>
6965 private void DecompileMsiLockPermissionsExTable(Table table) 6838 private void DecompileMsiLockPermissionsExTable(Table table)
6966 { 6839 {
6967 foreach (Row row in table.Rows) 6840 foreach (var row in table.Rows)
6968 { 6841 {
6969 Wix.PermissionEx permissionEx = new Wix.PermissionEx(); 6842 var permissionEx = new Wix.PermissionEx();
6970 permissionEx.Id = Convert.ToString(row[0]); 6843 permissionEx.Id = Convert.ToString(row[0]);
6971 permissionEx.Sddl = Convert.ToString(row[3]); 6844 permissionEx.Sddl = Convert.ToString(row[3]);
6972 6845
6973 if (null != row[4]) 6846 if (null != row[4])
6974 { 6847 {
6975 Wix.Condition condition = new Wix.Condition(); 6848 var condition = new Wix.Condition();
6976 condition.Content = Convert.ToString(row[4]); 6849 condition.Content = Convert.ToString(row[4]);
6977 permissionEx.AddChild(condition); 6850 permissionEx.AddChild(condition);
6978 } 6851 }
6979 6852
6980 switch (Convert.ToString(row[2])) 6853 switch (Convert.ToString(row[2]))
6981 { 6854 {
6982 case "CreateFolder": 6855 case "CreateFolder":
6983 case "File": 6856 case "File":
6984 case "Registry": 6857 case "Registry":
6985 case "ServiceInstall": 6858 case "ServiceInstall":
6986 break; 6859 break;
6987 default: 6860 default:
6988 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, row.Table.Name, row.Fields[1].Column.Name, row[1])); 6861 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, row.Table.Name, row.Fields[1].Column.Name, row[1]));
6989 return; 6862 return;
6990 } 6863 }
6991 6864
6992 this.core.IndexElement(row, permissionEx); 6865 this.core.IndexElement(row, permissionEx);
@@ -7001,9 +6874,9 @@ namespace WixToolset.Core.WindowsInstaller
7001 { 6874 {
7002 if (0 < table.Rows.Count) 6875 if (0 < table.Rows.Count)
7003 { 6876 {
7004 Wix.PackageCertificates packageCertificates = new Wix.PackageCertificates(); 6877 var packageCertificates = new Wix.PackageCertificates();
7005 this.core.RootElement.AddChild(packageCertificates); 6878 this.core.RootElement.AddChild(packageCertificates);
7006 AddCertificates(table, packageCertificates); 6879 this.AddCertificates(table, packageCertificates);
7007 } 6880 }
7008 } 6881 }
7009 6882
@@ -7015,9 +6888,9 @@ namespace WixToolset.Core.WindowsInstaller
7015 { 6888 {
7016 if (0 < table.Rows.Count) 6889 if (0 < table.Rows.Count)
7017 { 6890 {
7018 Wix.PatchCertificates patchCertificates = new Wix.PatchCertificates(); 6891 var patchCertificates = new Wix.PatchCertificates();
7019 this.core.RootElement.AddChild(patchCertificates); 6892 this.core.RootElement.AddChild(patchCertificates);
7020 AddCertificates(table, patchCertificates); 6893 this.AddCertificates(table, patchCertificates);
7021 } 6894 }
7022 } 6895 }
7023 6896
@@ -7028,9 +6901,9 @@ namespace WixToolset.Core.WindowsInstaller
7028 /// <param name="parent">DigitalCertificate parent</param> 6901 /// <param name="parent">DigitalCertificate parent</param>
7029 private void AddCertificates(Table table, Wix.IParentElement parent) 6902 private void AddCertificates(Table table, Wix.IParentElement parent)
7030 { 6903 {
7031 foreach (Row row in table.Rows) 6904 foreach (var row in table.Rows)
7032 { 6905 {
7033 Wix.DigitalCertificate digitalCertificate = (Wix.DigitalCertificate)this.core.GetIndexedElement("MsiDigitalCertificate", Convert.ToString(row[1])); 6906 var digitalCertificate = (Wix.DigitalCertificate)this.core.GetIndexedElement("MsiDigitalCertificate", Convert.ToString(row[1]));
7034 6907
7035 if (null != digitalCertificate) 6908 if (null != digitalCertificate)
7036 { 6909 {
@@ -7038,7 +6911,7 @@ namespace WixToolset.Core.WindowsInstaller
7038 } 6911 }
7039 else 6912 else
7040 { 6913 {
7041 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DigitalCertificate_", Convert.ToString(row[1]), "MsiDigitalCertificate")); 6914 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DigitalCertificate_", Convert.ToString(row[1]), "MsiDigitalCertificate"));
7042 } 6915 }
7043 } 6916 }
7044 } 6917 }
@@ -7049,21 +6922,21 @@ namespace WixToolset.Core.WindowsInstaller
7049 /// <param name="table">The table to decompile.</param> 6922 /// <param name="table">The table to decompile.</param>
7050 private void DecompileMsiShortcutPropertyTable(Table table) 6923 private void DecompileMsiShortcutPropertyTable(Table table)
7051 { 6924 {
7052 foreach (Row row in table.Rows) 6925 foreach (var row in table.Rows)
7053 { 6926 {
7054 Wix.ShortcutProperty property = new Wix.ShortcutProperty(); 6927 var property = new Wix.ShortcutProperty();
7055 property.Id = Convert.ToString(row[0]); 6928 property.Id = Convert.ToString(row[0]);
7056 property.Key = Convert.ToString(row[2]); 6929 property.Key = Convert.ToString(row[2]);
7057 property.Value = Convert.ToString(row[3]); 6930 property.Value = Convert.ToString(row[3]);
7058 6931
7059 Wix.Shortcut shortcut = (Wix.Shortcut)this.core.GetIndexedElement("Shortcut", Convert.ToString(row[1])); 6932 var shortcut = (Wix.Shortcut)this.core.GetIndexedElement("Shortcut", Convert.ToString(row[1]));
7060 if (null != shortcut) 6933 if (null != shortcut)
7061 { 6934 {
7062 shortcut.AddChild(property); 6935 shortcut.AddChild(property);
7063 } 6936 }
7064 else 6937 else
7065 { 6938 {
7066 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Shortcut_", Convert.ToString(row[1]), "Shortcut")); 6939 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Shortcut_", Convert.ToString(row[1]), "Shortcut"));
7067 } 6940 }
7068 } 6941 }
7069 } 6942 }
@@ -7074,9 +6947,9 @@ namespace WixToolset.Core.WindowsInstaller
7074 /// <param name="table">The table to decompile.</param> 6947 /// <param name="table">The table to decompile.</param>
7075 private void DecompileODBCAttributeTable(Table table) 6948 private void DecompileODBCAttributeTable(Table table)
7076 { 6949 {
7077 foreach (Row row in table.Rows) 6950 foreach (var row in table.Rows)
7078 { 6951 {
7079 Wix.Property property = new Wix.Property(); 6952 var property = new Wix.Property();
7080 6953
7081 property.Id = Convert.ToString(row[1]); 6954 property.Id = Convert.ToString(row[1]);
7082 6955
@@ -7085,14 +6958,14 @@ namespace WixToolset.Core.WindowsInstaller
7085 property.Value = Convert.ToString(row[2]); 6958 property.Value = Convert.ToString(row[2]);
7086 } 6959 }
7087 6960
7088 Wix.ODBCDriver odbcDriver = (Wix.ODBCDriver)this.core.GetIndexedElement("ODBCDriver", Convert.ToString(row[0])); 6961 var odbcDriver = (Wix.ODBCDriver)this.core.GetIndexedElement("ODBCDriver", Convert.ToString(row[0]));
7089 if (null != odbcDriver) 6962 if (null != odbcDriver)
7090 { 6963 {
7091 odbcDriver.AddChild(property); 6964 odbcDriver.AddChild(property);
7092 } 6965 }
7093 else 6966 else
7094 { 6967 {
7095 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Driver_", Convert.ToString(row[0]), "ODBCDriver")); 6968 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Driver_", Convert.ToString(row[0]), "ODBCDriver"));
7096 } 6969 }
7097 } 6970 }
7098 } 6971 }
@@ -7103,9 +6976,9 @@ namespace WixToolset.Core.WindowsInstaller
7103 /// <param name="table">The table to decompile.</param> 6976 /// <param name="table">The table to decompile.</param>
7104 private void DecompileODBCDataSourceTable(Table table) 6977 private void DecompileODBCDataSourceTable(Table table)
7105 { 6978 {
7106 foreach (Row row in table.Rows) 6979 foreach (var row in table.Rows)
7107 { 6980 {
7108 Wix.ODBCDataSource odbcDataSource = new Wix.ODBCDataSource(); 6981 var odbcDataSource = new Wix.ODBCDataSource();
7109 6982
7110 odbcDataSource.Id = Convert.ToString(row[0]); 6983 odbcDataSource.Id = Convert.ToString(row[0]);
7111 6984
@@ -7115,15 +6988,15 @@ namespace WixToolset.Core.WindowsInstaller
7115 6988
7116 switch (Convert.ToInt32(row[4])) 6989 switch (Convert.ToInt32(row[4]))
7117 { 6990 {
7118 case MsiInterop.MsidbODBCDataSourceRegistrationPerMachine: 6991 case MsiInterop.MsidbODBCDataSourceRegistrationPerMachine:
7119 odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.machine; 6992 odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.machine;
7120 break; 6993 break;
7121 case MsiInterop.MsidbODBCDataSourceRegistrationPerUser: 6994 case MsiInterop.MsidbODBCDataSourceRegistrationPerUser:
7122 odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.user; 6995 odbcDataSource.Registration = Wix.ODBCDataSource.RegistrationType.user;
7123 break; 6996 break;
7124 default: 6997 default:
7125 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); 6998 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4]));
7126 break; 6999 break;
7127 } 7000 }
7128 7001
7129 this.core.IndexElement(row, odbcDataSource); 7002 this.core.IndexElement(row, odbcDataSource);
@@ -7136,9 +7009,9 @@ namespace WixToolset.Core.WindowsInstaller
7136 /// <param name="table">The table to decompile.</param> 7009 /// <param name="table">The table to decompile.</param>
7137 private void DecompileODBCDriverTable(Table table) 7010 private void DecompileODBCDriverTable(Table table)
7138 { 7011 {
7139 foreach (Row row in table.Rows) 7012 foreach (var row in table.Rows)
7140 { 7013 {
7141 Wix.ODBCDriver odbcDriver = new Wix.ODBCDriver(); 7014 var odbcDriver = new Wix.ODBCDriver();
7142 7015
7143 odbcDriver.Id = Convert.ToString(row[0]); 7016 odbcDriver.Id = Convert.ToString(row[0]);
7144 7017
@@ -7151,14 +7024,14 @@ namespace WixToolset.Core.WindowsInstaller
7151 odbcDriver.SetupFile = Convert.ToString(row[4]); 7024 odbcDriver.SetupFile = Convert.ToString(row[4]);
7152 } 7025 }
7153 7026
7154 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 7027 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
7155 if (null != component) 7028 if (null != component)
7156 { 7029 {
7157 component.AddChild(odbcDriver); 7030 component.AddChild(odbcDriver);
7158 } 7031 }
7159 else 7032 else
7160 { 7033 {
7161 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 7034 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
7162 } 7035 }
7163 this.core.IndexElement(row, odbcDriver); 7036 this.core.IndexElement(row, odbcDriver);
7164 } 7037 }
@@ -7170,9 +7043,9 @@ namespace WixToolset.Core.WindowsInstaller
7170 /// <param name="table">The table to decompile.</param> 7043 /// <param name="table">The table to decompile.</param>
7171 private void DecompileODBCSourceAttributeTable(Table table) 7044 private void DecompileODBCSourceAttributeTable(Table table)
7172 { 7045 {
7173 foreach (Row row in table.Rows) 7046 foreach (var row in table.Rows)
7174 { 7047 {
7175 Wix.Property property = new Wix.Property(); 7048 var property = new Wix.Property();
7176 7049
7177 property.Id = Convert.ToString(row[1]); 7050 property.Id = Convert.ToString(row[1]);
7178 7051
@@ -7181,14 +7054,14 @@ namespace WixToolset.Core.WindowsInstaller
7181 property.Value = Convert.ToString(row[2]); 7054 property.Value = Convert.ToString(row[2]);
7182 } 7055 }
7183 7056
7184 Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[0])); 7057 var odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement("ODBCDataSource", Convert.ToString(row[0]));
7185 if (null != odbcDataSource) 7058 if (null != odbcDataSource)
7186 { 7059 {
7187 odbcDataSource.AddChild(property); 7060 odbcDataSource.AddChild(property);
7188 } 7061 }
7189 else 7062 else
7190 { 7063 {
7191 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DataSource_", Convert.ToString(row[0]), "ODBCDataSource")); 7064 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "DataSource_", Convert.ToString(row[0]), "ODBCDataSource"));
7192 } 7065 }
7193 } 7066 }
7194 } 7067 }
@@ -7199,9 +7072,9 @@ namespace WixToolset.Core.WindowsInstaller
7199 /// <param name="table">The table to decompile.</param> 7072 /// <param name="table">The table to decompile.</param>
7200 private void DecompileODBCTranslatorTable(Table table) 7073 private void DecompileODBCTranslatorTable(Table table)
7201 { 7074 {
7202 foreach (Row row in table.Rows) 7075 foreach (var row in table.Rows)
7203 { 7076 {
7204 Wix.ODBCTranslator odbcTranslator = new Wix.ODBCTranslator(); 7077 var odbcTranslator = new Wix.ODBCTranslator();
7205 7078
7206 odbcTranslator.Id = Convert.ToString(row[0]); 7079 odbcTranslator.Id = Convert.ToString(row[0]);
7207 7080
@@ -7214,14 +7087,14 @@ namespace WixToolset.Core.WindowsInstaller
7214 odbcTranslator.SetupFile = Convert.ToString(row[4]); 7087 odbcTranslator.SetupFile = Convert.ToString(row[4]);
7215 } 7088 }
7216 7089
7217 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 7090 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
7218 if (null != component) 7091 if (null != component)
7219 { 7092 {
7220 component.AddChild(odbcTranslator); 7093 component.AddChild(odbcTranslator);
7221 } 7094 }
7222 else 7095 else
7223 { 7096 {
7224 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 7097 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
7225 } 7098 }
7226 } 7099 }
7227 } 7100 }
@@ -7234,111 +7107,111 @@ namespace WixToolset.Core.WindowsInstaller
7234 { 7107 {
7235 if (0 < table.Rows.Count) 7108 if (0 < table.Rows.Count)
7236 { 7109 {
7237 Wix.PatchMetadata patchMetadata = new Wix.PatchMetadata(); 7110 var patchMetadata = new Wix.PatchMetadata();
7238 7111
7239 foreach (Row row in table.Rows) 7112 foreach (var row in table.Rows)
7240 { 7113 {
7241 string value = Convert.ToString(row[2]); 7114 var value = Convert.ToString(row[2]);
7242 7115
7243 switch (Convert.ToString(row[1])) 7116 switch (Convert.ToString(row[1]))
7244 { 7117 {
7245 case "AllowRemoval": 7118 case "AllowRemoval":
7246 if ("1" == value) 7119 if ("1" == value)
7247 { 7120 {
7248 patchMetadata.AllowRemoval = Wix.YesNoType.yes; 7121 patchMetadata.AllowRemoval = Wix.YesNoType.yes;
7249 } 7122 }
7250 break; 7123 break;
7251 case "Classification": 7124 case "Classification":
7252 if (null != value) 7125 if (null != value)
7253 { 7126 {
7254 patchMetadata.Classification = value; 7127 patchMetadata.Classification = value;
7255 } 7128 }
7256 break; 7129 break;
7257 case "CreationTimeUTC": 7130 case "CreationTimeUTC":
7258 if (null != value) 7131 if (null != value)
7259 { 7132 {
7260 patchMetadata.CreationTimeUTC = value; 7133 patchMetadata.CreationTimeUTC = value;
7261 } 7134 }
7262 break; 7135 break;
7263 case "Description": 7136 case "Description":
7264 if (null != value) 7137 if (null != value)
7265 { 7138 {
7266 patchMetadata.Description = value; 7139 patchMetadata.Description = value;
7267 } 7140 }
7268 break; 7141 break;
7269 case "DisplayName": 7142 case "DisplayName":
7270 if (null != value) 7143 if (null != value)
7271 { 7144 {
7272 patchMetadata.DisplayName = value; 7145 patchMetadata.DisplayName = value;
7273 } 7146 }
7274 break; 7147 break;
7275 case "ManufacturerName": 7148 case "ManufacturerName":
7276 if (null != value) 7149 if (null != value)
7277 { 7150 {
7278 patchMetadata.ManufacturerName = value; 7151 patchMetadata.ManufacturerName = value;
7279 } 7152 }
7280 break; 7153 break;
7281 case "MinorUpdateTargetRTM": 7154 case "MinorUpdateTargetRTM":
7282 if (null != value) 7155 if (null != value)
7283 { 7156 {
7284 patchMetadata.MinorUpdateTargetRTM = value; 7157 patchMetadata.MinorUpdateTargetRTM = value;
7285 } 7158 }
7286 break; 7159 break;
7287 case "MoreInfoURL": 7160 case "MoreInfoURL":
7288 if (null != value) 7161 if (null != value)
7289 { 7162 {
7290 patchMetadata.MoreInfoURL = value; 7163 patchMetadata.MoreInfoURL = value;
7291 } 7164 }
7292 break; 7165 break;
7293 case "OptimizeCA": 7166 case "OptimizeCA":
7294 Wix.OptimizeCustomActions optimizeCustomActions = new Wix.OptimizeCustomActions(); 7167 var optimizeCustomActions = new Wix.OptimizeCustomActions();
7295 int optimizeCA = Int32.Parse(value, CultureInfo.InvariantCulture); 7168 var optimizeCA = Int32.Parse(value, CultureInfo.InvariantCulture);
7296 if (0 != (Convert.ToInt32(OptimizeCA.SkipAssignment) & optimizeCA)) 7169 if (0 != (Convert.ToInt32(OptimizeCA.SkipAssignment) & optimizeCA))
7297 { 7170 {
7298 optimizeCustomActions.SkipAssignment = Wix.YesNoType.yes; 7171 optimizeCustomActions.SkipAssignment = Wix.YesNoType.yes;
7299 } 7172 }
7300 7173
7301 if (0 != (Convert.ToInt32(OptimizeCA.SkipImmediate) & optimizeCA)) 7174 if (0 != (Convert.ToInt32(OptimizeCA.SkipImmediate) & optimizeCA))
7302 { 7175 {
7303 optimizeCustomActions.SkipImmediate = Wix.YesNoType.yes; 7176 optimizeCustomActions.SkipImmediate = Wix.YesNoType.yes;
7304 } 7177 }
7305 7178
7306 if (0 != (Convert.ToInt32(OptimizeCA.SkipDeferred) & optimizeCA)) 7179 if (0 != (Convert.ToInt32(OptimizeCA.SkipDeferred) & optimizeCA))
7307 { 7180 {
7308 optimizeCustomActions.SkipDeferred = Wix.YesNoType.yes; 7181 optimizeCustomActions.SkipDeferred = Wix.YesNoType.yes;
7309 } 7182 }
7310 7183
7311 patchMetadata.AddChild(optimizeCustomActions); 7184 patchMetadata.AddChild(optimizeCustomActions);
7312 break; 7185 break;
7313 case "OptimizedInstallMode": 7186 case "OptimizedInstallMode":
7314 if ("1" == value) 7187 if ("1" == value)
7315 { 7188 {
7316 patchMetadata.OptimizedInstallMode = Wix.YesNoType.yes; 7189 patchMetadata.OptimizedInstallMode = Wix.YesNoType.yes;
7317 } 7190 }
7318 break; 7191 break;
7319 case "TargetProductName": 7192 case "TargetProductName":
7320 if (null != value) 7193 if (null != value)
7321 { 7194 {
7322 patchMetadata.TargetProductName = value; 7195 patchMetadata.TargetProductName = value;
7323 } 7196 }
7324 break; 7197 break;
7325 default: 7198 default:
7326 Wix.CustomProperty customProperty = new Wix.CustomProperty(); 7199 var customProperty = new Wix.CustomProperty();
7327 7200
7328 if (null != row[0]) 7201 if (null != row[0])
7329 { 7202 {
7330 customProperty.Company = Convert.ToString(row[0]); 7203 customProperty.Company = Convert.ToString(row[0]);
7331 } 7204 }
7332 7205
7333 customProperty.Property = Convert.ToString(row[1]); 7206 customProperty.Property = Convert.ToString(row[1]);
7334 7207
7335 if (null != row[2]) 7208 if (null != row[2])
7336 { 7209 {
7337 customProperty.Value = Convert.ToString(row[2]); 7210 customProperty.Value = Convert.ToString(row[2]);
7338 } 7211 }
7339 7212
7340 patchMetadata.AddChild(customProperty); 7213 patchMetadata.AddChild(customProperty);
7341 break; 7214 break;
7342 } 7215 }
7343 } 7216 }
7344 7217
@@ -7352,9 +7225,9 @@ namespace WixToolset.Core.WindowsInstaller
7352 /// <param name="table">The table to decompile.</param> 7225 /// <param name="table">The table to decompile.</param>
7353 private void DecompilePatchSequenceTable(Table table) 7226 private void DecompilePatchSequenceTable(Table table)
7354 { 7227 {
7355 foreach (Row row in table.Rows) 7228 foreach (var row in table.Rows)
7356 { 7229 {
7357 Wix.PatchSequence patchSequence = new Wix.PatchSequence(); 7230 var patchSequence = new Wix.PatchSequence();
7358 7231
7359 patchSequence.PatchFamily = Convert.ToString(row[0]); 7232 patchSequence.PatchFamily = Convert.ToString(row[0]);
7360 7233
@@ -7362,7 +7235,7 @@ namespace WixToolset.Core.WindowsInstaller
7362 { 7235 {
7363 try 7236 try
7364 { 7237 {
7365 Guid guid = new Guid(Convert.ToString(row[1])); 7238 var guid = new Guid(Convert.ToString(row[1]));
7366 7239
7367 patchSequence.ProductCode = Convert.ToString(row[1]); 7240 patchSequence.ProductCode = Convert.ToString(row[1]);
7368 } 7241 }
@@ -7392,9 +7265,9 @@ namespace WixToolset.Core.WindowsInstaller
7392 /// <param name="table">The table to decompile.</param> 7265 /// <param name="table">The table to decompile.</param>
7393 private void DecompileProgIdTable(Table table) 7266 private void DecompileProgIdTable(Table table)
7394 { 7267 {
7395 foreach (Row row in table.Rows) 7268 foreach (var row in table.Rows)
7396 { 7269 {
7397 Wix.ProgId progId = new Wix.ProgId(); 7270 var progId = new Wix.ProgId();
7398 7271
7399 progId.Advertise = Wix.YesNoType.yes; 7272 progId.Advertise = Wix.YesNoType.yes;
7400 7273
@@ -7419,13 +7292,13 @@ namespace WixToolset.Core.WindowsInstaller
7419 } 7292 }
7420 7293
7421 // nest the ProgIds 7294 // nest the ProgIds
7422 foreach (Row row in table.Rows) 7295 foreach (var row in table.Rows)
7423 { 7296 {
7424 Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement(row); 7297 var progId = (Wix.ProgId)this.core.GetIndexedElement(row);
7425 7298
7426 if (null != row[1]) 7299 if (null != row[1])
7427 { 7300 {
7428 Wix.ProgId parentProgId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[1])); 7301 var parentProgId = (Wix.ProgId)this.core.GetIndexedElement("ProgId", Convert.ToString(row[1]));
7429 7302
7430 if (null != parentProgId) 7303 if (null != parentProgId)
7431 { 7304 {
@@ -7433,7 +7306,7 @@ namespace WixToolset.Core.WindowsInstaller
7433 } 7306 }
7434 else 7307 else
7435 { 7308 {
7436 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_Parent", Convert.ToString(row[1]), "ProgId")); 7309 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "ProgId_Parent", Convert.ToString(row[1]), "ProgId"));
7437 } 7310 }
7438 } 7311 }
7439 else if (null != row[2]) 7312 else if (null != row[2])
@@ -7453,107 +7326,107 @@ namespace WixToolset.Core.WindowsInstaller
7453 /// <param name="table">The table to decompile.</param> 7326 /// <param name="table">The table to decompile.</param>
7454 private void DecompilePropertiesTable(Table table) 7327 private void DecompilePropertiesTable(Table table)
7455 { 7328 {
7456 Wix.PatchCreation patchCreation = (Wix.PatchCreation)this.core.RootElement; 7329 var patchCreation = (Wix.PatchCreation)this.core.RootElement;
7457 7330
7458 foreach (Row row in table.Rows) 7331 foreach (var row in table.Rows)
7459 { 7332 {
7460 string name = Convert.ToString(row[0]); 7333 var name = Convert.ToString(row[0]);
7461 string value = Convert.ToString(row[1]); 7334 var value = Convert.ToString(row[1]);
7462 7335
7463 switch (name) 7336 switch (name)
7464 { 7337 {
7465 case "AllowProductCodeMismatches": 7338 case "AllowProductCodeMismatches":
7466 if ("1" == value) 7339 if ("1" == value)
7467 { 7340 {
7468 patchCreation.AllowProductCodeMismatches = Wix.YesNoType.yes; 7341 patchCreation.AllowProductCodeMismatches = Wix.YesNoType.yes;
7469 } 7342 }
7470 break; 7343 break;
7471 case "AllowProductVersionMajorMismatches": 7344 case "AllowProductVersionMajorMismatches":
7472 if ("1" == value) 7345 if ("1" == value)
7473 { 7346 {
7474 patchCreation.AllowMajorVersionMismatches = Wix.YesNoType.yes; 7347 patchCreation.AllowMajorVersionMismatches = Wix.YesNoType.yes;
7475 } 7348 }
7476 break; 7349 break;
7477 case "ApiPatchingSymbolFlags": 7350 case "ApiPatchingSymbolFlags":
7478 if (null != value) 7351 if (null != value)
7352 {
7353 try
7479 { 7354 {
7480 try 7355 // remove the leading "0x" if its present
7481 { 7356 if (value.StartsWith("0x", StringComparison.Ordinal))
7482 // remove the leading "0x" if its present
7483 if (value.StartsWith("0x", StringComparison.Ordinal))
7484 {
7485 value = value.Substring(2);
7486 }
7487
7488 patchCreation.SymbolFlags = Convert.ToInt32(value, 16);
7489 }
7490 catch
7491 { 7357 {
7492 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 7358 value = value.Substring(2);
7493 } 7359 }
7360
7361 patchCreation.SymbolFlags = Convert.ToInt32(value, 16);
7494 } 7362 }
7495 break; 7363 catch
7496 case "DontRemoveTempFolderWhenFinished":
7497 if ("1" == value)
7498 { 7364 {
7499 patchCreation.CleanWorkingFolder = Wix.YesNoType.no; 7365 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
7500 } 7366 }
7501 break; 7367 }
7502 case "IncludeWholeFilesOnly": 7368 break;
7503 if ("1" == value) 7369 case "DontRemoveTempFolderWhenFinished":
7504 { 7370 if ("1" == value)
7505 patchCreation.WholeFilesOnly = Wix.YesNoType.yes; 7371 {
7506 } 7372 patchCreation.CleanWorkingFolder = Wix.YesNoType.no;
7507 break; 7373 }
7508 case "ListOfPatchGUIDsToReplace": 7374 break;
7509 if (null != value) 7375 case "IncludeWholeFilesOnly":
7510 { 7376 if ("1" == value)
7511 Regex guidRegex = new Regex(@"\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}"); 7377 {
7512 MatchCollection guidMatches = guidRegex.Matches(value); 7378 patchCreation.WholeFilesOnly = Wix.YesNoType.yes;
7379 }
7380 break;
7381 case "ListOfPatchGUIDsToReplace":
7382 if (null != value)
7383 {
7384 var guidRegex = new Regex(@"\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}");
7385 var guidMatches = guidRegex.Matches(value);
7513 7386
7514 foreach (Match guidMatch in guidMatches) 7387 foreach (Match guidMatch in guidMatches)
7515 { 7388 {
7516 Wix.ReplacePatch replacePatch = new Wix.ReplacePatch(); 7389 var replacePatch = new Wix.ReplacePatch();
7517 7390
7518 replacePatch.Id = guidMatch.Value; 7391 replacePatch.Id = guidMatch.Value;
7519 7392
7520 this.core.RootElement.AddChild(replacePatch); 7393 this.core.RootElement.AddChild(replacePatch);
7521 }
7522 } 7394 }
7523 break; 7395 }
7524 case "ListOfTargetProductCodes": 7396 break;
7525 if (null != value) 7397 case "ListOfTargetProductCodes":
7526 { 7398 if (null != value)
7527 string[] targetProductCodes = value.Split(';'); 7399 {
7400 var targetProductCodes = value.Split(';');
7528 7401
7529 foreach (string targetProductCodeString in targetProductCodes) 7402 foreach (var targetProductCodeString in targetProductCodes)
7530 { 7403 {
7531 Wix.TargetProductCode targetProductCode = new Wix.TargetProductCode(); 7404 var targetProductCode = new Wix.TargetProductCode();
7532 7405
7533 targetProductCode.Id = targetProductCodeString; 7406 targetProductCode.Id = targetProductCodeString;
7534 7407
7535 this.core.RootElement.AddChild(targetProductCode); 7408 this.core.RootElement.AddChild(targetProductCode);
7536 }
7537 } 7409 }
7538 break; 7410 }
7539 case "PatchGUID": 7411 break;
7540 patchCreation.Id = value; 7412 case "PatchGUID":
7541 break; 7413 patchCreation.Id = value;
7542 case "PatchSourceList": 7414 break;
7543 patchCreation.SourceList = value; 7415 case "PatchSourceList":
7544 break; 7416 patchCreation.SourceList = value;
7545 case "PatchOutputPath": 7417 break;
7546 patchCreation.OutputPath = value; 7418 case "PatchOutputPath":
7547 break; 7419 patchCreation.OutputPath = value;
7548 default: 7420 break;
7549 Wix.PatchProperty patchProperty = new Wix.PatchProperty(); 7421 default:
7422 var patchProperty = new Wix.PatchProperty();
7550 7423
7551 patchProperty.Name = name; 7424 patchProperty.Name = name;
7552 7425
7553 patchProperty.Value = value; 7426 patchProperty.Value = value;
7554 7427
7555 this.core.RootElement.AddChild(patchProperty); 7428 this.core.RootElement.AddChild(patchProperty);
7556 break; 7429 break;
7557 } 7430 }
7558 } 7431 }
7559 } 7432 }
@@ -7564,20 +7437,25 @@ namespace WixToolset.Core.WindowsInstaller
7564 /// <param name="table">The table to decompile.</param> 7437 /// <param name="table">The table to decompile.</param>
7565 private void DecompilePropertyTable(Table table) 7438 private void DecompilePropertyTable(Table table)
7566 { 7439 {
7567 foreach (Row row in table.Rows) 7440 foreach (var row in table.Rows)
7568 { 7441 {
7569 string id = Convert.ToString(row[0]); 7442 var id = Convert.ToString(row[0]);
7570 string value = Convert.ToString(row[1]); 7443 var value = Convert.ToString(row[1]);
7571 7444
7572 if ("AdminProperties" == id || "MsiHiddenProperties" == id || "SecureCustomProperties" == id) 7445 if ("AdminProperties" == id || "MsiHiddenProperties" == id || "SecureCustomProperties" == id)
7573 { 7446 {
7574 if (0 < value.Length) 7447 if (0 < value.Length)
7575 { 7448 {
7576 foreach (string propertyId in value.Split(';')) 7449 foreach (var propertyId in value.Split(';'))
7577 { 7450 {
7578 string property = propertyId; 7451 if (Common.DowngradeDetectedProperty == propertyId || Common.UpgradeDetectedProperty == propertyId)
7579 bool suppressModulularization = false; 7452 {
7580 if (OutputType.Module == this.outputType) 7453 continue;
7454 }
7455
7456 var property = propertyId;
7457 var suppressModulularization = false;
7458 if (OutputType.Module == this.OutputType)
7581 { 7459 {
7582 if (propertyId.EndsWith(this.modularizationGuid.Substring(1, 36).Replace('-', '_'), StringComparison.Ordinal)) 7460 if (propertyId.EndsWith(this.modularizationGuid.Substring(1, 36).Replace('-', '_'), StringComparison.Ordinal))
7583 { 7461 {
@@ -7589,7 +7467,7 @@ namespace WixToolset.Core.WindowsInstaller
7589 } 7467 }
7590 } 7468 }
7591 7469
7592 Wix.Property specialProperty = this.EnsureProperty(property); 7470 var specialProperty = this.EnsureProperty(property);
7593 if (suppressModulularization) 7471 if (suppressModulularization)
7594 { 7472 {
7595 specialProperty.SuppressModularization = Wix.YesNoType.yes; 7473 specialProperty.SuppressModularization = Wix.YesNoType.yes;
@@ -7597,51 +7475,51 @@ namespace WixToolset.Core.WindowsInstaller
7597 7475
7598 switch (id) 7476 switch (id)
7599 { 7477 {
7600 case "AdminProperties": 7478 case "AdminProperties":
7601 specialProperty.Admin = Wix.YesNoType.yes; 7479 specialProperty.Admin = Wix.YesNoType.yes;
7602 break; 7480 break;
7603 case "MsiHiddenProperties": 7481 case "MsiHiddenProperties":
7604 specialProperty.Hidden = Wix.YesNoType.yes; 7482 specialProperty.Hidden = Wix.YesNoType.yes;
7605 break; 7483 break;
7606 case "SecureCustomProperties": 7484 case "SecureCustomProperties":
7607 specialProperty.Secure = Wix.YesNoType.yes; 7485 specialProperty.Secure = Wix.YesNoType.yes;
7608 break; 7486 break;
7609 } 7487 }
7610 } 7488 }
7611 } 7489 }
7612 7490
7613 continue; 7491 continue;
7614 } 7492 }
7615 else if (OutputType.Product == this.outputType) 7493 else if (OutputType.Product == this.OutputType)
7616 { 7494 {
7617 Wix.Product product = (Wix.Product)this.core.RootElement; 7495 var product = (Wix.Product)this.core.RootElement;
7618 7496
7619 switch (id) 7497 switch (id)
7620 { 7498 {
7621 case "Manufacturer": 7499 case "Manufacturer":
7622 product.Manufacturer = value; 7500 product.Manufacturer = value;
7623 continue; 7501 continue;
7624 case "ProductCode": 7502 case "ProductCode":
7625 product.Id = value.ToUpper(CultureInfo.InvariantCulture); 7503 product.Id = value.ToUpper(CultureInfo.InvariantCulture);
7626 continue; 7504 continue;
7627 case "ProductLanguage": 7505 case "ProductLanguage":
7628 product.Language = value; 7506 product.Language = value;
7629 continue; 7507 continue;
7630 case "ProductName": 7508 case "ProductName":
7631 product.Name = value; 7509 product.Name = value;
7632 continue; 7510 continue;
7633 case "ProductVersion": 7511 case "ProductVersion":
7634 product.Version = value; 7512 product.Version = value;
7635 continue; 7513 continue;
7636 case "UpgradeCode": 7514 case "UpgradeCode":
7637 product.UpgradeCode = value; 7515 product.UpgradeCode = value;
7638 continue; 7516 continue;
7639 } 7517 }
7640 } 7518 }
7641 7519
7642 if (!this.suppressUI || "ErrorDialog" != id) 7520 if (!this.SuppressUI || "ErrorDialog" != id)
7643 { 7521 {
7644 Wix.Property property = this.EnsureProperty(id); 7522 var property = this.EnsureProperty(id);
7645 7523
7646 property.Value = value; 7524 property.Value = value;
7647 } 7525 }
@@ -7654,9 +7532,9 @@ namespace WixToolset.Core.WindowsInstaller
7654 /// <param name="table">The table to decompile.</param> 7532 /// <param name="table">The table to decompile.</param>
7655 private void DecompilePublishComponentTable(Table table) 7533 private void DecompilePublishComponentTable(Table table)
7656 { 7534 {
7657 foreach (Row row in table.Rows) 7535 foreach (var row in table.Rows)
7658 { 7536 {
7659 Wix.Category category = new Wix.Category(); 7537 var category = new Wix.Category();
7660 7538
7661 category.Id = Convert.ToString(row[0]); 7539 category.Id = Convert.ToString(row[0]);
7662 7540
@@ -7667,14 +7545,14 @@ namespace WixToolset.Core.WindowsInstaller
7667 category.AppData = Convert.ToString(row[3]); 7545 category.AppData = Convert.ToString(row[3]);
7668 } 7546 }
7669 7547
7670 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2])); 7548 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2]));
7671 if (null != component) 7549 if (null != component)
7672 { 7550 {
7673 component.AddChild(category); 7551 component.AddChild(category);
7674 } 7552 }
7675 else 7553 else
7676 { 7554 {
7677 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[2]), "Component")); 7555 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[2]), "Component"));
7678 } 7556 }
7679 } 7557 }
7680 } 7558 }
@@ -7685,12 +7563,12 @@ namespace WixToolset.Core.WindowsInstaller
7685 /// <param name="table">The table to decompile.</param> 7563 /// <param name="table">The table to decompile.</param>
7686 private void DecompileRadioButtonTable(Table table) 7564 private void DecompileRadioButtonTable(Table table)
7687 { 7565 {
7688 SortedList radioButtons = new SortedList(); 7566 var radioButtons = new SortedList();
7689 Hashtable radioButtonGroups = new Hashtable(); 7567 var radioButtonGroups = new Hashtable();
7690 7568
7691 foreach (Row row in table.Rows) 7569 foreach (var row in table.Rows)
7692 { 7570 {
7693 Wix.RadioButton radioButton = new Wix.RadioButton(); 7571 var radioButton = new Wix.RadioButton();
7694 7572
7695 radioButton.Value = Convert.ToString(row[2]); 7573 radioButton.Value = Convert.ToString(row[2]);
7696 7574
@@ -7709,7 +7587,7 @@ namespace WixToolset.Core.WindowsInstaller
7709 7587
7710 if (null != row[8]) 7588 if (null != row[8])
7711 { 7589 {
7712 string[] help = (Convert.ToString(row[8])).Split('|'); 7590 var help = (Convert.ToString(row[8])).Split('|');
7713 7591
7714 if (2 == help.Length) 7592 if (2 == help.Length)
7715 { 7593 {
@@ -7732,8 +7610,8 @@ namespace WixToolset.Core.WindowsInstaller
7732 // nest the radio buttons 7610 // nest the radio buttons
7733 foreach (Row row in radioButtons.Values) 7611 foreach (Row row in radioButtons.Values)
7734 { 7612 {
7735 Wix.RadioButton radioButton = (Wix.RadioButton)this.core.GetIndexedElement(row); 7613 var radioButton = (Wix.RadioButton)this.core.GetIndexedElement(row);
7736 Wix.RadioButtonGroup radioButtonGroup = (Wix.RadioButtonGroup)radioButtonGroups[Convert.ToString(row[0])]; 7614 var radioButtonGroup = (Wix.RadioButtonGroup)radioButtonGroups[Convert.ToString(row[0])];
7737 7615
7738 if (null == radioButtonGroup) 7616 if (null == radioButtonGroup)
7739 { 7617 {
@@ -7755,16 +7633,15 @@ namespace WixToolset.Core.WindowsInstaller
7755 /// <param name="table">The table to decompile.</param> 7633 /// <param name="table">The table to decompile.</param>
7756 private void DecompileRegistryTable(Table table) 7634 private void DecompileRegistryTable(Table table)
7757 { 7635 {
7758 foreach (Row row in table.Rows) 7636 foreach (var row in table.Rows)
7759 { 7637 {
7760 if (("-" == Convert.ToString(row[3]) || "+" == Convert.ToString(row[3]) || "*" == Convert.ToString(row[3])) && null == row[4]) 7638 if (("-" == Convert.ToString(row[3]) || "+" == Convert.ToString(row[3]) || "*" == Convert.ToString(row[3])) && null == row[4])
7761 { 7639 {
7762 Wix.RegistryKey registryKey = new Wix.RegistryKey(); 7640 var registryKey = new Wix.RegistryKey();
7763 7641
7764 registryKey.Id = Convert.ToString(row[0]); 7642 registryKey.Id = Convert.ToString(row[0]);
7765 7643
7766 Wix.RegistryRootType registryRootType; 7644 if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out var registryRootType))
7767 if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType))
7768 { 7645 {
7769 registryKey.Root = registryRootType; 7646 registryKey.Root = registryRootType;
7770 } 7647 }
@@ -7773,28 +7650,27 @@ namespace WixToolset.Core.WindowsInstaller
7773 7650
7774 switch (Convert.ToString(row[3])) 7651 switch (Convert.ToString(row[3]))
7775 { 7652 {
7776 case "+": 7653 case "+":
7777 registryKey.ForceCreateOnInstall = Wix.YesNoType.yes; 7654 registryKey.ForceCreateOnInstall = Wix.YesNoType.yes;
7778 break; 7655 break;
7779 case "-": 7656 case "-":
7780 registryKey.ForceDeleteOnUninstall = Wix.YesNoType.yes; 7657 registryKey.ForceDeleteOnUninstall = Wix.YesNoType.yes;
7781 break; 7658 break;
7782 case "*": 7659 case "*":
7783 registryKey.ForceDeleteOnUninstall = Wix.YesNoType.yes; 7660 registryKey.ForceDeleteOnUninstall = Wix.YesNoType.yes;
7784 registryKey.ForceCreateOnInstall = Wix.YesNoType.yes; 7661 registryKey.ForceCreateOnInstall = Wix.YesNoType.yes;
7785 break; 7662 break;
7786 } 7663 }
7787 7664
7788 this.core.IndexElement(row, registryKey); 7665 this.core.IndexElement(row, registryKey);
7789 } 7666 }
7790 else 7667 else
7791 { 7668 {
7792 Wix.RegistryValue registryValue = new Wix.RegistryValue(); 7669 var registryValue = new Wix.RegistryValue();
7793 7670
7794 registryValue.Id = Convert.ToString(row[0]); 7671 registryValue.Id = Convert.ToString(row[0]);
7795 7672
7796 Wix.RegistryRootType registryRootType; 7673 if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out var registryRootType))
7797 if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType))
7798 { 7674 {
7799 registryValue.Root = registryRootType; 7675 registryValue.Root = registryRootType;
7800 } 7676 }
@@ -7808,7 +7684,7 @@ namespace WixToolset.Core.WindowsInstaller
7808 7684
7809 if (null != row[4]) 7685 if (null != row[4])
7810 { 7686 {
7811 string value = Convert.ToString(row[4]); 7687 var value = Convert.ToString(row[4]);
7812 7688
7813 if (value.StartsWith("#x", StringComparison.Ordinal)) 7689 if (value.StartsWith("#x", StringComparison.Ordinal))
7814 { 7690 {
@@ -7838,7 +7714,7 @@ namespace WixToolset.Core.WindowsInstaller
7838 7714
7839 if ("[~]" == value) 7715 if ("[~]" == value)
7840 { 7716 {
7841 value = string.Empty; 7717 value = String.Empty;
7842 } 7718 }
7843 else if (value.StartsWith("[~]", StringComparison.Ordinal) && value.EndsWith("[~]", StringComparison.Ordinal)) 7719 else if (value.StartsWith("[~]", StringComparison.Ordinal) && value.EndsWith("[~]", StringComparison.Ordinal))
7844 { 7720 {
@@ -7855,10 +7731,10 @@ namespace WixToolset.Core.WindowsInstaller
7855 value = value.Substring(0, value.Length - 3); 7731 value = value.Substring(0, value.Length - 3);
7856 } 7732 }
7857 7733
7858 string[] multiValues = NullSplitter.Split(value); 7734 var multiValues = NullSplitter.Split(value);
7859 foreach (string multiValue in multiValues) 7735 foreach (var multiValue in multiValues)
7860 { 7736 {
7861 Wix.MultiStringValue multiStringValue = new Wix.MultiStringValue(); 7737 var multiStringValue = new Wix.MultiStringValue();
7862 7738
7863 multiStringValue.Content = multiValue; 7739 multiStringValue.Content = multiValue;
7864 7740
@@ -7889,29 +7765,29 @@ namespace WixToolset.Core.WindowsInstaller
7889 /// <param name="table">The table to decompile.</param> 7765 /// <param name="table">The table to decompile.</param>
7890 private void DecompileRegLocatorTable(Table table) 7766 private void DecompileRegLocatorTable(Table table)
7891 { 7767 {
7892 foreach (Row row in table.Rows) 7768 foreach (var row in table.Rows)
7893 { 7769 {
7894 Wix.RegistrySearch registrySearch = new Wix.RegistrySearch(); 7770 var registrySearch = new Wix.RegistrySearch();
7895 7771
7896 registrySearch.Id = Convert.ToString(row[0]); 7772 registrySearch.Id = Convert.ToString(row[0]);
7897 7773
7898 switch (Convert.ToInt32(row[1])) 7774 switch (Convert.ToInt32(row[1]))
7899 { 7775 {
7900 case MsiInterop.MsidbRegistryRootClassesRoot: 7776 case MsiInterop.MsidbRegistryRootClassesRoot:
7901 registrySearch.Root = Wix.RegistrySearch.RootType.HKCR; 7777 registrySearch.Root = Wix.RegistrySearch.RootType.HKCR;
7902 break; 7778 break;
7903 case MsiInterop.MsidbRegistryRootCurrentUser: 7779 case MsiInterop.MsidbRegistryRootCurrentUser:
7904 registrySearch.Root = Wix.RegistrySearch.RootType.HKCU; 7780 registrySearch.Root = Wix.RegistrySearch.RootType.HKCU;
7905 break; 7781 break;
7906 case MsiInterop.MsidbRegistryRootLocalMachine: 7782 case MsiInterop.MsidbRegistryRootLocalMachine:
7907 registrySearch.Root = Wix.RegistrySearch.RootType.HKLM; 7783 registrySearch.Root = Wix.RegistrySearch.RootType.HKLM;
7908 break; 7784 break;
7909 case MsiInterop.MsidbRegistryRootUsers: 7785 case MsiInterop.MsidbRegistryRootUsers:
7910 registrySearch.Root = Wix.RegistrySearch.RootType.HKU; 7786 registrySearch.Root = Wix.RegistrySearch.RootType.HKU;
7911 break; 7787 break;
7912 default: 7788 default:
7913 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1])); 7789 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
7914 break; 7790 break;
7915 } 7791 }
7916 7792
7917 registrySearch.Key = Convert.ToString(row[2]); 7793 registrySearch.Key = Convert.ToString(row[2]);
@@ -7927,7 +7803,7 @@ namespace WixToolset.Core.WindowsInstaller
7927 } 7803 }
7928 else 7804 else
7929 { 7805 {
7930 int type = Convert.ToInt32(row[4]); 7806 var type = Convert.ToInt32(row[4]);
7931 7807
7932 if (MsiInterop.MsidbLocatorType64bit == (type & MsiInterop.MsidbLocatorType64bit)) 7808 if (MsiInterop.MsidbLocatorType64bit == (type & MsiInterop.MsidbLocatorType64bit))
7933 { 7809 {
@@ -7937,18 +7813,18 @@ namespace WixToolset.Core.WindowsInstaller
7937 7813
7938 switch (type) 7814 switch (type)
7939 { 7815 {
7940 case MsiInterop.MsidbLocatorTypeDirectory: 7816 case MsiInterop.MsidbLocatorTypeDirectory:
7941 registrySearch.Type = Wix.RegistrySearch.TypeType.directory; 7817 registrySearch.Type = Wix.RegistrySearch.TypeType.directory;
7942 break; 7818 break;
7943 case MsiInterop.MsidbLocatorTypeFileName: 7819 case MsiInterop.MsidbLocatorTypeFileName:
7944 registrySearch.Type = Wix.RegistrySearch.TypeType.file; 7820 registrySearch.Type = Wix.RegistrySearch.TypeType.file;
7945 break; 7821 break;
7946 case MsiInterop.MsidbLocatorTypeRawValue: 7822 case MsiInterop.MsidbLocatorTypeRawValue:
7947 registrySearch.Type = Wix.RegistrySearch.TypeType.raw; 7823 registrySearch.Type = Wix.RegistrySearch.TypeType.raw;
7948 break; 7824 break;
7949 default: 7825 default:
7950 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); 7826 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4]));
7951 break; 7827 break;
7952 } 7828 }
7953 } 7829 }
7954 7830
@@ -7962,11 +7838,11 @@ namespace WixToolset.Core.WindowsInstaller
7962 /// <param name="table">The table to decompile.</param> 7838 /// <param name="table">The table to decompile.</param>
7963 private void DecompileRemoveFileTable(Table table) 7839 private void DecompileRemoveFileTable(Table table)
7964 { 7840 {
7965 foreach (Row row in table.Rows) 7841 foreach (var row in table.Rows)
7966 { 7842 {
7967 if (null == row[2]) 7843 if (null == row[2])
7968 { 7844 {
7969 Wix.RemoveFolder removeFolder = new Wix.RemoveFolder(); 7845 var removeFolder = new Wix.RemoveFolder();
7970 7846
7971 removeFolder.Id = Convert.ToString(row[0]); 7847 removeFolder.Id = Convert.ToString(row[0]);
7972 7848
@@ -7974,38 +7850,38 @@ namespace WixToolset.Core.WindowsInstaller
7974 7850
7975 switch (Convert.ToInt32(row[4])) 7851 switch (Convert.ToInt32(row[4]))
7976 { 7852 {
7977 case MsiInterop.MsidbRemoveFileInstallModeOnInstall: 7853 case MsiInterop.MsidbRemoveFileInstallModeOnInstall:
7978 removeFolder.On = Wix.InstallUninstallType.install; 7854 removeFolder.On = Wix.InstallUninstallType.install;
7979 break; 7855 break;
7980 case MsiInterop.MsidbRemoveFileInstallModeOnRemove: 7856 case MsiInterop.MsidbRemoveFileInstallModeOnRemove:
7981 removeFolder.On = Wix.InstallUninstallType.uninstall; 7857 removeFolder.On = Wix.InstallUninstallType.uninstall;
7982 break; 7858 break;
7983 case MsiInterop.MsidbRemoveFileInstallModeOnBoth: 7859 case MsiInterop.MsidbRemoveFileInstallModeOnBoth:
7984 removeFolder.On = Wix.InstallUninstallType.both; 7860 removeFolder.On = Wix.InstallUninstallType.both;
7985 break; 7861 break;
7986 default: 7862 default:
7987 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); 7863 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4]));
7988 break; 7864 break;
7989 } 7865 }
7990 7866
7991 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 7867 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
7992 if (null != component) 7868 if (null != component)
7993 { 7869 {
7994 component.AddChild(removeFolder); 7870 component.AddChild(removeFolder);
7995 } 7871 }
7996 else 7872 else
7997 { 7873 {
7998 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 7874 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
7999 } 7875 }
8000 this.core.IndexElement(row, removeFolder); 7876 this.core.IndexElement(row, removeFolder);
8001 } 7877 }
8002 else 7878 else
8003 { 7879 {
8004 Wix.RemoveFile removeFile = new Wix.RemoveFile(); 7880 var removeFile = new Wix.RemoveFile();
8005 7881
8006 removeFile.Id = Convert.ToString(row[0]); 7882 removeFile.Id = Convert.ToString(row[0]);
8007 7883
8008 string[] names = Common.GetNames(Convert.ToString(row[2])); 7884 var names = Common.GetNames(Convert.ToString(row[2]));
8009 if (null != names[0] && null != names[1]) 7885 if (null != names[0] && null != names[1])
8010 { 7886 {
8011 removeFile.ShortName = names[0]; 7887 removeFile.ShortName = names[0];
@@ -8020,28 +7896,28 @@ namespace WixToolset.Core.WindowsInstaller
8020 7896
8021 switch (Convert.ToInt32(row[4])) 7897 switch (Convert.ToInt32(row[4]))
8022 { 7898 {
8023 case MsiInterop.MsidbRemoveFileInstallModeOnInstall: 7899 case MsiInterop.MsidbRemoveFileInstallModeOnInstall:
8024 removeFile.On = Wix.InstallUninstallType.install; 7900 removeFile.On = Wix.InstallUninstallType.install;
8025 break; 7901 break;
8026 case MsiInterop.MsidbRemoveFileInstallModeOnRemove: 7902 case MsiInterop.MsidbRemoveFileInstallModeOnRemove:
8027 removeFile.On = Wix.InstallUninstallType.uninstall; 7903 removeFile.On = Wix.InstallUninstallType.uninstall;
8028 break; 7904 break;
8029 case MsiInterop.MsidbRemoveFileInstallModeOnBoth: 7905 case MsiInterop.MsidbRemoveFileInstallModeOnBoth:
8030 removeFile.On = Wix.InstallUninstallType.both; 7906 removeFile.On = Wix.InstallUninstallType.both;
8031 break; 7907 break;
8032 default: 7908 default:
8033 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); 7909 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4]));
8034 break; 7910 break;
8035 } 7911 }
8036 7912
8037 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 7913 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
8038 if (null != component) 7914 if (null != component)
8039 { 7915 {
8040 component.AddChild(removeFile); 7916 component.AddChild(removeFile);
8041 } 7917 }
8042 else 7918 else
8043 { 7919 {
8044 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 7920 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
8045 } 7921 }
8046 this.core.IndexElement(row, removeFile); 7922 this.core.IndexElement(row, removeFile);
8047 } 7923 }
@@ -8054,13 +7930,13 @@ namespace WixToolset.Core.WindowsInstaller
8054 /// <param name="table">The table to decompile.</param> 7930 /// <param name="table">The table to decompile.</param>
8055 private void DecompileRemoveIniFileTable(Table table) 7931 private void DecompileRemoveIniFileTable(Table table)
8056 { 7932 {
8057 foreach (Row row in table.Rows) 7933 foreach (var row in table.Rows)
8058 { 7934 {
8059 Wix.IniFile iniFile = new Wix.IniFile(); 7935 var iniFile = new Wix.IniFile();
8060 7936
8061 iniFile.Id = Convert.ToString(row[0]); 7937 iniFile.Id = Convert.ToString(row[0]);
8062 7938
8063 string[] names = Common.GetNames(Convert.ToString(row[1])); 7939 var names = Common.GetNames(Convert.ToString(row[1]));
8064 if (null != names[0] && null != names[1]) 7940 if (null != names[0] && null != names[1])
8065 { 7941 {
8066 iniFile.ShortName = names[0]; 7942 iniFile.ShortName = names[0];
@@ -8087,25 +7963,25 @@ namespace WixToolset.Core.WindowsInstaller
8087 7963
8088 switch (Convert.ToInt32(row[6])) 7964 switch (Convert.ToInt32(row[6]))
8089 { 7965 {
8090 case MsiInterop.MsidbIniFileActionRemoveLine: 7966 case MsiInterop.MsidbIniFileActionRemoveLine:
8091 iniFile.Action = Wix.IniFile.ActionType.removeLine; 7967 iniFile.Action = Wix.IniFile.ActionType.removeLine;
8092 break; 7968 break;
8093 case MsiInterop.MsidbIniFileActionRemoveTag: 7969 case MsiInterop.MsidbIniFileActionRemoveTag:
8094 iniFile.Action = Wix.IniFile.ActionType.removeTag; 7970 iniFile.Action = Wix.IniFile.ActionType.removeTag;
8095 break; 7971 break;
8096 default: 7972 default:
8097 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6])); 7973 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[6].Column.Name, row[6]));
8098 break; 7974 break;
8099 } 7975 }
8100 7976
8101 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[7])); 7977 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[7]));
8102 if (null != component) 7978 if (null != component)
8103 { 7979 {
8104 component.AddChild(iniFile); 7980 component.AddChild(iniFile);
8105 } 7981 }
8106 else 7982 else
8107 { 7983 {
8108 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[7]), "Component")); 7984 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[7]), "Component"));
8109 } 7985 }
8110 } 7986 }
8111 } 7987 }
@@ -8116,16 +7992,15 @@ namespace WixToolset.Core.WindowsInstaller
8116 /// <param name="table">The table to decompile.</param> 7992 /// <param name="table">The table to decompile.</param>
8117 private void DecompileRemoveRegistryTable(Table table) 7993 private void DecompileRemoveRegistryTable(Table table)
8118 { 7994 {
8119 foreach (Row row in table.Rows) 7995 foreach (var row in table.Rows)
8120 { 7996 {
8121 if ("-" == Convert.ToString(row[3])) 7997 if ("-" == Convert.ToString(row[3]))
8122 { 7998 {
8123 Wix.RemoveRegistryKey removeRegistryKey = new Wix.RemoveRegistryKey(); 7999 var removeRegistryKey = new Wix.RemoveRegistryKey();
8124 8000
8125 removeRegistryKey.Id = Convert.ToString(row[0]); 8001 removeRegistryKey.Id = Convert.ToString(row[0]);
8126 8002
8127 Wix.RegistryRootType registryRootType; 8003 if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out var registryRootType))
8128 if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType))
8129 { 8004 {
8130 removeRegistryKey.Root = registryRootType; 8005 removeRegistryKey.Root = registryRootType;
8131 } 8006 }
@@ -8134,24 +8009,23 @@ namespace WixToolset.Core.WindowsInstaller
8134 8009
8135 removeRegistryKey.Action = Wix.RemoveRegistryKey.ActionType.removeOnInstall; 8010 removeRegistryKey.Action = Wix.RemoveRegistryKey.ActionType.removeOnInstall;
8136 8011
8137 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[4])); 8012 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[4]));
8138 if (null != component) 8013 if (null != component)
8139 { 8014 {
8140 component.AddChild(removeRegistryKey); 8015 component.AddChild(removeRegistryKey);
8141 } 8016 }
8142 else 8017 else
8143 { 8018 {
8144 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[4]), "Component")); 8019 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[4]), "Component"));
8145 } 8020 }
8146 } 8021 }
8147 else 8022 else
8148 { 8023 {
8149 Wix.RemoveRegistryValue removeRegistryValue = new Wix.RemoveRegistryValue(); 8024 var removeRegistryValue = new Wix.RemoveRegistryValue();
8150 8025
8151 removeRegistryValue.Id = Convert.ToString(row[0]); 8026 removeRegistryValue.Id = Convert.ToString(row[0]);
8152 8027
8153 Wix.RegistryRootType registryRootType; 8028 if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out var registryRootType))
8154 if (this.GetRegistryRootType(row.SourceLineNumbers, table.Name, row.Fields[1], out registryRootType))
8155 { 8029 {
8156 removeRegistryValue.Root = registryRootType; 8030 removeRegistryValue.Root = registryRootType;
8157 } 8031 }
@@ -8163,14 +8037,14 @@ namespace WixToolset.Core.WindowsInstaller
8163 removeRegistryValue.Name = Convert.ToString(row[3]); 8037 removeRegistryValue.Name = Convert.ToString(row[3]);
8164 } 8038 }
8165 8039
8166 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[4])); 8040 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[4]));
8167 if (null != component) 8041 if (null != component)
8168 { 8042 {
8169 component.AddChild(removeRegistryValue); 8043 component.AddChild(removeRegistryValue);
8170 } 8044 }
8171 else 8045 else
8172 { 8046 {
8173 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[4]), "Component")); 8047 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[4]), "Component"));
8174 } 8048 }
8175 } 8049 }
8176 } 8050 }
@@ -8182,9 +8056,9 @@ namespace WixToolset.Core.WindowsInstaller
8182 /// <param name="table">The table to decompile.</param> 8056 /// <param name="table">The table to decompile.</param>
8183 private void DecompileReserveCostTable(Table table) 8057 private void DecompileReserveCostTable(Table table)
8184 { 8058 {
8185 foreach (Row row in table.Rows) 8059 foreach (var row in table.Rows)
8186 { 8060 {
8187 Wix.ReserveCost reserveCost = new Wix.ReserveCost(); 8061 var reserveCost = new Wix.ReserveCost();
8188 8062
8189 reserveCost.Id = Convert.ToString(row[0]); 8063 reserveCost.Id = Convert.ToString(row[0]);
8190 8064
@@ -8197,14 +8071,14 @@ namespace WixToolset.Core.WindowsInstaller
8197 8071
8198 reserveCost.RunFromSource = Convert.ToInt32(row[4]); 8072 reserveCost.RunFromSource = Convert.ToInt32(row[4]);
8199 8073
8200 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1])); 8074 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
8201 if (null != component) 8075 if (null != component)
8202 { 8076 {
8203 component.AddChild(reserveCost); 8077 component.AddChild(reserveCost);
8204 } 8078 }
8205 else 8079 else
8206 { 8080 {
8207 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component")); 8081 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[1]), "Component"));
8208 } 8082 }
8209 } 8083 }
8210 } 8084 }
@@ -8215,9 +8089,9 @@ namespace WixToolset.Core.WindowsInstaller
8215 /// <param name="table">The table to decompile.</param> 8089 /// <param name="table">The table to decompile.</param>
8216 private void DecompileSelfRegTable(Table table) 8090 private void DecompileSelfRegTable(Table table)
8217 { 8091 {
8218 foreach (Row row in table.Rows) 8092 foreach (var row in table.Rows)
8219 { 8093 {
8220 Wix.File file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0])); 8094 var file = (Wix.File)this.core.GetIndexedElement("File", Convert.ToString(row[0]));
8221 8095
8222 if (null != file) 8096 if (null != file)
8223 { 8097 {
@@ -8232,7 +8106,7 @@ namespace WixToolset.Core.WindowsInstaller
8232 } 8106 }
8233 else 8107 else
8234 { 8108 {
8235 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File")); 8109 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "File_", Convert.ToString(row[0]), "File"));
8236 } 8110 }
8237 } 8111 }
8238 } 8112 }
@@ -8243,15 +8117,15 @@ namespace WixToolset.Core.WindowsInstaller
8243 /// <param name="table">The table to decompile.</param> 8117 /// <param name="table">The table to decompile.</param>
8244 private void DecompileServiceControlTable(Table table) 8118 private void DecompileServiceControlTable(Table table)
8245 { 8119 {
8246 foreach (Row row in table.Rows) 8120 foreach (var row in table.Rows)
8247 { 8121 {
8248 Wix.ServiceControl serviceControl = new Wix.ServiceControl(); 8122 var serviceControl = new Wix.ServiceControl();
8249 8123
8250 serviceControl.Id = Convert.ToString(row[0]); 8124 serviceControl.Id = Convert.ToString(row[0]);
8251 8125
8252 serviceControl.Name = Convert.ToString(row[1]); 8126 serviceControl.Name = Convert.ToString(row[1]);
8253 8127
8254 int eventValue = Convert.ToInt32(row[2]); 8128 var eventValue = Convert.ToInt32(row[2]);
8255 if (MsiInterop.MsidbServiceControlEventStart == (eventValue & MsiInterop.MsidbServiceControlEventStart) && 8129 if (MsiInterop.MsidbServiceControlEventStart == (eventValue & MsiInterop.MsidbServiceControlEventStart) &&
8256 MsiInterop.MsidbServiceControlEventUninstallStart == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStart)) 8130 MsiInterop.MsidbServiceControlEventUninstallStart == (eventValue & MsiInterop.MsidbServiceControlEventUninstallStart))
8257 { 8131 {
@@ -8296,11 +8170,11 @@ namespace WixToolset.Core.WindowsInstaller
8296 8170
8297 if (null != row[3]) 8171 if (null != row[3])
8298 { 8172 {
8299 string[] arguments = NullSplitter.Split(Convert.ToString(row[3])); 8173 var arguments = NullSplitter.Split(Convert.ToString(row[3]));
8300 8174
8301 foreach (string argument in arguments) 8175 foreach (var argument in arguments)
8302 { 8176 {
8303 Wix.ServiceArgument serviceArgument = new Wix.ServiceArgument(); 8177 var serviceArgument = new Wix.ServiceArgument();
8304 8178
8305 serviceArgument.Content = argument; 8179 serviceArgument.Content = argument;
8306 8180
@@ -8320,14 +8194,14 @@ namespace WixToolset.Core.WindowsInstaller
8320 } 8194 }
8321 } 8195 }
8322 8196
8323 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5])); 8197 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5]));
8324 if (null != component) 8198 if (null != component)
8325 { 8199 {
8326 component.AddChild(serviceControl); 8200 component.AddChild(serviceControl);
8327 } 8201 }
8328 else 8202 else
8329 { 8203 {
8330 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[5]), "Component")); 8204 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[5]), "Component"));
8331 } 8205 }
8332 } 8206 }
8333 } 8207 }
@@ -8338,9 +8212,9 @@ namespace WixToolset.Core.WindowsInstaller
8338 /// <param name="table">The table to decompile.</param> 8212 /// <param name="table">The table to decompile.</param>
8339 private void DecompileServiceInstallTable(Table table) 8213 private void DecompileServiceInstallTable(Table table)
8340 { 8214 {
8341 foreach (Row row in table.Rows) 8215 foreach (var row in table.Rows)
8342 { 8216 {
8343 Wix.ServiceInstall serviceInstall = new Wix.ServiceInstall(); 8217 var serviceInstall = new Wix.ServiceInstall();
8344 8218
8345 serviceInstall.Id = Convert.ToString(row[0]); 8219 serviceInstall.Id = Convert.ToString(row[0]);
8346 8220
@@ -8351,7 +8225,7 @@ namespace WixToolset.Core.WindowsInstaller
8351 serviceInstall.DisplayName = Convert.ToString(row[2]); 8225 serviceInstall.DisplayName = Convert.ToString(row[2]);
8352 } 8226 }
8353 8227
8354 int serviceType = Convert.ToInt32(row[3]); 8228 var serviceType = Convert.ToInt32(row[3]);
8355 if (MsiInterop.MsidbServiceInstallInteractive == (serviceType & MsiInterop.MsidbServiceInstallInteractive)) 8229 if (MsiInterop.MsidbServiceInstallInteractive == (serviceType & MsiInterop.MsidbServiceInstallInteractive))
8356 { 8230 {
8357 serviceInstall.Interactive = Wix.YesNoType.yes; 8231 serviceInstall.Interactive = Wix.YesNoType.yes;
@@ -8371,7 +8245,7 @@ namespace WixToolset.Core.WindowsInstaller
8371 serviceInstall.Type = Wix.ServiceInstall.TypeType.shareProcess; 8245 serviceInstall.Type = Wix.ServiceInstall.TypeType.shareProcess;
8372 } 8246 }
8373 8247
8374 int startType = Convert.ToInt32(row[4]); 8248 var startType = Convert.ToInt32(row[4]);
8375 if (MsiInterop.MsidbServiceInstallDisabled == startType) 8249 if (MsiInterop.MsidbServiceInstallDisabled == startType)
8376 { 8250 {
8377 serviceInstall.Start = Wix.ServiceInstall.StartType.disabled; 8251 serviceInstall.Start = Wix.ServiceInstall.StartType.disabled;
@@ -8386,10 +8260,10 @@ namespace WixToolset.Core.WindowsInstaller
8386 } 8260 }
8387 else 8261 else
8388 { 8262 {
8389 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4])); 8263 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[4].Column.Name, row[4]));
8390 } 8264 }
8391 8265
8392 int errorControl = Convert.ToInt32(row[5]); 8266 var errorControl = Convert.ToInt32(row[5]);
8393 if (MsiInterop.MsidbServiceInstallErrorCritical == (errorControl & MsiInterop.MsidbServiceInstallErrorCritical)) 8267 if (MsiInterop.MsidbServiceInstallErrorCritical == (errorControl & MsiInterop.MsidbServiceInstallErrorCritical))
8394 { 8268 {
8395 serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.critical; 8269 serviceInstall.ErrorControl = Wix.ServiceInstall.ErrorControlType.critical;
@@ -8415,13 +8289,13 @@ namespace WixToolset.Core.WindowsInstaller
8415 8289
8416 if (null != row[7]) 8290 if (null != row[7])
8417 { 8291 {
8418 string[] dependencies = NullSplitter.Split(Convert.ToString(row[7])); 8292 var dependencies = NullSplitter.Split(Convert.ToString(row[7]));
8419 8293
8420 foreach (string dependency in dependencies) 8294 foreach (var dependency in dependencies)
8421 { 8295 {
8422 if (0 < dependency.Length) 8296 if (0 < dependency.Length)
8423 { 8297 {
8424 Wix.ServiceDependency serviceDependency = new Wix.ServiceDependency(); 8298 var serviceDependency = new Wix.ServiceDependency();
8425 8299
8426 if (dependency.StartsWith("+", StringComparison.Ordinal)) 8300 if (dependency.StartsWith("+", StringComparison.Ordinal))
8427 { 8301 {
@@ -8458,14 +8332,14 @@ namespace WixToolset.Core.WindowsInstaller
8458 serviceInstall.Description = Convert.ToString(row[12]); 8332 serviceInstall.Description = Convert.ToString(row[12]);
8459 } 8333 }
8460 8334
8461 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[11])); 8335 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[11]));
8462 if (null != component) 8336 if (null != component)
8463 { 8337 {
8464 component.AddChild(serviceInstall); 8338 component.AddChild(serviceInstall);
8465 } 8339 }
8466 else 8340 else
8467 { 8341 {
8468 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[11]), "Component")); 8342 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[11]), "Component"));
8469 } 8343 }
8470 this.core.IndexElement(row, serviceInstall); 8344 this.core.IndexElement(row, serviceInstall);
8471 } 8345 }
@@ -8477,9 +8351,9 @@ namespace WixToolset.Core.WindowsInstaller
8477 /// <param name="table">The table to decompile.</param> 8351 /// <param name="table">The table to decompile.</param>
8478 private void DecompileSFPCatalogTable(Table table) 8352 private void DecompileSFPCatalogTable(Table table)
8479 { 8353 {
8480 foreach (Row row in table.Rows) 8354 foreach (var row in table.Rows)
8481 { 8355 {
8482 Wix.SFPCatalog sfpCatalog = new Wix.SFPCatalog(); 8356 var sfpCatalog = new Wix.SFPCatalog();
8483 8357
8484 sfpCatalog.Name = Convert.ToString(row[0]); 8358 sfpCatalog.Name = Convert.ToString(row[0]);
8485 8359
@@ -8489,13 +8363,13 @@ namespace WixToolset.Core.WindowsInstaller
8489 } 8363 }
8490 8364
8491 // nest the SFPCatalog elements 8365 // nest the SFPCatalog elements
8492 foreach (Row row in table.Rows) 8366 foreach (var row in table.Rows)
8493 { 8367 {
8494 Wix.SFPCatalog sfpCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement(row); 8368 var sfpCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement(row);
8495 8369
8496 if (null != row[2]) 8370 if (null != row[2])
8497 { 8371 {
8498 Wix.SFPCatalog parentSFPCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement("SFPCatalog", Convert.ToString(row[2])); 8372 var parentSFPCatalog = (Wix.SFPCatalog)this.core.GetIndexedElement("SFPCatalog", Convert.ToString(row[2]));
8499 8373
8500 if (null != parentSFPCatalog) 8374 if (null != parentSFPCatalog)
8501 { 8375 {
@@ -8521,15 +8395,15 @@ namespace WixToolset.Core.WindowsInstaller
8521 /// <param name="table">The table to decompile.</param> 8395 /// <param name="table">The table to decompile.</param>
8522 private void DecompileShortcutTable(Table table) 8396 private void DecompileShortcutTable(Table table)
8523 { 8397 {
8524 foreach (Row row in table.Rows) 8398 foreach (var row in table.Rows)
8525 { 8399 {
8526 Wix.Shortcut shortcut = new Wix.Shortcut(); 8400 var shortcut = new Wix.Shortcut();
8527 8401
8528 shortcut.Id = Convert.ToString(row[0]); 8402 shortcut.Id = Convert.ToString(row[0]);
8529 8403
8530 shortcut.Directory = Convert.ToString(row[1]); 8404 shortcut.Directory = Convert.ToString(row[1]);
8531 8405
8532 string[] names = Common.GetNames(Convert.ToString(row[2])); 8406 var names = Common.GetNames(Convert.ToString(row[2]));
8533 if (null != names[0] && null != names[1]) 8407 if (null != names[0] && null != names[1])
8534 { 8408 {
8535 shortcut.ShortName = names[0]; 8409 shortcut.ShortName = names[0];
@@ -8540,7 +8414,7 @@ namespace WixToolset.Core.WindowsInstaller
8540 shortcut.Name = names[0]; 8414 shortcut.Name = names[0];
8541 } 8415 }
8542 8416
8543 string target = Convert.ToString(row[4]); 8417 var target = Convert.ToString(row[4]);
8544 if (target.StartsWith("[", StringComparison.Ordinal) && target.EndsWith("]", StringComparison.Ordinal)) 8418 if (target.StartsWith("[", StringComparison.Ordinal) && target.EndsWith("]", StringComparison.Ordinal))
8545 { 8419 {
8546 // TODO: use this value to do a "more-correct" nesting under the indicated File or CreateDirectory element 8420 // TODO: use this value to do a "more-correct" nesting under the indicated File or CreateDirectory element
@@ -8582,18 +8456,18 @@ namespace WixToolset.Core.WindowsInstaller
8582 { 8456 {
8583 switch (Convert.ToInt32(row[10])) 8457 switch (Convert.ToInt32(row[10]))
8584 { 8458 {
8585 case 1: 8459 case 1:
8586 shortcut.Show = Wix.Shortcut.ShowType.normal; 8460 shortcut.Show = Wix.Shortcut.ShowType.normal;
8587 break; 8461 break;
8588 case 3: 8462 case 3:
8589 shortcut.Show = Wix.Shortcut.ShowType.maximized; 8463 shortcut.Show = Wix.Shortcut.ShowType.maximized;
8590 break; 8464 break;
8591 case 7: 8465 case 7:
8592 shortcut.Show = Wix.Shortcut.ShowType.minimized; 8466 shortcut.Show = Wix.Shortcut.ShowType.minimized;
8593 break; 8467 break;
8594 default: 8468 default:
8595 this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[10].Column.Name, row[10])); 8469 this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[10].Column.Name, row[10]));
8596 break; 8470 break;
8597 } 8471 }
8598 } 8472 }
8599 8473
@@ -8626,14 +8500,14 @@ namespace WixToolset.Core.WindowsInstaller
8626 } 8500 }
8627 } 8501 }
8628 8502
8629 Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[3])); 8503 var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[3]));
8630 if (null != component) 8504 if (null != component)
8631 { 8505 {
8632 component.AddChild(shortcut); 8506 component.AddChild(shortcut);
8633 } 8507 }
8634 else 8508 else
8635 { 8509 {
8636 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[3]), "Component")); 8510 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", Convert.ToString(row[3]), "Component"));
8637 } 8511 }
8638 8512
8639 this.core.IndexElement(row, shortcut); 8513 this.core.IndexElement(row, shortcut);
@@ -8646,13 +8520,13 @@ namespace WixToolset.Core.WindowsInstaller
8646 /// <param name="table">The table to decompile.</param> 8520 /// <param name="table">The table to decompile.</param>
8647 private void DecompileSignatureTable(Table table) 8521 private void DecompileSignatureTable(Table table)
8648 { 8522 {
8649 foreach (Row row in table.Rows) 8523 foreach (var row in table.Rows)
8650 { 8524 {
8651 Wix.FileSearch fileSearch = new Wix.FileSearch(); 8525 var fileSearch = new Wix.FileSearch();
8652 8526
8653 fileSearch.Id = Convert.ToString(row[0]); 8527 fileSearch.Id = Convert.ToString(row[0]);
8654 8528
8655 string[] names = Common.GetNames(Convert.ToString(row[1])); 8529 var names = Common.GetNames(Convert.ToString(row[1]));
8656 if (null != names[0]) 8530 if (null != names[0])
8657 { 8531 {
8658 // it is permissable to just have a long name 8532 // it is permissable to just have a long name
@@ -8716,34 +8590,34 @@ namespace WixToolset.Core.WindowsInstaller
8716 /// <param name="table">The table to decompile.</param> 8590 /// <param name="table">The table to decompile.</param>
8717 private void DecompileTargetFiles_OptionalDataTable(Table table) 8591 private void DecompileTargetFiles_OptionalDataTable(Table table)
8718 { 8592 {
8719 foreach (Row row in table.Rows) 8593 foreach (var row in table.Rows)
8720 { 8594 {
8721 Wix.TargetFile targetFile = (Wix.TargetFile)this.patchTargetFiles[row[0]]; 8595 var targetFile = (Wix.TargetFile)this.patchTargetFiles[row[0]];
8722 if (null == targetFile) 8596 if (null == targetFile)
8723 { 8597 {
8724 targetFile = new Wix.TargetFile(); 8598 targetFile = new Wix.TargetFile();
8725 8599
8726 targetFile.Id = Convert.ToString(row[1]); 8600 targetFile.Id = Convert.ToString(row[1]);
8727 8601
8728 Wix.TargetImage targetImage = (Wix.TargetImage)this.core.GetIndexedElement("TargetImages", Convert.ToString(row[0])); 8602 var targetImage = (Wix.TargetImage)this.core.GetIndexedElement("TargetImages", Convert.ToString(row[0]));
8729 if (null != targetImage) 8603 if (null != targetImage)
8730 { 8604 {
8731 targetImage.AddChild(targetFile); 8605 targetImage.AddChild(targetFile);
8732 } 8606 }
8733 else 8607 else
8734 { 8608 {
8735 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Target", Convert.ToString(row[0]), "TargetImages")); 8609 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Target", Convert.ToString(row[0]), "TargetImages"));
8736 } 8610 }
8737 this.patchTargetFiles.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), targetFile); 8611 this.patchTargetFiles.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), targetFile);
8738 } 8612 }
8739 8613
8740 if (null != row[2]) 8614 if (null != row[2])
8741 { 8615 {
8742 string[] symbolPaths = (Convert.ToString(row[2])).Split(';'); 8616 var symbolPaths = (Convert.ToString(row[2])).Split(';');
8743 8617
8744 foreach (string symbolPathString in symbolPaths) 8618 foreach (var symbolPathString in symbolPaths)
8745 { 8619 {
8746 Wix.SymbolPath symbolPath = new Wix.SymbolPath(); 8620 var symbolPath = new Wix.SymbolPath();
8747 8621
8748 symbolPath.Path = symbolPathString; 8622 symbolPath.Path = symbolPathString;
8749 8623
@@ -8753,14 +8627,14 @@ namespace WixToolset.Core.WindowsInstaller
8753 8627
8754 if (null != row[3] && null != row[4]) 8628 if (null != row[3] && null != row[4])
8755 { 8629 {
8756 string[] ignoreOffsets = (Convert.ToString(row[3])).Split(','); 8630 var ignoreOffsets = (Convert.ToString(row[3])).Split(',');
8757 string[] ignoreLengths = (Convert.ToString(row[4])).Split(','); 8631 var ignoreLengths = (Convert.ToString(row[4])).Split(',');
8758 8632
8759 if (ignoreOffsets.Length == ignoreLengths.Length) 8633 if (ignoreOffsets.Length == ignoreLengths.Length)
8760 { 8634 {
8761 for (int i = 0; i < ignoreOffsets.Length; i++) 8635 for (var i = 0; i < ignoreOffsets.Length; i++)
8762 { 8636 {
8763 Wix.IgnoreRange ignoreRange = new Wix.IgnoreRange(); 8637 var ignoreRange = new Wix.IgnoreRange();
8764 8638
8765 if (ignoreOffsets[i].StartsWith("0x", StringComparison.Ordinal)) 8639 if (ignoreOffsets[i].StartsWith("0x", StringComparison.Ordinal))
8766 { 8640 {
@@ -8803,9 +8677,9 @@ namespace WixToolset.Core.WindowsInstaller
8803 /// <param name="table">The table to decompile.</param> 8677 /// <param name="table">The table to decompile.</param>
8804 private void DecompileTargetImagesTable(Table table) 8678 private void DecompileTargetImagesTable(Table table)
8805 { 8679 {
8806 foreach (Row row in table.Rows) 8680 foreach (var row in table.Rows)
8807 { 8681 {
8808 Wix.TargetImage targetImage = new Wix.TargetImage(); 8682 var targetImage = new Wix.TargetImage();
8809 8683
8810 targetImage.Id = Convert.ToString(row[0]); 8684 targetImage.Id = Convert.ToString(row[0]);
8811 8685
@@ -8813,11 +8687,11 @@ namespace WixToolset.Core.WindowsInstaller
8813 8687
8814 if (null != row[2]) 8688 if (null != row[2])
8815 { 8689 {
8816 string[] symbolPaths = (Convert.ToString(row[3])).Split(';'); 8690 var symbolPaths = (Convert.ToString(row[3])).Split(';');
8817 8691
8818 foreach (string symbolPathString in symbolPaths) 8692 foreach (var symbolPathString in symbolPaths)
8819 { 8693 {
8820 Wix.SymbolPath symbolPath = new Wix.SymbolPath(); 8694 var symbolPath = new Wix.SymbolPath();
8821 8695
8822 symbolPath.Path = symbolPathString; 8696 symbolPath.Path = symbolPathString;
8823 8697
@@ -8837,14 +8711,14 @@ namespace WixToolset.Core.WindowsInstaller
8837 targetImage.IgnoreMissingFiles = Wix.YesNoType.yes; 8711 targetImage.IgnoreMissingFiles = Wix.YesNoType.yes;
8838 } 8712 }
8839 8713
8840 Wix.UpgradeImage upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[3])); 8714 var upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[3]));
8841 if (null != upgradeImage) 8715 if (null != upgradeImage)
8842 { 8716 {
8843 upgradeImage.AddChild(targetImage); 8717 upgradeImage.AddChild(targetImage);
8844 } 8718 }
8845 else 8719 else
8846 { 8720 {
8847 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[3]), "UpgradedImages")); 8721 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[3]), "UpgradedImages"));
8848 } 8722 }
8849 this.core.IndexElement(row, targetImage); 8723 this.core.IndexElement(row, targetImage);
8850 } 8724 }
@@ -8856,9 +8730,9 @@ namespace WixToolset.Core.WindowsInstaller
8856 /// <param name="table">The table to decompile.</param> 8730 /// <param name="table">The table to decompile.</param>
8857 private void DecompileTextStyleTable(Table table) 8731 private void DecompileTextStyleTable(Table table)
8858 { 8732 {
8859 foreach (Row row in table.Rows) 8733 foreach (var row in table.Rows)
8860 { 8734 {
8861 Wix.TextStyle textStyle = new Wix.TextStyle(); 8735 var textStyle = new Wix.TextStyle();
8862 8736
8863 textStyle.Id = Convert.ToString(row[0]); 8737 textStyle.Id = Convert.ToString(row[0]);
8864 8738
@@ -8868,7 +8742,7 @@ namespace WixToolset.Core.WindowsInstaller
8868 8742
8869 if (null != row[3]) 8743 if (null != row[3])
8870 { 8744 {
8871 int color = Convert.ToInt32(row[3]); 8745 var color = Convert.ToInt32(row[3]);
8872 8746
8873 textStyle.Red = color & 0xFF; 8747 textStyle.Red = color & 0xFF;
8874 8748
@@ -8879,7 +8753,7 @@ namespace WixToolset.Core.WindowsInstaller
8879 8753
8880 if (null != row[4]) 8754 if (null != row[4])
8881 { 8755 {
8882 int styleBits = Convert.ToInt32(row[4]); 8756 var styleBits = Convert.ToInt32(row[4]);
8883 8757
8884 if (MsiInterop.MsidbTextStyleStyleBitsBold == (styleBits & MsiInterop.MsidbTextStyleStyleBitsBold)) 8758 if (MsiInterop.MsidbTextStyleStyleBitsBold == (styleBits & MsiInterop.MsidbTextStyleStyleBitsBold))
8885 { 8759 {
@@ -8912,9 +8786,9 @@ namespace WixToolset.Core.WindowsInstaller
8912 /// <param name="table">The table to decompile.</param> 8786 /// <param name="table">The table to decompile.</param>
8913 private void DecompileTypeLibTable(Table table) 8787 private void DecompileTypeLibTable(Table table)
8914 { 8788 {
8915 foreach (Row row in table.Rows) 8789 foreach (var row in table.Rows)
8916 { 8790 {
8917 Wix.TypeLib typeLib = new Wix.TypeLib(); 8791 var typeLib = new Wix.TypeLib();
8918 8792
8919 typeLib.Id = Convert.ToString(row[0]); 8793 typeLib.Id = Convert.ToString(row[0]);
8920 8794
@@ -8924,11 +8798,11 @@ namespace WixToolset.Core.WindowsInstaller
8924 8798
8925 if (null != row[3]) 8799 if (null != row[3])
8926 { 8800 {
8927 int version = Convert.ToInt32(row[3]); 8801 var version = Convert.ToInt32(row[3]);
8928 8802
8929 if (65536 == version) 8803 if (65536 == version)
8930 { 8804 {
8931 this.core.OnMessage(WixWarnings.PossiblyIncorrectTypelibVersion(row.SourceLineNumbers, typeLib.Id)); 8805 this.Messaging.Write(WarningMessages.PossiblyIncorrectTypelibVersion(row.SourceLineNumbers, typeLib.Id));
8932 } 8806 }
8933 8807
8934 typeLib.MajorVersion = ((version & 0xFFFF00) >> 8); 8808 typeLib.MajorVersion = ((version & 0xFFFF00) >> 8);
@@ -8961,16 +8835,16 @@ namespace WixToolset.Core.WindowsInstaller
8961 /// <param name="table">The table to decompile.</param> 8835 /// <param name="table">The table to decompile.</param>
8962 private void DecompileUpgradeTable(Table table) 8836 private void DecompileUpgradeTable(Table table)
8963 { 8837 {
8964 Hashtable upgradeElements = new Hashtable(); 8838 var upgradeElements = new Hashtable();
8965 8839
8966 foreach (UpgradeRow upgradeRow in table.Rows) 8840 foreach (UpgradeRow upgradeRow in table.Rows)
8967 { 8841 {
8968 if (Compiler.UpgradeDetectedProperty == upgradeRow.ActionProperty || Compiler.DowngradeDetectedProperty == upgradeRow.ActionProperty) 8842 if (Common.UpgradeDetectedProperty == upgradeRow.ActionProperty || Common.DowngradeDetectedProperty == upgradeRow.ActionProperty)
8969 { 8843 {
8970 continue; // MajorUpgrade rows processed in FinalizeUpgradeTable 8844 continue; // MajorUpgrade rows processed in FinalizeUpgradeTable
8971 } 8845 }
8972 8846
8973 Wix.Upgrade upgrade = (Wix.Upgrade)upgradeElements[upgradeRow.UpgradeCode]; 8847 var upgrade = (Wix.Upgrade)upgradeElements[upgradeRow.UpgradeCode];
8974 8848
8975 // create the parent Upgrade element if it doesn't already exist 8849 // create the parent Upgrade element if it doesn't already exist
8976 if (null == upgrade) 8850 if (null == upgrade)
@@ -8983,7 +8857,7 @@ namespace WixToolset.Core.WindowsInstaller
8983 upgradeElements.Add(upgrade.Id, upgrade); 8857 upgradeElements.Add(upgrade.Id, upgrade);
8984 } 8858 }
8985 8859
8986 Wix.UpgradeVersion upgradeVersion = new Wix.UpgradeVersion(); 8860 var upgradeVersion = new Wix.UpgradeVersion();
8987 8861
8988 if (null != upgradeRow.VersionMin) 8862 if (null != upgradeRow.VersionMin)
8989 { 8863 {
@@ -9047,19 +8921,19 @@ namespace WixToolset.Core.WindowsInstaller
9047 /// <param name="table">The table to decompile.</param> 8921 /// <param name="table">The table to decompile.</param>
9048 private void DecompileUpgradedFiles_OptionalDataTable(Table table) 8922 private void DecompileUpgradedFiles_OptionalDataTable(Table table)
9049 { 8923 {
9050 foreach (Row row in table.Rows) 8924 foreach (var row in table.Rows)
9051 { 8925 {
9052 Wix.UpgradeFile upgradeFile = new Wix.UpgradeFile(); 8926 var upgradeFile = new Wix.UpgradeFile();
9053 8927
9054 upgradeFile.File = Convert.ToString(row[1]); 8928 upgradeFile.File = Convert.ToString(row[1]);
9055 8929
9056 if (null != row[2]) 8930 if (null != row[2])
9057 { 8931 {
9058 string[] symbolPaths = (Convert.ToString(row[2])).Split(';'); 8932 var symbolPaths = (Convert.ToString(row[2])).Split(';');
9059 8933
9060 foreach (string symbolPathString in symbolPaths) 8934 foreach (var symbolPathString in symbolPaths)
9061 { 8935 {
9062 Wix.SymbolPath symbolPath = new Wix.SymbolPath(); 8936 var symbolPath = new Wix.SymbolPath();
9063 8937
9064 symbolPath.Path = symbolPathString; 8938 symbolPath.Path = symbolPathString;
9065 8939
@@ -9079,14 +8953,14 @@ namespace WixToolset.Core.WindowsInstaller
9079 8953
9080 upgradeFile.Ignore = Wix.YesNoType.no; 8954 upgradeFile.Ignore = Wix.YesNoType.no;
9081 8955
9082 Wix.UpgradeImage upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[0])); 8956 var upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[0]));
9083 if (null != upgradeImage) 8957 if (null != upgradeImage)
9084 { 8958 {
9085 upgradeImage.AddChild(upgradeFile); 8959 upgradeImage.AddChild(upgradeFile);
9086 } 8960 }
9087 else 8961 else
9088 { 8962 {
9089 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[0]), "UpgradedImages")); 8963 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[0]), "UpgradedImages"));
9090 } 8964 }
9091 } 8965 }
9092 } 8966 }
@@ -9097,29 +8971,29 @@ namespace WixToolset.Core.WindowsInstaller
9097 /// <param name="table">The table to decompile.</param> 8971 /// <param name="table">The table to decompile.</param>
9098 private void DecompileUpgradedFilesToIgnoreTable(Table table) 8972 private void DecompileUpgradedFilesToIgnoreTable(Table table)
9099 { 8973 {
9100 foreach (Row row in table.Rows) 8974 foreach (var row in table.Rows)
9101 { 8975 {
9102 if ("*" != Convert.ToString(row[0])) 8976 if ("*" != Convert.ToString(row[0]))
9103 { 8977 {
9104 Wix.UpgradeFile upgradeFile = new Wix.UpgradeFile(); 8978 var upgradeFile = new Wix.UpgradeFile();
9105 8979
9106 upgradeFile.File = Convert.ToString(row[1]); 8980 upgradeFile.File = Convert.ToString(row[1]);
9107 8981
9108 upgradeFile.Ignore = Wix.YesNoType.yes; 8982 upgradeFile.Ignore = Wix.YesNoType.yes;
9109 8983
9110 Wix.UpgradeImage upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[0])); 8984 var upgradeImage = (Wix.UpgradeImage)this.core.GetIndexedElement("UpgradedImages", Convert.ToString(row[0]));
9111 if (null != upgradeImage) 8985 if (null != upgradeImage)
9112 { 8986 {
9113 upgradeImage.AddChild(upgradeFile); 8987 upgradeImage.AddChild(upgradeFile);
9114 } 8988 }
9115 else 8989 else
9116 { 8990 {
9117 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[0]), "UpgradedImages")); 8991 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Upgraded", Convert.ToString(row[0]), "UpgradedImages"));
9118 } 8992 }
9119 } 8993 }
9120 else 8994 else
9121 { 8995 {
9122 this.core.OnMessage(WixWarnings.UnrepresentableColumnValue(row.SourceLineNumbers, table.Name, row.Fields[0].Column.Name, row[0])); 8996 this.Messaging.Write(WarningMessages.UnrepresentableColumnValue(row.SourceLineNumbers, table.Name, row.Fields[0].Column.Name, row[0]));
9123 } 8997 }
9124 } 8998 }
9125 } 8999 }
@@ -9130,9 +9004,9 @@ namespace WixToolset.Core.WindowsInstaller
9130 /// <param name="table">The table to decompile.</param> 9004 /// <param name="table">The table to decompile.</param>
9131 private void DecompileUpgradedImagesTable(Table table) 9005 private void DecompileUpgradedImagesTable(Table table)
9132 { 9006 {
9133 foreach (Row row in table.Rows) 9007 foreach (var row in table.Rows)
9134 { 9008 {
9135 Wix.UpgradeImage upgradeImage = new Wix.UpgradeImage(); 9009 var upgradeImage = new Wix.UpgradeImage();
9136 9010
9137 upgradeImage.Id = Convert.ToString(row[0]); 9011 upgradeImage.Id = Convert.ToString(row[0]);
9138 9012
@@ -9145,11 +9019,11 @@ namespace WixToolset.Core.WindowsInstaller
9145 9019
9146 if (null != row[3]) 9020 if (null != row[3])
9147 { 9021 {
9148 string[] symbolPaths = (Convert.ToString(row[3])).Split(';'); 9022 var symbolPaths = (Convert.ToString(row[3])).Split(';');
9149 9023
9150 foreach (string symbolPathString in symbolPaths) 9024 foreach (var symbolPathString in symbolPaths)
9151 { 9025 {
9152 Wix.SymbolPath symbolPath = new Wix.SymbolPath(); 9026 var symbolPath = new Wix.SymbolPath();
9153 9027
9154 symbolPath.Path = symbolPathString; 9028 symbolPath.Path = symbolPathString;
9155 9029
@@ -9157,14 +9031,14 @@ namespace WixToolset.Core.WindowsInstaller
9157 } 9031 }
9158 } 9032 }
9159 9033
9160 Wix.Family family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[4])); 9034 var family = (Wix.Family)this.core.GetIndexedElement("ImageFamilies", Convert.ToString(row[4]));
9161 if (null != family) 9035 if (null != family)
9162 { 9036 {
9163 family.AddChild(upgradeImage); 9037 family.AddChild(upgradeImage);
9164 } 9038 }
9165 else 9039 else
9166 { 9040 {
9167 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[4]), "ImageFamilies")); 9041 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Family", Convert.ToString(row[4]), "ImageFamilies"));
9168 } 9042 }
9169 this.core.IndexElement(row, upgradeImage); 9043 this.core.IndexElement(row, upgradeImage);
9170 } 9044 }
@@ -9176,9 +9050,9 @@ namespace WixToolset.Core.WindowsInstaller
9176 /// <param name="table">The table to decompile.</param> 9050 /// <param name="table">The table to decompile.</param>
9177 private void DecompileUITextTable(Table table) 9051 private void DecompileUITextTable(Table table)
9178 { 9052 {
9179 foreach (Row row in table.Rows) 9053 foreach (var row in table.Rows)
9180 { 9054 {
9181 Wix.UIText uiText = new Wix.UIText(); 9055 var uiText = new Wix.UIText();
9182 9056
9183 uiText.Id = Convert.ToString(row[0]); 9057 uiText.Id = Convert.ToString(row[0]);
9184 9058
@@ -9194,9 +9068,9 @@ namespace WixToolset.Core.WindowsInstaller
9194 /// <param name="table">The table to decompile.</param> 9068 /// <param name="table">The table to decompile.</param>
9195 private void DecompileVerbTable(Table table) 9069 private void DecompileVerbTable(Table table)
9196 { 9070 {
9197 foreach (Row row in table.Rows) 9071 foreach (var row in table.Rows)
9198 { 9072 {
9199 Wix.Verb verb = new Wix.Verb(); 9073 var verb = new Wix.Verb();
9200 9074
9201 verb.Id = Convert.ToString(row[1]); 9075 verb.Id = Convert.ToString(row[1]);
9202 9076
@@ -9231,25 +9105,25 @@ namespace WixToolset.Core.WindowsInstaller
9231 { 9105 {
9232 switch (Convert.ToInt32(field.Data)) 9106 switch (Convert.ToInt32(field.Data))
9233 { 9107 {
9234 case (-1): 9108 case (-1):
9235 registryRootType = Wix.RegistryRootType.HKMU; 9109 registryRootType = Wix.RegistryRootType.HKMU;
9236 return true; 9110 return true;
9237 case MsiInterop.MsidbRegistryRootClassesRoot: 9111 case MsiInterop.MsidbRegistryRootClassesRoot:
9238 registryRootType = Wix.RegistryRootType.HKCR; 9112 registryRootType = Wix.RegistryRootType.HKCR;
9239 return true; 9113 return true;
9240 case MsiInterop.MsidbRegistryRootCurrentUser: 9114 case MsiInterop.MsidbRegistryRootCurrentUser:
9241 registryRootType = Wix.RegistryRootType.HKCU; 9115 registryRootType = Wix.RegistryRootType.HKCU;
9242 return true; 9116 return true;
9243 case MsiInterop.MsidbRegistryRootLocalMachine: 9117 case MsiInterop.MsidbRegistryRootLocalMachine:
9244 registryRootType = Wix.RegistryRootType.HKLM; 9118 registryRootType = Wix.RegistryRootType.HKLM;
9245 return true; 9119 return true;
9246 case MsiInterop.MsidbRegistryRootUsers: 9120 case MsiInterop.MsidbRegistryRootUsers:
9247 registryRootType = Wix.RegistryRootType.HKU; 9121 registryRootType = Wix.RegistryRootType.HKU;
9248 return true; 9122 return true;
9249 default: 9123 default:
9250 this.core.OnMessage(WixWarnings.IllegalColumnValue(sourceLineNumbers, tableName, field.Column.Name, field.Data)); 9124 this.Messaging.Write(WarningMessages.IllegalColumnValue(sourceLineNumbers, tableName, field.Column.Name, field.Data));
9251 registryRootType = Wix.RegistryRootType.HKCR; // assign anything to satisfy the out parameter 9125 registryRootType = Wix.RegistryRootType.HKCR; // assign anything to satisfy the out parameter
9252 return false; 9126 return false;
9253 } 9127 }
9254 } 9128 }
9255 9129
@@ -9262,12 +9136,12 @@ namespace WixToolset.Core.WindowsInstaller
9262 private void SetPrimaryFeature(Row row, int featureColumnIndex, int componentColumnIndex) 9136 private void SetPrimaryFeature(Row row, int featureColumnIndex, int componentColumnIndex)
9263 { 9137 {
9264 // only products contain primary features 9138 // only products contain primary features
9265 if (OutputType.Product == this.outputType) 9139 if (OutputType.Product == this.OutputType)
9266 { 9140 {
9267 Field featureField = row.Fields[featureColumnIndex]; 9141 var featureField = row.Fields[featureColumnIndex];
9268 Field componentField = row.Fields[componentColumnIndex]; 9142 var componentField = row.Fields[componentColumnIndex];
9269 9143
9270 Wix.ComponentRef componentRef = (Wix.ComponentRef)this.core.GetIndexedElement("FeatureComponents", Convert.ToString(featureField.Data), Convert.ToString(componentField.Data)); 9144 var componentRef = (Wix.ComponentRef)this.core.GetIndexedElement("FeatureComponents", Convert.ToString(featureField.Data), Convert.ToString(componentField.Data));
9271 9145
9272 if (null != componentRef) 9146 if (null != componentRef)
9273 { 9147 {
@@ -9275,7 +9149,7 @@ namespace WixToolset.Core.WindowsInstaller
9275 } 9149 }
9276 else 9150 else
9277 { 9151 {
9278 this.core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, row.TableDefinition.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), featureField.Column.Name, Convert.ToString(featureField.Data), componentField.Column.Name, Convert.ToString(componentField.Data), "FeatureComponents")); 9152 this.Messaging.Write(WarningMessages.ExpectedForeignRow(row.SourceLineNumbers, row.TableDefinition.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), featureField.Column.Name, Convert.ToString(featureField.Data), componentField.Column.Name, Convert.ToString(componentField.Data), "FeatureComponents"));
9279 } 9153 }
9280 } 9154 }
9281 } 9155 }
@@ -9286,44 +9160,44 @@ namespace WixToolset.Core.WindowsInstaller
9286 /// <param name="tables">The collection of all tables.</param> 9160 /// <param name="tables">The collection of all tables.</param>
9287 private static Wix.MajorUpgrade.ScheduleType DetermineMajorUpgradeScheduling(TableIndexedCollection tables) 9161 private static Wix.MajorUpgrade.ScheduleType DetermineMajorUpgradeScheduling(TableIndexedCollection tables)
9288 { 9162 {
9289 int sequenceRemoveExistingProducts = 0; 9163 var sequenceRemoveExistingProducts = 0;
9290 int sequenceInstallValidate = 0; 9164 var sequenceInstallValidate = 0;
9291 int sequenceInstallInitialize = 0; 9165 var sequenceInstallInitialize = 0;
9292 int sequenceInstallFinalize = 0; 9166 var sequenceInstallFinalize = 0;
9293 int sequenceInstallExecute = 0; 9167 var sequenceInstallExecute = 0;
9294 int sequenceInstallExecuteAgain = 0; 9168 var sequenceInstallExecuteAgain = 0;
9295 9169
9296 Table installExecuteSequenceTable = tables["InstallExecuteSequence"]; 9170 var installExecuteSequenceTable = tables["InstallExecuteSequence"];
9297 if (null != installExecuteSequenceTable) 9171 if (null != installExecuteSequenceTable)
9298 { 9172 {
9299 int removeExistingProductsRow = -1; 9173 var removeExistingProductsRow = -1;
9300 for (int i = 0; i < installExecuteSequenceTable.Rows.Count; i++) 9174 for (var i = 0; i < installExecuteSequenceTable.Rows.Count; i++)
9301 { 9175 {
9302 Row row = installExecuteSequenceTable.Rows[i]; 9176 var row = installExecuteSequenceTable.Rows[i];
9303 string action = Convert.ToString(row[0]); 9177 var action = Convert.ToString(row[0]);
9304 int sequence = Convert.ToInt32(row[2]); 9178 var sequence = Convert.ToInt32(row[2]);
9305 9179
9306 switch (action) 9180 switch (action)
9307 { 9181 {
9308 case "RemoveExistingProducts": 9182 case "RemoveExistingProducts":
9309 sequenceRemoveExistingProducts = sequence; 9183 sequenceRemoveExistingProducts = sequence;
9310 removeExistingProductsRow = i; 9184 removeExistingProductsRow = i;
9311 break; 9185 break;
9312 case "InstallValidate": 9186 case "InstallValidate":
9313 sequenceInstallValidate = sequence; 9187 sequenceInstallValidate = sequence;
9314 break; 9188 break;
9315 case "InstallInitialize": 9189 case "InstallInitialize":
9316 sequenceInstallInitialize = sequence; 9190 sequenceInstallInitialize = sequence;
9317 break; 9191 break;
9318 case "InstallExecute": 9192 case "InstallExecute":
9319 sequenceInstallExecute = sequence; 9193 sequenceInstallExecute = sequence;
9320 break; 9194 break;
9321 case "InstallExecuteAgain": 9195 case "InstallExecuteAgain":
9322 sequenceInstallExecuteAgain = sequence; 9196 sequenceInstallExecuteAgain = sequence;
9323 break; 9197 break;
9324 case "InstallFinalize": 9198 case "InstallFinalize":
9325 sequenceInstallFinalize = sequence; 9199 sequenceInstallFinalize = sequence;
9326 break; 9200 break;
9327 } 9201 }
9328 } 9202 }
9329 9203
@@ -9351,6 +9225,5 @@ namespace WixToolset.Core.WindowsInstaller
9351 return Wix.MajorUpgrade.ScheduleType.afterInstallFinalize; 9225 return Wix.MajorUpgrade.ScheduleType.afterInstallFinalize;
9352 } 9226 }
9353 } 9227 }
9354#endif
9355 } 9228 }
9356} 9229}
diff --git a/src/WixToolset.Core.WindowsInstaller/DecompilerCore.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompilerCore.cs
index 2be986fc..17c97e09 100644
--- a/src/WixToolset.Core.WindowsInstaller/DecompilerCore.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompilerCore.cs
@@ -4,20 +4,17 @@ namespace WixToolset
4{ 4{
5 using System; 5 using System;
6 using System.Collections; 6 using System.Collections;
7 using WixToolset.Data; 7 using WixToolset.Data.WindowsInstaller;
8 using WixToolset.Extensibility; 8 using WixToolset.Extensibility;
9 using Wix = WixToolset.Data.Serialize; 9 using Wix = WixToolset.Data.Serialize;
10 10
11#if TODO
12 /// <summary> 11 /// <summary>
13 /// The base of the decompiler. Holds some variables used by the decompiler and extensions, 12 /// The base of the decompiler. Holds some variables used by the decompiler and extensions,
14 /// as well as some utility methods. 13 /// as well as some utility methods.
15 /// </summary> 14 /// </summary>
16 internal class DecompilerCore : IDecompilerCore 15 internal class DecompilerCore
17 { 16 {
18 private Hashtable elements; 17 private readonly Hashtable elements;
19 private Wix.IParentElement rootElement;
20 private bool showPedanticMessages;
21 private Wix.UI uiElement; 18 private Wix.UI uiElement;
22 19
23 /// <summary> 20 /// <summary>
@@ -28,36 +25,14 @@ namespace WixToolset
28 internal DecompilerCore(Wix.IParentElement rootElement) 25 internal DecompilerCore(Wix.IParentElement rootElement)
29 { 26 {
30 this.elements = new Hashtable(); 27 this.elements = new Hashtable();
31 this.rootElement = rootElement; 28 this.RootElement = rootElement;
32 }
33
34 /// <summary>
35 /// Gets whether the decompiler core encountered an error while processing.
36 /// </summary>
37 /// <value>Flag if core encountered an error during processing.</value>
38 public bool EncounteredError
39 {
40 get { return Messaging.Instance.EncounteredError; }
41 } 29 }
42 30
43 /// <summary> 31 /// <summary>
44 /// Gets the root element of the decompiled output. 32 /// Gets the root element of the decompiled output.
45 /// </summary> 33 /// </summary>
46 /// <value>The root element of the decompiled output.</value> 34 /// <value>The root element of the decompiled output.</value>
47 public Wix.IParentElement RootElement 35 public Wix.IParentElement RootElement { get; }
48 {
49 get { return this.rootElement; }
50 }
51
52 /// <summary>
53 /// Gets or sets the option to show pedantic messages.
54 /// </summary>
55 /// <value>The option to show pedantic messages.</value>
56 public bool ShowPedanticMessages
57 {
58 get { return this.showPedanticMessages; }
59 set { this.showPedanticMessages = value; }
60 }
61 36
62 /// <summary> 37 /// <summary>
63 /// Gets the UI element. 38 /// Gets the UI element.
@@ -70,7 +45,7 @@ namespace WixToolset
70 if (null == this.uiElement) 45 if (null == this.uiElement)
71 { 46 {
72 this.uiElement = new Wix.UI(); 47 this.uiElement = new Wix.UI();
73 this.rootElement.AddChild(this.uiElement); 48 this.RootElement.AddChild(this.uiElement);
74 } 49 }
75 50
76 return this.uiElement; 51 return this.uiElement;
@@ -95,8 +70,8 @@ namespace WixToolset
95 /// <returns>The DateTime.</returns> 70 /// <returns>The DateTime.</returns>
96 public DateTime ConvertIntegerToDateTime(int value) 71 public DateTime ConvertIntegerToDateTime(int value)
97 { 72 {
98 int date = value / 65536; 73 var date = value / 65536;
99 int time = value % 65536; 74 var time = value % 65536;
100 75
101 return new DateTime(1980 + (date / 512), (date % 512) / 32, date % 32, time / 2048, (time % 2048) / 32, (time % 32) * 2); 76 return new DateTime(1980 + (date / 512), (date % 512) / 32, date % 32, time / 2048, (time % 2048) / 32, (time % 32) * 2);
102 } 77 }
@@ -131,24 +106,5 @@ namespace WixToolset
131 { 106 {
132 this.elements.Add(String.Concat(row.TableDefinition.Name, ':', row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)), element); 107 this.elements.Add(String.Concat(row.TableDefinition.Name, ':', row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)), element);
133 } 108 }
134
135 /// <summary>
136 /// Indicates the decompiler encountered and unexpected table to decompile.
137 /// </summary>
138 /// <param name="table">Unknown decompiled table.</param>
139 public void UnexpectedTable(Table table)
140 {
141 this.OnMessage(WixErrors.TableDecompilationUnimplemented(table.Name));
142 }
143
144 /// <summary>
145 /// Sends a message to the message delegate if there is one.
146 /// </summary>
147 /// <param name="mea">Message event arguments.</param>
148 public void OnMessage(MessageEventArgs e)
149 {
150 Messaging.Instance.OnMessage(e);
151 }
152 } 109 }
153#endif
154} 110}
diff --git a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs
index 579977fe..b633ea31 100644
--- a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs
+++ b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core.WindowsInstaller 3namespace WixToolset.Core.WindowsInstaller
4{ 4{
@@ -38,9 +38,26 @@ namespace WixToolset.Core.WindowsInstaller
38 return result; 38 return result;
39 } 39 }
40 40
41 public BindResult Decompile(IDecompileContext context) 41 public DecompileResult Decompile(IDecompileContext context)
42 { 42 {
43 throw new NotImplementedException(); 43 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>();
44
45 var backendExtensions = extensionManager.Create<IWindowsInstallerBackendDecompilerExtension>();
46
47 foreach (var extension in backendExtensions)
48 {
49 extension.PreBackendDecompile(context);
50 }
51
52 var command = new DecompileMsiOrMsmCommand(context, backendExtensions);
53 var result = command.Execute();
54
55 foreach (var extension in backendExtensions)
56 {
57 extension.PostBackendDecompile(result);
58 }
59
60 return result;
44 } 61 }
45 62
46 public bool Inscribe(IInscribeContext context) 63 public bool Inscribe(IInscribeContext context)
diff --git a/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs
index de9c4162..84588572 100644
--- a/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs
+++ b/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core.WindowsInstaller 3namespace WixToolset.Core.WindowsInstaller
4{ 4{
@@ -43,9 +43,26 @@ namespace WixToolset.Core.WindowsInstaller
43 return result; 43 return result;
44 } 44 }
45 45
46 public BindResult Decompile(IDecompileContext context) 46 public DecompileResult Decompile(IDecompileContext context)
47 { 47 {
48 throw new NotImplementedException(); 48 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>();
49
50 var backendExtensions = extensionManager.Create<IWindowsInstallerBackendDecompilerExtension>();
51
52 foreach (var extension in backendExtensions)
53 {
54 extension.PreBackendDecompile(context);
55 }
56
57 var command = new DecompileMsiOrMsmCommand(context, backendExtensions);
58 var result = command.Execute();
59
60 foreach (var extension in backendExtensions)
61 {
62 extension.PostBackendDecompile(result);
63 }
64
65 return result;
49 } 66 }
50 67
51 public bool Inscribe(IInscribeContext context) 68 public bool Inscribe(IInscribeContext context)
diff --git a/src/WixToolset.Core.WindowsInstaller/MspBackend.cs b/src/WixToolset.Core.WindowsInstaller/MspBackend.cs
index c6a05b20..df4eb44c 100644
--- a/src/WixToolset.Core.WindowsInstaller/MspBackend.cs
+++ b/src/WixToolset.Core.WindowsInstaller/MspBackend.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core.WindowsInstaller 3namespace WixToolset.Core.WindowsInstaller
4{ 4{
@@ -21,7 +21,7 @@ namespace WixToolset.Core.WindowsInstaller
21 throw new NotImplementedException(); 21 throw new NotImplementedException();
22 } 22 }
23 23
24 public BindResult Decompile(IDecompileContext context) 24 public DecompileResult Decompile(IDecompileContext context)
25 { 25 {
26 throw new NotImplementedException(); 26 throw new NotImplementedException();
27 } 27 }
diff --git a/src/WixToolset.Core.WindowsInstaller/MstBackend.cs b/src/WixToolset.Core.WindowsInstaller/MstBackend.cs
index 3e105963..6460821a 100644
--- a/src/WixToolset.Core.WindowsInstaller/MstBackend.cs
+++ b/src/WixToolset.Core.WindowsInstaller/MstBackend.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core.WindowsInstaller 3namespace WixToolset.Core.WindowsInstaller
4{ 4{
@@ -25,7 +25,7 @@ namespace WixToolset.Core.WindowsInstaller
25 throw new NotImplementedException(); 25 throw new NotImplementedException();
26 } 26 }
27 27
28 public BindResult Decompile(IDecompileContext context) 28 public DecompileResult Decompile(IDecompileContext context)
29 { 29 {
30 throw new NotImplementedException(); 30 throw new NotImplementedException();
31 } 31 }
diff --git a/src/WixToolset.Core/CommandLine/DecompileCommand.cs b/src/WixToolset.Core/CommandLine/DecompileCommand.cs
new file mode 100644
index 00000000..87cead80
--- /dev/null
+++ b/src/WixToolset.Core/CommandLine/DecompileCommand.cs
@@ -0,0 +1,212 @@
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.Core.CommandLine
4{
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8 using WixToolset.Data;
9 using WixToolset.Extensibility;
10 using WixToolset.Extensibility.Data;
11 using WixToolset.Extensibility.Services;
12
13 internal class DecompileCommand : ICommandLineCommand
14 {
15 private readonly CommandLine commandLine;
16
17 public DecompileCommand(IServiceProvider serviceProvider)
18 {
19 this.ServiceProvider = serviceProvider;
20 this.Messaging = serviceProvider.GetService<IMessaging>();
21 this.commandLine = new CommandLine(this.Messaging);
22 }
23
24 public bool ShowLogo => this.commandLine.ShowLogo;
25
26 public bool StopParsing => this.commandLine.ShowHelp;
27
28 private IServiceProvider ServiceProvider { get; }
29
30 public IMessaging Messaging { get; }
31
32 private IEnumerable<SourceFile> SourceFiles { get; }
33
34 private string OutputPath { get; }
35
36 public int Execute()
37 {
38 if (this.commandLine.ShowHelp)
39 {
40 Console.WriteLine("TODO: Show decompile command help");
41 return -1;
42 }
43
44 var context = this.ServiceProvider.GetService<IDecompileContext>();
45 context.Extensions = this.ServiceProvider.GetService<IExtensionManager>().Create<IDecompilerExtension>();
46 context.DecompilePath = this.commandLine.DecompileFilePath;
47 context.DecompileType = this.commandLine.CalculateDecompileType();
48 context.IntermediateFolder = this.commandLine.CalculateIntermedateFolder();
49 context.OutputPath = this.commandLine.CalculateOutputPath();
50
51 try
52 {
53 var decompiler = this.ServiceProvider.GetService<IDecompiler>();
54 var result = decompiler.Decompile(context);
55 }
56 catch (WixException e)
57 {
58 this.Messaging.Write(e.Error);
59 }
60
61 if (this.Messaging.EncounteredError)
62 {
63 return 1;
64 }
65
66 return 0;
67 }
68
69 public bool TryParseArgument(ICommandLineParser parser, string argument)
70 {
71 return this.commandLine.TryParseArgument(argument, parser);
72 }
73
74 private class CommandLine
75 {
76 public CommandLine(IMessaging messaging)
77 {
78 this.Messaging = messaging;
79 }
80
81 private IMessaging Messaging { get; }
82
83 public string DecompileFilePath { get; private set; }
84
85 public string DecompileType { get; private set; }
86
87 public Platform Platform { get; private set; }
88
89 public bool ShowLogo { get; private set; }
90
91 public bool ShowHelp { get; private set; }
92
93 public string IntermediateFolder { get; private set; }
94
95 public string OutputFile { get; private set; }
96
97 public bool TryParseArgument(string arg, ICommandLineParser parser)
98 {
99 if (parser.IsSwitch(arg))
100 {
101 var parameter = arg.Substring(1);
102 switch (parameter.ToLowerInvariant())
103 {
104 case "?":
105 case "h":
106 case "help":
107 this.ShowHelp = true;
108 return true;
109
110 case "intermediatefolder":
111 this.IntermediateFolder = parser.GetNextArgumentAsDirectoryOrError(arg);
112 return true;
113
114 case "o":
115 case "out":
116 this.OutputFile = parser.GetNextArgumentAsFilePathOrError(arg);
117 return true;
118
119 case "nologo":
120 this.ShowLogo = false;
121 return true;
122
123 case "v":
124 case "verbose":
125 this.Messaging.ShowVerboseMessages = true;
126 return true;
127
128 case "sw":
129 case "suppresswarning":
130 var warning = parser.GetNextArgumentOrError(arg);
131 if (!String.IsNullOrEmpty(warning))
132 {
133 var warningNumber = Convert.ToInt32(warning);
134 this.Messaging.SuppressWarningMessage(warningNumber);
135 }
136 return true;
137 }
138 }
139 else
140 {
141 if (String.IsNullOrEmpty(this.DecompileFilePath))
142 {
143 this.DecompileFilePath = parser.GetArgumentAsFilePathOrError(arg, "decompile file");
144 return true;
145 }
146 else if (String.IsNullOrEmpty(this.OutputFile))
147 {
148 this.OutputFile = parser.GetArgumentAsFilePathOrError(arg, "output file");
149 return true;
150 }
151 }
152
153 return false;
154 }
155
156 public OutputType CalculateDecompileType()
157 {
158 if (String.IsNullOrEmpty(this.DecompileType))
159 {
160 this.DecompileType = Path.GetExtension(this.DecompileFilePath);
161 }
162
163 switch (this.DecompileType.ToLowerInvariant())
164 {
165 case "bundle":
166 case ".exe":
167 return OutputType.Bundle;
168
169 case "library":
170 case ".wixlib":
171 return OutputType.Library;
172
173 case "module":
174 case ".msm":
175 return OutputType.Module;
176
177 case "patch":
178 case ".msp":
179 return OutputType.Patch;
180
181 case ".pcp":
182 return OutputType.PatchCreation;
183
184 case "product":
185 case "package":
186 case ".msi":
187 return OutputType.Product;
188
189 case "transform":
190 case ".mst":
191 return OutputType.Transform;
192
193 case "intermediatepostlink":
194 case ".wixipl":
195 return OutputType.IntermediatePostLink;
196 }
197
198 return OutputType.Unknown;
199 }
200
201 public string CalculateIntermedateFolder()
202 {
203 return String.IsNullOrEmpty(this.IntermediateFolder) ? Path.GetTempPath() : this.IntermediateFolder;
204 }
205
206 public string CalculateOutputPath()
207 {
208 return String.IsNullOrEmpty(this.OutputFile) ? Path.ChangeExtension(this.DecompileFilePath, ".wxs") : this.OutputFile;
209 }
210 }
211 }
212}
diff --git a/src/WixToolset.Core/DecompileContext.cs b/src/WixToolset.Core/DecompileContext.cs
index a9f0640a..b697c3cf 100644
--- a/src/WixToolset.Core/DecompileContext.cs
+++ b/src/WixToolset.Core/DecompileContext.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core 3namespace WixToolset.Core
4{ 4{
@@ -17,12 +17,30 @@ namespace WixToolset.Core
17 17
18 public IServiceProvider ServiceProvider { get; } 18 public IServiceProvider ServiceProvider { get; }
19 19
20 public string DecompilePath { get; set; }
21
20 public OutputType DecompileType { get; set; } 22 public OutputType DecompileType { get; set; }
21 23
22 public IEnumerable<IDecompilerExtension> Extensions { get; set; } 24 public IEnumerable<IDecompilerExtension> Extensions { get; set; }
23 25
26 public string ExtractFolder { get; set; }
27
28 public string BaseSourcePath { get; set; }
29
24 public string IntermediateFolder { get; set; } 30 public string IntermediateFolder { get; set; }
25 31
32 public bool IsAdminImage { get; set; }
33
26 public string OutputPath { get; set; } 34 public string OutputPath { get; set; }
35
36 public bool SuppressCustomTables { get; set; }
37
38 public bool SuppressDroppingEmptyTables { get; set; }
39
40 public bool SuppressExtractCabinets { get; set; }
41
42 public bool SuppressUI { get; set; }
43
44 public bool TreatProductAsModule { get; set; }
27 } 45 }
28} 46}
diff --git a/src/WixToolset.Core/Decompiler.cs b/src/WixToolset.Core/Decompiler.cs
index 45cfbea0..685722a8 100644
--- a/src/WixToolset.Core/Decompiler.cs
+++ b/src/WixToolset.Core/Decompiler.cs
@@ -19,7 +19,7 @@ namespace WixToolset.Core
19 19
20 public IServiceProvider ServiceProvider { get; } 20 public IServiceProvider ServiceProvider { get; }
21 21
22 public BindResult Decompile(IDecompileContext context) 22 public DecompileResult Decompile(IDecompileContext context)
23 { 23 {
24 // Pre-decompile. 24 // Pre-decompile.
25 // 25 //
@@ -30,22 +30,22 @@ namespace WixToolset.Core
30 30
31 // Decompile. 31 // Decompile.
32 // 32 //
33 var bindResult = this.BackendDecompile(context); 33 var result = this.BackendDecompile(context);
34 34
35 if (bindResult != null) 35 if (result != null)
36 { 36 {
37 // Post-decompile. 37 // Post-decompile.
38 // 38 //
39 foreach (var extension in context.Extensions) 39 foreach (var extension in context.Extensions)
40 { 40 {
41 extension.PostDecompile(bindResult); 41 extension.PostDecompile(result);
42 } 42 }
43 } 43 }
44 44
45 return bindResult; 45 return result;
46 } 46 }
47 47
48 private BindResult BackendDecompile(IDecompileContext context) 48 private DecompileResult BackendDecompile(IDecompileContext context)
49 { 49 {
50 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); 50 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>();
51 51
diff --git a/src/WixToolset.Core/IDecompiler.cs b/src/WixToolset.Core/IDecompiler.cs
index b9bb7ed8..82b02943 100644
--- a/src/WixToolset.Core/IDecompiler.cs
+++ b/src/WixToolset.Core/IDecompiler.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core 3namespace WixToolset.Core
4{ 4{
@@ -6,6 +6,6 @@ namespace WixToolset.Core
6 6
7 public interface IDecompiler 7 public interface IDecompiler
8 { 8 {
9 BindResult Decompile(IDecompileContext context); 9 DecompileResult Decompile(IDecompileContext context);
10 } 10 }
11} 11}
diff --git a/src/WixToolset.Core/OptimizeCA.cs b/src/WixToolset.Core/OptimizeCA.cs
index ba17604d..0d7b5e1a 100644
--- a/src/WixToolset.Core/OptimizeCA.cs
+++ b/src/WixToolset.Core/OptimizeCA.cs
@@ -1,4 +1,4 @@
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. 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 2
3namespace WixToolset.Core 3namespace WixToolset.Core
4{ 4{
@@ -8,7 +8,7 @@ namespace WixToolset.Core
8 /// Values for the OptimizeCA MsiPatchMetdata property, which indicates whether custom actions can be skipped when applying the patch. 8 /// Values for the OptimizeCA MsiPatchMetdata property, which indicates whether custom actions can be skipped when applying the patch.
9 /// </summary> 9 /// </summary>
10 [Flags] 10 [Flags]
11 internal enum OptimizeCA 11 public enum OptimizeCA // TODO: review where to place this data so it can not be exposed by WixToolset.Core
12 { 12 {
13 /// <summary> 13 /// <summary>
14 /// No custom actions are skipped. 14 /// No custom actions are skipped.
diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
new file mode 100644
index 00000000..66ce98c0
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
@@ -0,0 +1,41 @@
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 WixToolsetTest.CoreIntegration
4{
5 using System.IO;
6 using System.Xml.Linq;
7 using WixBuildTools.TestSupport;
8 using WixToolset.Core.TestPackage;
9 using Xunit;
10
11 public class DecompileFixture
12 {
13 [Fact]
14 public void CanDecompileSingleFileCompressed()
15 {
16 var folder = TestData.Get(@"TestData\DecompileSingleFileCompressed");
17
18 using (var fs = new DisposableFileSystem())
19 {
20 var intermediateFolder = fs.GetFolder();
21 var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs");
22
23 var result = WixRunner.Execute(new[]
24 {
25 "decompile",
26 Path.Combine(folder, "example.msi"),
27 "-intermediateFolder", intermediateFolder,
28 "-o", outputPath
29 });
30
31 result.AssertSuccess();
32
33 var actual = File.ReadAllText(outputPath);
34 var actualFormatted = XDocument.Parse(actual, LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
35 var expected = XDocument.Load(Path.Combine(folder, "Expected.wxs"), LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
36
37 Assert.Equal(expected, actualFormatted);
38 }
39 }
40 }
41}
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs
new file mode 100644
index 00000000..b2bb6050
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs
@@ -0,0 +1,21 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Product Id="{6F9B5694-F0F1-437C-919B-0D2DAF2D9DEA}" Codepage="65001" Language="1033" Manufacturer="Example Corporation" Name="MsiPackage" UpgradeCode="{047730A5-30FE-4A62-A520-DA9381B8226A}" Version="1.0.0.0">
4 <Package Compressed="yes" Description="MsiPackage" InstallerVersion="200" Languages="1033" Manufacturer="Example Corporation" Platform="x86" />
5 <Directory Id="TARGETDIR" Name="SourceDir">
6 <Directory Id="ProgramFilesFolder">
7 <Directory Id="INSTALLFOLDER" Name="MsiPackage" ShortName="oekcr5lq">
8 <Component Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" Guid="{E597A58A-03CB-50D8-93E3-DABA263F233A}">
9 <File Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" Name="test.txt" KeyPath="yes" Source="SourceDir\File\filcV1yrx0x8wJWj4qMzcH21jwkPko" />
10 </Component>
11 </Directory>
12 </Directory>
13 </Directory>
14 <Feature Id="ProductFeature" Level="1" Title="MsiPackage">
15 <ComponentRef Id="filcV1yrx0x8wJWj4qMzcH21jwkPko" />
16 </Feature>
17 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
18 <Media Id="1" Cabinet="example.cab" />
19 <Property Id="ALLUSERS" Value="1" />
20 </Product>
21</Wix> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.cab b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.cab
new file mode 100644
index 00000000..125eeb2c
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.cab
Binary files differ
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.msi
new file mode 100644
index 00000000..9cb6d6bc
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.msi
Binary files differ
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 38b7dc81..7f1337e0 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -20,6 +20,9 @@
20 <Content Include="TestData\InstanceTransform\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 20 <Content Include="TestData\InstanceTransform\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
21 <Content Include="TestData\InstanceTransform\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> 21 <Content Include="TestData\InstanceTransform\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
22 <Content Include="TestData\InstanceTransform\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> 22 <Content Include="TestData\InstanceTransform\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="TestData\DecompileSingleFileCompressed\example.cab" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\DecompileSingleFileCompressed\example.msi" CopyToOutputDirectory="PreserveNewest" />
25 <Content Include="TestData\DecompileSingleFileCompressed\Expected.wxs" CopyToOutputDirectory="PreserveNewest" />
23 <Content Include="TestData\ExampleExtension\data\example.txt" CopyToOutputDirectory="PreserveNewest" /> 26 <Content Include="TestData\ExampleExtension\data\example.txt" CopyToOutputDirectory="PreserveNewest" />
24 <Content Include="TestData\ExampleExtension\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 27 <Content Include="TestData\ExampleExtension\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
25 <Content Include="TestData\ExampleExtension\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> 28 <Content Include="TestData\ExampleExtension\Package.wxs" CopyToOutputDirectory="PreserveNewest" />