@joebigelow / wix / commits / 822d9179

Re-introduce "decompile" to backend

Rob Mensching committed Oct 24, 2018 at 21:06 UTC 822d917960cbd35f506598af4baa6a20ad4b447e
18 files changed +3099 -2866
src/WixToolset.Core.Burn/BundleBackend.cs
+2 -2
@@ -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
3 namespace WixToolset.Core.Burn
4 {
@@ -27,7 +27,7 @@ namespace WixToolset.Core.Burn
27 return new BindResult { FileTransfers = command.FileTransfers, TrackedFiles = command.TrackedFiles };
28 }
29
30 - public BindResult Decompile(IDecompileContext context)
30 + public DecompileResult Decompile(IDecompileContext context)
31 {
32 throw new NotImplementedException();
33 }
src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs new
+75
@@ -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 +
3 +namespace 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 +}
src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs renamed
+2664 -2791
@@ -6,181 +6,104 @@ namespace WixToolset.Core.WindowsInstaller
6 using System.Collections;
7 using System.Collections.Generic;
8 using System.Collections.Specialized;
9 - using System.Diagnostics.CodeAnalysis;
9 using System.Globalization;
10 using System.IO;
11 + using System.Linq;
12 using System.Text;
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;
18 using WixToolset.Data;
19 + using WixToolset.Data.Tuples;
20 + using WixToolset.Data.WindowsInstaller;
21 + using WixToolset.Data.WindowsInstaller.Rows;
22 using WixToolset.Extensibility;
16 - using WixToolset.Core.Native;
23 + using WixToolset.Extensibility.Services;
24 using Wix = WixToolset.Data.Serialize;
18 - using WixToolset.Core;
25
26 /// <summary>
27 /// Decompiles an msi database into WiX source.
28 /// </summary>
23 - public class Decompiler
29 + internal class Decompiler
30 {
31 private static readonly Regex NullSplitter = new Regex(@"\[~]");
26 -#if TODO
27 - private int codepage;
32 +
33 private bool compressed;
34 private bool shortNames;
35 private DecompilerCore core;
31 - private string exportFilePath;
32 - private List<IDecompilerExtension> extensions;
33 - private Dictionary<string, IDecompilerExtension> extensionsByTableName;
36 private string modularizationGuid;
35 - private OutputType outputType;
36 - private Hashtable patchTargetFiles;
37 - private Hashtable sequenceElements;
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;
37 + private readonly Hashtable patchTargetFiles;
38 + private readonly Hashtable sequenceElements;
39 + private readonly TableDefinitionCollection tableDefinitions;
40
41 /// <summary>
42 /// Creates a new decompiler object with a default set of table definitions.
43 /// </summary>
51 - public Decompiler()
44 + public Decompiler(IMessaging messaging, IEnumerable<IWindowsInstallerBackendDecompilerExtension> extensions, string baseSourcePath, bool suppressCustomTables, bool suppressDroppingEmptyTables, bool suppressUI, bool treatProductAsModule)
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);
56
55 - this.extensions = new List<IDecompilerExtension>();
56 - this.extensionsByTableName = new Dictionary<string,IDecompilerExtension>();
57 this.patchTargetFiles = new Hashtable();
58 this.sequenceElements = new Hashtable();
59 this.tableDefinitions = new TableDefinitionCollection();
60 - this.exportFilePath = "SourceDir";
60 }
61
63 - /// <summary>
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 - }
62 + private IMessaging Messaging { get; }
63
73 - /// <summary>
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 - }
64 + private IEnumerable<IWindowsInstallerBackendDecompilerExtension> Extensions { get; }
65
83 - /// <summary>
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 - }
66 + private Dictionary<string, IWindowsInstallerBackendDecompilerExtension> ExtensionsByTableName { get; }
67
93 - /// <summary>
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 - }
68 + private string BaseSourcePath { get; }
69
103 - /// <summary>
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 - }
70 + private bool SuppressCustomTables { get; }
71
113 - /// <summary>
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 - }
72 + private bool SuppressDroppingEmptyTables { get; }
73
123 - /// <summary>
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 - }
74 + private bool SuppressRelativeActionSequencing { get; }
75
136 - // set
137 - // {
138 - // if (null == value)
139 - // {
140 - // this.tempFiles = new TempFileCollection();
141 - // }
142 - // else
143 - // {
144 - // this.tempFiles = new TempFileCollection(value);
145 - // }
146 - // }
147 - }
76 + private bool SuppressUI { get; }
77
149 - /// <summary>
150 - /// Gets or sets whether the decompiler should use module logic on a product output.
151 - /// </summary>
152 - /// <value>The option to treat a product like a module</value>
153 - public bool TreatProductAsModule
154 - {
155 - get { return this.treatProductAsModule; }
156 - set { this.treatProductAsModule = value; }
157 - }
78 + private bool TreatProductAsModule { get; }
79 +
80 + private OutputType OutputType { get; set; }
81 +
82 + private Dictionary<string, WixActionTuple> StandardActions { get; }
83
84 /// <summary>
85 /// Decompile the database file.
86 /// </summary>
87 /// <param name="output">The output to decompile.</param>
88 /// <returns>The serialized WiX source code.</returns>
164 - [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", MessageId = "System.InvalidOperationException.#ctor(System.String)")]
165 - public Wix.Wix Decompile(Output output)
89 + public XDocument Decompile(Output output)
90 {
91 if (null == output)
92 {
93 throw new ArgumentNullException("output");
94 }
95
172 - this.codepage = output.Codepage;
173 - this.outputType = output.Type;
96 + this.OutputType = output.Type;
97
98 // collect the table definitions from the output
99 this.tableDefinitions.Clear();
177 - foreach (Table table in output.Tables)
100 + foreach (var table in output.Tables)
101 {
102 this.tableDefinitions.Add(table.Definition);
103 }
104
105 // add any missing standard and wix-specific table definitions
183 - foreach (TableDefinition tableDefinition in WindowsInstallerStandard.GetTableDefinitions())
106 + foreach (var tableDefinition in WindowsInstallerStandardInternal.GetTableDefinitions())
107 {
108 if (!this.tableDefinitions.Contains(tableDefinition.Name))
109 {
@@ -189,46 +112,29 @@ namespace WixToolset.Core.WindowsInstaller
112 }
113
114 // add any missing extension table definitions
192 - foreach (IDecompilerExtension extension in this.extensions)
193 - {
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)
115 +#if TODO_DECOMPILER_EXTENSIONS
116 + foreach (var extension in this.Extensions)
117 {
210 - this.TempFilesLocation = null;
118 + this.AddExtension(extension);
119 }
120 #endif
213 - Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there
121
215 - bool encounteredError = false;
122 + var wixElement = new Wix.Wix();
123 Wix.IParentElement rootElement;
217 - Wix.Wix wixElement = new Wix.Wix();
124
219 - switch (this.outputType)
125 + switch (this.OutputType)
126 {
221 - case OutputType.Module:
222 - rootElement = new Wix.Module();
223 - break;
224 - case OutputType.PatchCreation:
225 - rootElement = new Wix.PatchCreation();
226 - break;
227 - case OutputType.Product:
228 - rootElement = new Wix.Product();
229 - break;
230 - default:
231 - throw new InvalidOperationException(WixStrings.EXP_UnknownOutputType);
127 + case OutputType.Module:
128 + rootElement = new Wix.Module();
129 + break;
130 + case OutputType.PatchCreation:
131 + rootElement = new Wix.PatchCreation();
132 + break;
133 + case OutputType.Product:
134 + rootElement = new Wix.Product();
135 + break;
136 + default:
137 + throw new InvalidOperationException("Unknown output type.");
138 }
139 wixElement.AddChild((Wix.ISchemaElement)rootElement);
140
@@ -236,24 +142,17 @@ namespace WixToolset.Core.WindowsInstaller
142 try
143 {
144 this.core = new DecompilerCore(rootElement);
239 - this.core.ShowPedanticMessages = this.showPedanticMessages;
145
146 // stop processing if an error previously occurred
242 - if (this.core.EncounteredError)
147 + if (this.Messaging.EncounteredError)
148 {
149 return null;
150 }
151
247 - // initialize the decompiler and its extensions
248 - foreach (IDecompilerExtension extension in this.extensions)
249 - {
250 - extension.Core = this.core;
251 - extension.Initialize(output.Tables);
252 - }
253 - this.InitializeDecompile(output.Tables);
152 + this.InitializeDecompile(output.Tables, output.Codepage);
153
154 // stop processing if an error previously occurred
256 - if (this.core.EncounteredError)
155 + if (this.Messaging.EncounteredError)
156 {
157 return null;
158 }
@@ -263,79 +162,41 @@ namespace WixToolset.Core.WindowsInstaller
162
163 // finalize the decompiler and its extensions
164 this.FinalizeDecompile(output.Tables);
266 - foreach (IDecompilerExtension extension in this.extensions)
267 - {
268 - extension.Finish(output.Tables);
269 - }
165 }
166 finally
167 {
273 - encounteredError = this.core.EncounteredError;
274 -
168 this.core = null;
276 - foreach (IDecompilerExtension extension in this.extensions)
277 - {
278 - extension.Core = null;
279 - }
169 }
170
282 - // return the root element only if decompilation completed successfully
283 - return (encounteredError ? null : wixElement);
171 + var document = new XDocument();
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;
179 }
180
286 - /// <summary>
287 - /// Adds an extension.
288 - /// </summary>
289 - /// <param name="extension">The extension to add.</param>
290 - public void AddExtension(IDecompilerExtension extension)
181 +#if TODO_DECOMPILER_EXTENSIONS
182 + private void AddExtension(IWindowsInstallerBackendDecompilerExtension extension)
183 {
292 - this.extensions.Add(extension);
293 -
184 if (null != extension.TableDefinitions)
185 {
186 foreach (TableDefinition tableDefinition in extension.TableDefinitions)
187 {
298 - if (!this.extensionsByTableName.ContainsKey(tableDefinition.Name))
188 + if (!this.ExtensionsByTableName.ContainsKey(tableDefinition.Name))
189 {
300 - this.extensionsByTableName.Add(tableDefinition.Name, extension);
190 + this.ExtensionsByTableName.Add(tableDefinition.Name, extension);
191 }
192 else
193 {
304 - Messaging.Instance.OnMessage(WixErrors.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name));
194 + this.Messaging.Write(ErrorMessages.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name));
195 }
196 }
197 }
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 - }
199 #endif
337 - return true;
338 - }
200
201 /// <summary>
202 /// Set the common control attributes in a control element.
@@ -395,7 +256,7 @@ namespace WixToolset.Core.WindowsInstaller
256
257 if (null != this.core.GetIndexedElement("CustomAction", actionRow.Action)) // custom action
258 {
398 - Wix.Custom custom = new Wix.Custom();
259 + var custom = new Wix.Custom();
260
261 custom.Action = actionRow.Action;
262
@@ -406,39 +267,39 @@ namespace WixToolset.Core.WindowsInstaller
267
268 switch (actionRow.Sequence)
269 {
409 - case (-4):
410 - custom.OnExit = Wix.ExitType.suspend;
411 - break;
412 - case (-3):
413 - custom.OnExit = Wix.ExitType.error;
414 - break;
415 - case (-2):
416 - custom.OnExit = Wix.ExitType.cancel;
417 - break;
418 - case (-1):
419 - custom.OnExit = Wix.ExitType.success;
420 - break;
421 - default:
422 - if (null != actionRow.Before)
423 - {
424 - custom.Before = actionRow.Before;
425 - }
426 - else if (null != actionRow.After)
427 - {
428 - custom.After = actionRow.After;
429 - }
430 - else if (0 < actionRow.Sequence)
431 - {
432 - custom.Sequence = actionRow.Sequence;
433 - }
434 - break;
270 + case (-4):
271 + custom.OnExit = Wix.ExitType.suspend;
272 + break;
273 + case (-3):
274 + custom.OnExit = Wix.ExitType.error;
275 + break;
276 + case (-2):
277 + custom.OnExit = Wix.ExitType.cancel;
278 + break;
279 + case (-1):
280 + custom.OnExit = Wix.ExitType.success;
281 + break;
282 + default:
283 + if (null != actionRow.Before)
284 + {
285 + custom.Before = actionRow.Before;
286 + }
287 + else if (null != actionRow.After)
288 + {
289 + custom.After = actionRow.After;
290 + }
291 + else if (0 < actionRow.Sequence)
292 + {
293 + custom.Sequence = actionRow.Sequence;
294 + }
295 + break;
296 }
297
298 actionElement = custom;
299 }
300 else if (null != this.core.GetIndexedElement("Dialog", actionRow.Action)) // dialog
301 {
441 - Wix.Show show = new Wix.Show();
302 + var show = new Wix.Show();
303
304 show.Dialog = actionRow.Action;
305
@@ -449,32 +310,32 @@ namespace WixToolset.Core.WindowsInstaller
310
311 switch (actionRow.Sequence)
312 {
452 - case (-4):
453 - show.OnExit = Wix.ExitType.suspend;
454 - break;
455 - case (-3):
456 - show.OnExit = Wix.ExitType.error;
457 - break;
458 - case (-2):
459 - show.OnExit = Wix.ExitType.cancel;
460 - break;
461 - case (-1):
462 - show.OnExit = Wix.ExitType.success;
463 - break;
464 - default:
465 - if (null != actionRow.Before)
466 - {
467 - show.Before = actionRow.Before;
468 - }
469 - else if (null != actionRow.After)
470 - {
471 - show.After = actionRow.After;
472 - }
473 - else if (0 < actionRow.Sequence)
474 - {
475 - show.Sequence = actionRow.Sequence;
476 - }
477 - break;
313 + case (-4):
314 + show.OnExit = Wix.ExitType.suspend;
315 + break;
316 + case (-3):
317 + show.OnExit = Wix.ExitType.error;
318 + break;
319 + case (-2):
320 + show.OnExit = Wix.ExitType.cancel;
321 + break;
322 + case (-1):
323 + show.OnExit = Wix.ExitType.success;
324 + break;
325 + default:
326 + if (null != actionRow.Before)
327 + {
328 + show.Before = actionRow.Before;
329 + }
330 + else if (null != actionRow.After)
331 + {
332 + show.After = actionRow.After;
333 + }
334 + else if (0 < actionRow.Sequence)
335 + {
336 + show.Sequence = actionRow.Sequence;
337 + }
338 + break;
339 }
340
341 actionElement = show;
@@ -487,30 +348,30 @@ namespace WixToolset.Core.WindowsInstaller
348 // add the action element to the appropriate sequence element
349 if (null != actionElement)
350 {
490 - string sequenceTable = actionRow.SequenceTable.ToString();
491 - Wix.IParentElement sequenceElement = (Wix.IParentElement)this.sequenceElements[sequenceTable];
351 + var sequenceTable = actionRow.SequenceTable.ToString();
352 + var sequenceElement = (Wix.IParentElement)this.sequenceElements[sequenceTable];
353
354 if (null == sequenceElement)
355 {
356 switch (actionRow.SequenceTable)
357 {
497 - case SequenceTable.AdminExecuteSequence:
498 - sequenceElement = new Wix.AdminExecuteSequence();
499 - break;
500 - case SequenceTable.AdminUISequence:
501 - sequenceElement = new Wix.AdminUISequence();
502 - break;
503 - case SequenceTable.AdvtExecuteSequence:
504 - sequenceElement = new Wix.AdvertiseExecuteSequence();
505 - break;
506 - case SequenceTable.InstallExecuteSequence:
507 - sequenceElement = new Wix.InstallExecuteSequence();
508 - break;
509 - case SequenceTable.InstallUISequence:
510 - sequenceElement = new Wix.InstallUISequence();
511 - break;
512 - default:
513 - throw new InvalidOperationException(WixStrings.EXP_UnknowSequenceTable);
358 + case SequenceTable.AdminExecuteSequence:
359 + sequenceElement = new Wix.AdminExecuteSequence();
360 + break;
361 + case SequenceTable.AdminUISequence:
362 + sequenceElement = new Wix.AdminUISequence();
363 + break;
364 + case SequenceTable.AdvtExecuteSequence:
365 + sequenceElement = new Wix.AdvertiseExecuteSequence();
366 + break;
367 + case SequenceTable.InstallExecuteSequence:
368 + sequenceElement = new Wix.InstallExecuteSequence();
369 + break;
370 + case SequenceTable.InstallUISequence:
371 + sequenceElement = new Wix.InstallUISequence();
372 + break;
373 + default:
374 + throw new InvalidOperationException("Unknown sequence table.");
375 }
376
377 this.core.RootElement.AddChild((Wix.ISchemaElement)sequenceElement);
@@ -523,7 +384,7 @@ namespace WixToolset.Core.WindowsInstaller
384 }
385 catch (System.ArgumentException) // action/dialog is not valid for this sequence
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));
388 }
389 }
390 }
@@ -539,267 +400,267 @@ namespace WixToolset.Core.WindowsInstaller
400
401 switch (actionRow.Action)
402 {
542 - case "AllocateRegistrySpace":
543 - actionElement = new Wix.AllocateRegistrySpace();
544 - break;
545 - case "AppSearch":
546 - WixActionRow appSearchActionRow = this.standardActions[actionRow.SequenceTable, actionRow.Action];
547 -
548 - if (null != actionRow.Before || null != actionRow.After || (null != appSearchActionRow && actionRow.Sequence != appSearchActionRow.Sequence))
549 - {
550 - Wix.AppSearch appSearch = new Wix.AppSearch();
551 -
552 - if (null != actionRow.Condition)
553 - {
554 - appSearch.Content = actionRow.Condition;
555 - }
556 -
557 - if (null != actionRow.Before)
558 - {
559 - appSearch.Before = actionRow.Before;
560 - }
561 - else if (null != actionRow.After)
562 - {
563 - appSearch.After = actionRow.After;
564 - }
565 - else if (0 < actionRow.Sequence)
566 - {
567 - appSearch.Sequence = actionRow.Sequence;
568 - }
569 -
570 - return appSearch;
571 - }
572 - break;
573 - case "BindImage":
574 - actionElement = new Wix.BindImage();
575 - break;
576 - case "CCPSearch":
577 - Wix.CCPSearch ccpSearch = new Wix.CCPSearch();
578 - Decompiler.SequenceRelativeAction(actionRow, ccpSearch);
579 - return ccpSearch;
580 - case "CostFinalize":
581 - actionElement = new Wix.CostFinalize();
582 - break;
583 - case "CostInitialize":
584 - actionElement = new Wix.CostInitialize();
585 - break;
586 - case "CreateFolders":
587 - actionElement = new Wix.CreateFolders();
588 - break;
589 - case "CreateShortcuts":
590 - actionElement = new Wix.CreateShortcuts();
591 - break;
592 - case "DeleteServices":
593 - actionElement = new Wix.DeleteServices();
594 - break;
595 - case "DisableRollback":
596 - Wix.DisableRollback disableRollback = new Wix.DisableRollback();
597 - Decompiler.SequenceRelativeAction(actionRow, disableRollback);
598 - return disableRollback;
599 - case "DuplicateFiles":
600 - actionElement = new Wix.DuplicateFiles();
601 - break;
602 - case "ExecuteAction":
603 - actionElement = new Wix.ExecuteAction();
604 - break;
605 - case "FileCost":
606 - actionElement = new Wix.FileCost();
607 - break;
608 - case "FindRelatedProducts":
609 - Wix.FindRelatedProducts findRelatedProducts = new Wix.FindRelatedProducts();
610 - Decompiler.SequenceRelativeAction(actionRow, findRelatedProducts);
611 - return findRelatedProducts;
612 - case "ForceReboot":
613 - Wix.ForceReboot forceReboot = new Wix.ForceReboot();
614 - Decompiler.SequenceRelativeAction(actionRow, forceReboot);
615 - return forceReboot;
616 - case "InstallAdminPackage":
617 - actionElement = new Wix.InstallAdminPackage();
618 - break;
619 - case "InstallExecute":
620 - Wix.InstallExecute installExecute = new Wix.InstallExecute();
621 - Decompiler.SequenceRelativeAction(actionRow, installExecute);
622 - return installExecute;
623 - case "InstallExecuteAgain":
624 - Wix.InstallExecuteAgain installExecuteAgain = new Wix.InstallExecuteAgain();
625 - Decompiler.SequenceRelativeAction(actionRow, installExecuteAgain);
626 - return installExecuteAgain;
627 - case "InstallFiles":
628 - actionElement = new Wix.InstallFiles();
629 - break;
630 - case "InstallFinalize":
631 - actionElement = new Wix.InstallFinalize();
632 - break;
633 - case "InstallInitialize":
634 - actionElement = new Wix.InstallInitialize();
635 - break;
636 - case "InstallODBC":
637 - actionElement = new Wix.InstallODBC();
638 - break;
639 - case "InstallServices":
640 - actionElement = new Wix.InstallServices();
641 - break;
642 - case "InstallValidate":
643 - actionElement = new Wix.InstallValidate();
644 - break;
645 - case "IsolateComponents":
646 - actionElement = new Wix.IsolateComponents();
647 - break;
648 - case "LaunchConditions":
649 - Wix.LaunchConditions launchConditions = new Wix.LaunchConditions();
650 - Decompiler.SequenceRelativeAction(actionRow, launchConditions);
651 - return launchConditions;
652 - case "MigrateFeatureStates":
653 - actionElement = new Wix.MigrateFeatureStates();
654 - break;
655 - case "MoveFiles":
656 - actionElement = new Wix.MoveFiles();
657 - break;
658 - case "MsiPublishAssemblies":
659 - actionElement = new Wix.MsiPublishAssemblies();
660 - break;
661 - case "MsiUnpublishAssemblies":
662 - actionElement = new Wix.MsiUnpublishAssemblies();
663 - break;
664 - case "PatchFiles":
665 - actionElement = new Wix.PatchFiles();
666 - break;
667 - case "ProcessComponents":
668 - actionElement = new Wix.ProcessComponents();
669 - break;
670 - case "PublishComponents":
671 - actionElement = new Wix.PublishComponents();
672 - break;
673 - case "PublishFeatures":
674 - actionElement = new Wix.PublishFeatures();
675 - break;
676 - case "PublishProduct":
677 - actionElement = new Wix.PublishProduct();
678 - break;
679 - case "RegisterClassInfo":
680 - actionElement = new Wix.RegisterClassInfo();
681 - break;
682 - case "RegisterComPlus":
683 - actionElement = new Wix.RegisterComPlus();
684 - break;
685 - case "RegisterExtensionInfo":
686 - actionElement = new Wix.RegisterExtensionInfo();
687 - break;
688 - case "RegisterFonts":
689 - actionElement = new Wix.RegisterFonts();
690 - break;
691 - case "RegisterMIMEInfo":
692 - actionElement = new Wix.RegisterMIMEInfo();
693 - break;
694 - case "RegisterProduct":
695 - actionElement = new Wix.RegisterProduct();
696 - break;
697 - case "RegisterProgIdInfo":
698 - actionElement = new Wix.RegisterProgIdInfo();
699 - break;
700 - case "RegisterTypeLibraries":
701 - actionElement = new Wix.RegisterTypeLibraries();
702 - break;
703 - case "RegisterUser":
704 - actionElement = new Wix.RegisterUser();
705 - break;
706 - case "RemoveDuplicateFiles":
707 - actionElement = new Wix.RemoveDuplicateFiles();
708 - break;
709 - case "RemoveEnvironmentStrings":
710 - actionElement = new Wix.RemoveEnvironmentStrings();
711 - break;
712 - case "RemoveExistingProducts":
713 - Wix.RemoveExistingProducts removeExistingProducts = new Wix.RemoveExistingProducts();
714 - Decompiler.SequenceRelativeAction(actionRow, removeExistingProducts);
715 - return removeExistingProducts;
716 - case "RemoveFiles":
717 - actionElement = new Wix.RemoveFiles();
718 - break;
719 - case "RemoveFolders":
720 - actionElement = new Wix.RemoveFolders();
721 - break;
722 - case "RemoveIniValues":
723 - actionElement = new Wix.RemoveIniValues();
724 - break;
725 - case "RemoveODBC":
726 - actionElement = new Wix.RemoveODBC();
727 - break;
728 - case "RemoveRegistryValues":
729 - actionElement = new Wix.RemoveRegistryValues();
730 - break;
731 - case "RemoveShortcuts":
732 - actionElement = new Wix.RemoveShortcuts();
733 - break;
734 - case "ResolveSource":
735 - Wix.ResolveSource resolveSource = new Wix.ResolveSource();
736 - Decompiler.SequenceRelativeAction(actionRow, resolveSource);
737 - return resolveSource;
738 - case "RMCCPSearch":
739 - Wix.RMCCPSearch rmccpSearch = new Wix.RMCCPSearch();
740 - Decompiler.SequenceRelativeAction(actionRow, rmccpSearch);
741 - return rmccpSearch;
742 - case "ScheduleReboot":
743 - Wix.ScheduleReboot scheduleReboot = new Wix.ScheduleReboot();
744 - Decompiler.SequenceRelativeAction(actionRow, scheduleReboot);
745 - return scheduleReboot;
746 - case "SelfRegModules":
747 - actionElement = new Wix.SelfRegModules();
748 - break;
749 - case "SelfUnregModules":
750 - actionElement = new Wix.SelfUnregModules();
751 - break;
752 - case "SetODBCFolders":
753 - actionElement = new Wix.SetODBCFolders();
754 - break;
755 - case "StartServices":
756 - actionElement = new Wix.StartServices();
757 - break;
758 - case "StopServices":
759 - actionElement = new Wix.StopServices();
760 - break;
761 - case "UnpublishComponents":
762 - actionElement = new Wix.UnpublishComponents();
763 - break;
764 - case "UnpublishFeatures":
765 - actionElement = new Wix.UnpublishFeatures();
766 - break;
767 - case "UnregisterClassInfo":
768 - actionElement = new Wix.UnregisterClassInfo();
769 - break;
770 - case "UnregisterComPlus":
771 - actionElement = new Wix.UnregisterComPlus();
772 - break;
773 - case "UnregisterExtensionInfo":
774 - actionElement = new Wix.UnregisterExtensionInfo();
775 - break;
776 - case "UnregisterFonts":
777 - actionElement = new Wix.UnregisterFonts();
778 - break;
779 - case "UnregisterMIMEInfo":
780 - actionElement = new Wix.UnregisterMIMEInfo();
781 - break;
782 - case "UnregisterProgIdInfo":
783 - actionElement = new Wix.UnregisterProgIdInfo();
784 - break;
785 - case "UnregisterTypeLibraries":
786 - actionElement = new Wix.UnregisterTypeLibraries();
787 - break;
788 - case "ValidateProductID":
789 - actionElement = new Wix.ValidateProductID();
790 - break;
791 - case "WriteEnvironmentStrings":
792 - actionElement = new Wix.WriteEnvironmentStrings();
793 - break;
794 - case "WriteIniValues":
795 - actionElement = new Wix.WriteIniValues();
796 - break;
797 - case "WriteRegistryValues":
798 - actionElement = new Wix.WriteRegistryValues();
799 - break;
800 - default:
801 - this.core.OnMessage(WixWarnings.UnknownAction(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action));
802 - return null;
403 + case "AllocateRegistrySpace":
404 + actionElement = new Wix.AllocateRegistrySpace();
405 + break;
406 + case "AppSearch":
407 + this.StandardActions.TryGetValue(actionRow.GetPrimaryKey(), out var appSearchActionRow);
408 +
409 + if (null != actionRow.Before || null != actionRow.After || (null != appSearchActionRow && actionRow.Sequence != appSearchActionRow.Sequence))
410 + {
411 + var appSearch = new Wix.AppSearch();
412 +
413 + if (null != actionRow.Condition)
414 + {
415 + appSearch.Content = actionRow.Condition;
416 + }
417 +
418 + if (null != actionRow.Before)
419 + {
420 + appSearch.Before = actionRow.Before;
421 + }
422 + else if (null != actionRow.After)
423 + {
424 + appSearch.After = actionRow.After;
425 + }
426 + else if (0 < actionRow.Sequence)
427 + {
428 + appSearch.Sequence = actionRow.Sequence;
429 + }
430 +
431 + return appSearch;
432 + }
433 + break;
434 + case "BindImage":
435 + actionElement = new Wix.BindImage();
436 + break;
437 + case "CCPSearch":
438 + var ccpSearch = new Wix.CCPSearch();
439 + Decompiler.SequenceRelativeAction(actionRow, ccpSearch);
440 + return ccpSearch;
441 + case "CostFinalize":
442 + actionElement = new Wix.CostFinalize();
443 + break;
444 + case "CostInitialize":
445 + actionElement = new Wix.CostInitialize();
446 + break;
447 + case "CreateFolders":
448 + actionElement = new Wix.CreateFolders();
449 + break;
450 + case "CreateShortcuts":
451 + actionElement = new Wix.CreateShortcuts();
452 + break;
453 + case "DeleteServices":
454 + actionElement = new Wix.DeleteServices();
455 + break;
456 + case "DisableRollback":
457 + var disableRollback = new Wix.DisableRollback();
458 + Decompiler.SequenceRelativeAction(actionRow, disableRollback);
459 + return disableRollback;
460 + case "DuplicateFiles":
461 + actionElement = new Wix.DuplicateFiles();
462 + break;
463 + case "ExecuteAction":
464 + actionElement = new Wix.ExecuteAction();
465 + break;
466 + case "FileCost":
467 + actionElement = new Wix.FileCost();
468 + break;
469 + case "FindRelatedProducts":
470 + var findRelatedProducts = new Wix.FindRelatedProducts();
471 + Decompiler.SequenceRelativeAction(actionRow, findRelatedProducts);
472 + return findRelatedProducts;
473 + case "ForceReboot":
474 + var forceReboot = new Wix.ForceReboot();
475 + Decompiler.SequenceRelativeAction(actionRow, forceReboot);
476 + return forceReboot;
477 + case "InstallAdminPackage":
478 + actionElement = new Wix.InstallAdminPackage();
479 + break;
480 + case "InstallExecute":
481 + var installExecute = new Wix.InstallExecute();
482 + Decompiler.SequenceRelativeAction(actionRow, installExecute);
483 + return installExecute;
484 + case "InstallExecuteAgain":
485 + var installExecuteAgain = new Wix.InstallExecuteAgain();
486 + Decompiler.SequenceRelativeAction(actionRow, installExecuteAgain);
487 + return installExecuteAgain;
488 + case "InstallFiles":
489 + actionElement = new Wix.InstallFiles();
490 + break;
491 + case "InstallFinalize":
492 + actionElement = new Wix.InstallFinalize();
493 + break;
494 + case "InstallInitialize":
495 + actionElement = new Wix.InstallInitialize();
496 + break;
497 + case "InstallODBC":
498 + actionElement = new Wix.InstallODBC();
499 + break;
500 + case "InstallServices":
501 + actionElement = new Wix.InstallServices();
502 + break;
503 + case "InstallValidate":
504 + actionElement = new Wix.InstallValidate();
505 + break;
506 + case "IsolateComponents":
507 + actionElement = new Wix.IsolateComponents();
508 + break;
509 + case "LaunchConditions":
510 + var launchConditions = new Wix.LaunchConditions();
511 + Decompiler.SequenceRelativeAction(actionRow, launchConditions);
512 + return launchConditions;
513 + case "MigrateFeatureStates":
514 + actionElement = new Wix.MigrateFeatureStates();
515 + break;
516 + case "MoveFiles":
517 + actionElement = new Wix.MoveFiles();
518 + break;
519 + case "MsiPublishAssemblies":
520 + actionElement = new Wix.MsiPublishAssemblies();
521 + break;
522 + case "MsiUnpublishAssemblies":
523 + actionElement = new Wix.MsiUnpublishAssemblies();
524 + break;
525 + case "PatchFiles":
526 + actionElement = new Wix.PatchFiles();
527 + break;
528 + case "ProcessComponents":
529 + actionElement = new Wix.ProcessComponents();
530 + break;
531 + case "PublishComponents":
532 + actionElement = new Wix.PublishComponents();
533 + break;
534 + case "PublishFeatures":
535 + actionElement = new Wix.PublishFeatures();
536 + break;
537 + case "PublishProduct":
538 + actionElement = new Wix.PublishProduct();
539 + break;
540 + case "RegisterClassInfo":
541 + actionElement = new Wix.RegisterClassInfo();
542 + break;
543 + case "RegisterComPlus":
544 + actionElement = new Wix.RegisterComPlus();
545 + break;
546 + case "RegisterExtensionInfo":
547 + actionElement = new Wix.RegisterExtensionInfo();
548 + break;
549 + case "RegisterFonts":
550 + actionElement = new Wix.RegisterFonts();
551 + break;
552 + case "RegisterMIMEInfo":
553 + actionElement = new Wix.RegisterMIMEInfo();
554 + break;
555 + case "RegisterProduct":
556 + actionElement = new Wix.RegisterProduct();
557 + break;
558 + case "RegisterProgIdInfo":
559 + actionElement = new Wix.RegisterProgIdInfo();
560 + break;
561 + case "RegisterTypeLibraries":
562 + actionElement = new Wix.RegisterTypeLibraries();
563 + break;
564 + case "RegisterUser":
565 + actionElement = new Wix.RegisterUser();
566 + break;
567 + case "RemoveDuplicateFiles":
568 + actionElement = new Wix.RemoveDuplicateFiles();
569 + break;
570 + case "RemoveEnvironmentStrings":
571 + actionElement = new Wix.RemoveEnvironmentStrings();
572 + break;
573 + case "RemoveExistingProducts":
574 + var removeExistingProducts = new Wix.RemoveExistingProducts();
575 + Decompiler.SequenceRelativeAction(actionRow, removeExistingProducts);
576 + return removeExistingProducts;
577 + case "RemoveFiles":
578 + actionElement = new Wix.RemoveFiles();
579 + break;
580 + case "RemoveFolders":
581 + actionElement = new Wix.RemoveFolders();
582 + break;
583 + case "RemoveIniValues":
584 + actionElement = new Wix.RemoveIniValues();
585 + break;
586 + case "RemoveODBC":
587 + actionElement = new Wix.RemoveODBC();
588 + break;
589 + case "RemoveRegistryValues":
590 + actionElement = new Wix.RemoveRegistryValues();
591 + break;
592 + case "RemoveShortcuts":
593 + actionElement = new Wix.RemoveShortcuts();
594 + break;
595 + case "ResolveSource":
596 + var resolveSource = new Wix.ResolveSource();
597 + Decompiler.SequenceRelativeAction(actionRow, resolveSource);
598 + return resolveSource;
599 + case "RMCCPSearch":
600 + var rmccpSearch = new Wix.RMCCPSearch();
601 + Decompiler.SequenceRelativeAction(actionRow, rmccpSearch);
602 + return rmccpSearch;
603 + case "ScheduleReboot":
604 + var scheduleReboot = new Wix.ScheduleReboot();
605 + Decompiler.SequenceRelativeAction(actionRow, scheduleReboot);
606 + return scheduleReboot;
607 + case "SelfRegModules":
608 + actionElement = new Wix.SelfRegModules();
609 + break;
610 + case "SelfUnregModules":
611 + actionElement = new Wix.SelfUnregModules();
612 + break;
613 + case "SetODBCFolders":
614 + actionElement = new Wix.SetODBCFolders();
615 + break;
616 + case "StartServices":
617 + actionElement = new Wix.StartServices();
618 + break;
619 + case "StopServices":
620 + actionElement = new Wix.StopServices();
621 + break;
622 + case "UnpublishComponents":
623 + actionElement = new Wix.UnpublishComponents();
624 + break;
625 + case "UnpublishFeatures":
626 + actionElement = new Wix.UnpublishFeatures();
627 + break;
628 + case "UnregisterClassInfo":
629 + actionElement = new Wix.UnregisterClassInfo();
630 + break;
631 + case "UnregisterComPlus":
632 + actionElement = new Wix.UnregisterComPlus();
633 + break;
634 + case "UnregisterExtensionInfo":
635 + actionElement = new Wix.UnregisterExtensionInfo();
636 + break;
637 + case "UnregisterFonts":
638 + actionElement = new Wix.UnregisterFonts();
639 + break;
640 + case "UnregisterMIMEInfo":
641 + actionElement = new Wix.UnregisterMIMEInfo();
642 + break;
643 + case "UnregisterProgIdInfo":
644 + actionElement = new Wix.UnregisterProgIdInfo();
645 + break;
646 + case "UnregisterTypeLibraries":
647 + actionElement = new Wix.UnregisterTypeLibraries();
648 + break;
649 + case "ValidateProductID":
650 + actionElement = new Wix.ValidateProductID();
651 + break;
652 + case "WriteEnvironmentStrings":
653 + actionElement = new Wix.WriteEnvironmentStrings();
654 + break;
655 + case "WriteIniValues":
656 + actionElement = new Wix.WriteIniValues();
657 + break;
658 + case "WriteRegistryValues":
659 + actionElement = new Wix.WriteRegistryValues();
660 + break;
661 + default:
662 + this.Messaging.Write(WarningMessages.UnknownAction(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action));
663 + return null;
664 }
665
666 if (actionElement != null)
@@ -824,7 +685,7 @@ namespace WixToolset.Core.WindowsInstaller
685
686 if ((null != actionRow.Before || null != actionRow.After) && 0 == actionRow.Sequence)
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));
689 }
690 else if (0 < actionRow.Sequence)
691 {
@@ -865,7 +726,7 @@ namespace WixToolset.Core.WindowsInstaller
726 /// <returns>The property element.</returns>
727 private Wix.Property EnsureProperty(string id)
728 {
868 - Wix.Property property = (Wix.Property)this.core.GetIndexedElement("Property", id);
729 + var property = (Wix.Property)this.core.GetIndexedElement("Property", id);
730
731 if (null == property)
732 {
@@ -873,7 +734,7 @@ namespace WixToolset.Core.WindowsInstaller
734 property.Id = id;
735
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"]);
738 row[0] = id;
739
740 this.core.RootElement.AddChild(property);
@@ -889,7 +750,7 @@ namespace WixToolset.Core.WindowsInstaller
750 /// <param name="tables">The collection of all tables.</param>
751 private void FinalizeDecompile(TableIndexedCollection tables)
752 {
892 - if (OutputType.PatchCreation == this.outputType)
753 + if (OutputType.PatchCreation == this.OutputType)
754 {
755 this.FinalizeFamilyFileRangesTable(tables);
756 }
@@ -926,21 +787,21 @@ namespace WixToolset.Core.WindowsInstaller
787 private void FinalizeCheckBoxTable(TableIndexedCollection tables)
788 {
789 // if the user has requested to suppress the UI elements, we have nothing to do
929 - if (this.suppressUI)
790 + if (this.SuppressUI)
791 {
792 return;
793 }
794
934 - Table checkBoxTable = tables["CheckBox"];
935 - Table controlTable = tables["Control"];
795 + var checkBoxTable = tables["CheckBox"];
796 + var controlTable = tables["Control"];
797
937 - Hashtable checkBoxes = new Hashtable();
938 - Hashtable checkBoxProperties = new Hashtable();
798 + var checkBoxes = new Hashtable();
799 + var checkBoxProperties = new Hashtable();
800
801 // index the CheckBox table
802 if (null != checkBoxTable)
803 {
943 - foreach (Row row in checkBoxTable.Rows)
804 + foreach (var row in checkBoxTable.Rows)
805 {
806 checkBoxes.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row);
807 checkBoxProperties.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), false);
@@ -950,17 +811,17 @@ namespace WixToolset.Core.WindowsInstaller
811 // enumerate through the Control table, adding CheckBox values where appropriate
812 if (null != controlTable)
813 {
953 - foreach (Row row in controlTable.Rows)
814 + foreach (var row in controlTable.Rows)
815 {
955 - Wix.Control control = (Wix.Control)this.core.GetIndexedElement(row);
816 + var control = (Wix.Control)this.core.GetIndexedElement(row);
817
818 if ("CheckBox" == Convert.ToString(row[2]) && null != row[8])
819 {
959 - Row checkBoxRow = (Row)checkBoxes[row[8]];
820 + var checkBoxRow = (Row)checkBoxes[row[8]];
821
822 if (null == checkBoxRow)
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"));
825 }
826 else
827 {
@@ -994,21 +855,21 @@ namespace WixToolset.Core.WindowsInstaller
855 /// </remarks>
856 private void FinalizeComponentTable(TableIndexedCollection tables)
857 {
997 - Table componentTable = tables["Component"];
998 - Table fileTable = tables["File"];
999 - Table odbcDataSourceTable = tables["ODBCDataSource"];
1000 - Table registryTable = tables["Registry"];
858 + var componentTable = tables["Component"];
859 + var fileTable = tables["File"];
860 + var odbcDataSourceTable = tables["ODBCDataSource"];
861 + var registryTable = tables["Registry"];
862
863 // set the component keypaths
864 if (null != componentTable)
865 {
1005 - foreach (Row row in componentTable.Rows)
866 + foreach (var row in componentTable.Rows)
867 {
1007 - int attributes = Convert.ToInt32(row[3]);
868 + var attributes = Convert.ToInt32(row[3]);
869
870 if (null == row[5])
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]));
873
874 component.KeyPath = Wix.YesNoType.yes;
875 }
@@ -1018,7 +879,7 @@ namespace WixToolset.Core.WindowsInstaller
879
880 if (null != registryObject)
881 {
1021 - Wix.RegistryValue registryValue = registryObject as Wix.RegistryValue;
882 + var registryValue = registryObject as Wix.RegistryValue;
883
884 if (null != registryValue)
885 {
@@ -1026,17 +887,17 @@ namespace WixToolset.Core.WindowsInstaller
887 }
888 else
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])));
891 }
892 }
893 else
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"));
896 }
897 }
898 else if (MsiInterop.MsidbComponentAttributesODBCDataSource == (attributes & MsiInterop.MsidbComponentAttributesODBCDataSource))
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]));
901
902 if (null != odbcDataSource)
903 {
@@ -1044,12 +905,12 @@ namespace WixToolset.Core.WindowsInstaller
905 }
906 else
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"));
909 }
910 }
911 else
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]));
914
915 if (null != file)
916 {
@@ -1057,7 +918,7 @@ namespace WixToolset.Core.WindowsInstaller
918 }
919 else
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"));
922 }
923 }
924 }
@@ -1068,8 +929,8 @@ namespace WixToolset.Core.WindowsInstaller
929 {
930 foreach (FileRow fileRow in fileTable.Rows)
931 {
1071 - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", fileRow.Component);
1072 - Wix.File file = (Wix.File)this.core.GetIndexedElement(fileRow);
932 + var component = (Wix.Component)this.core.GetIndexedElement("Component", fileRow.Component);
933 + var file = (Wix.File)this.core.GetIndexedElement(fileRow);
934
935 if (null != component)
936 {
@@ -1077,7 +938,7 @@ namespace WixToolset.Core.WindowsInstaller
938 }
939 else
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"));
942 }
943 }
944 }
@@ -1085,10 +946,10 @@ namespace WixToolset.Core.WindowsInstaller
946 // add the ODBCDataSource children elements
947 if (null != odbcDataSourceTable)
948 {
1088 - foreach (Row row in odbcDataSourceTable.Rows)
949 + foreach (var row in odbcDataSourceTable.Rows)
950 {
1090 - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
1091 - Wix.ODBCDataSource odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement(row);
951 + var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[1]));
952 + var odbcDataSource = (Wix.ODBCDataSource)this.core.GetIndexedElement(row);
953
954 if (null != component)
955 {
@@ -1096,7 +957,7 @@ namespace WixToolset.Core.WindowsInstaller
957 }
958 else
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"));
961 }
962 }
963 }
@@ -1104,10 +965,10 @@ namespace WixToolset.Core.WindowsInstaller
965 // add the Registry children elements
966 if (null != registryTable)
967 {
1107 - foreach (Row row in registryTable.Rows)
968 + foreach (var row in registryTable.Rows)
969 {
1109 - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5]));
1110 - Wix.ISchemaElement registryElement = (Wix.ISchemaElement)this.core.GetIndexedElement(row);
970 + var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[5]));
971 + var registryElement = this.core.GetIndexedElement(row);
972
973 if (null != component)
974 {
@@ -1115,7 +976,7 @@ namespace WixToolset.Core.WindowsInstaller
976 }
977 else
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"));
980 }
981 }
982 }
@@ -1132,21 +993,21 @@ namespace WixToolset.Core.WindowsInstaller
993 private void FinalizeDialogTable(TableIndexedCollection tables)
994 {
995 // if the user has requested to suppress the UI elements, we have nothing to do
1135 - if (this.suppressUI)
996 + if (this.SuppressUI)
997 {
998 return;
999 }
1000
1140 - Table controlTable = tables["Control"];
1141 - Table dialogTable = tables["Dialog"];
1001 + var controlTable = tables["Control"];
1002 + var dialogTable = tables["Dialog"];
1003
1143 - Hashtable addedControls = new Hashtable();
1144 - Hashtable controlRows = new Hashtable();
1004 + var addedControls = new Hashtable();
1005 + var controlRows = new Hashtable();
1006
1007 // index the rows in the control rows (because we need the Control_Next value)
1008 if (null != controlTable)
1009 {
1149 - foreach (Row row in controlTable.Rows)
1010 + foreach (var row in controlTable.Rows)
1011 {
1012 controlRows.Add(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), row);
1013 }
@@ -1154,21 +1015,21 @@ namespace WixToolset.Core.WindowsInstaller
1015
1016 if (null != dialogTable)
1017 {
1157 - foreach (Row row in dialogTable.Rows)
1018 + foreach (var row in dialogTable.Rows)
1019 {
1159 - Wix.Dialog dialog = (Wix.Dialog)this.core.GetIndexedElement(row);
1160 - string dialogId = Convert.ToString(row[0]);
1020 + var dialog = (Wix.Dialog)this.core.GetIndexedElement(row);
1021 + var dialogId = Convert.ToString(row[0]);
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]));
1024 if (null == control)
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"));
1027 }
1028
1029 // add tabbable controls
1030 while (null != control)
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)];
1033
1034 control.TabSkip = Wix.YesNoType.no;
1035 dialog.AddChild(control);
@@ -1187,7 +1048,7 @@ namespace WixToolset.Core.WindowsInstaller
1048 }
1049 else
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"));
1052 }
1053 }
1054 else
@@ -1199,7 +1060,7 @@ namespace WixToolset.Core.WindowsInstaller
1060 // set default control
1061 if (null != row[8])
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]));
1064
1065 if (null != defaultControl)
1066 {
@@ -1207,14 +1068,14 @@ namespace WixToolset.Core.WindowsInstaller
1068 }
1069 else
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"));
1072 }
1073 }
1074
1075 // set cancel control
1076 if (null != row[9])
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]));
1079
1080 if (null != cancelControl)
1081 {
@@ -1222,7 +1083,7 @@ namespace WixToolset.Core.WindowsInstaller
1083 }
1084 else
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"));
1087 }
1088 }
1089 }
@@ -1231,14 +1092,14 @@ namespace WixToolset.Core.WindowsInstaller
1092 // add the non-tabbable controls to the dialog
1093 if (null != controlTable)
1094 {
1234 - foreach (Row row in controlTable.Rows)
1095 + foreach (var row in controlTable.Rows)
1096 {
1236 - Wix.Control control = (Wix.Control)this.core.GetIndexedElement(row);
1237 - Wix.Dialog dialog = (Wix.Dialog)this.core.GetIndexedElement("Dialog", Convert.ToString(row[0]));
1097 + var control = (Wix.Control)this.core.GetIndexedElement(row);
1098 + var dialog = (Wix.Dialog)this.core.GetIndexedElement("Dialog", Convert.ToString(row[0]));
1099
1100 if (null == dialog)
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"));
1103 continue;
1104 }
1105
@@ -1261,14 +1122,14 @@ namespace WixToolset.Core.WindowsInstaller
1122 /// </remarks>
1123 private void FinalizeDuplicateMoveFileTables(TableIndexedCollection tables)
1124 {
1264 - Table duplicateFileTable = tables["DuplicateFile"];
1265 - Table moveFileTable = tables["MoveFile"];
1125 + var duplicateFileTable = tables["DuplicateFile"];
1126 + var moveFileTable = tables["MoveFile"];
1127
1128 if (null != duplicateFileTable)
1129 {
1269 - foreach (Row row in duplicateFileTable.Rows)
1130 + foreach (var row in duplicateFileTable.Rows)
1131 {
1271 - Wix.CopyFile copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row);
1132 + var copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row);
1133
1134 if (null != row[4])
1135 {
@@ -1286,9 +1147,9 @@ namespace WixToolset.Core.WindowsInstaller
1147
1148 if (null != moveFileTable)
1149 {
1289 - foreach (Row row in moveFileTable.Rows)
1150 + foreach (var row in moveFileTable.Rows)
1151 {
1291 - Wix.CopyFile copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row);
1152 + var copyFile = (Wix.CopyFile)this.core.GetIndexedElement(row);
1153
1154 if (null != row[4])
1155 {
@@ -1320,26 +1181,26 @@ namespace WixToolset.Core.WindowsInstaller
1181 /// <param name="tables">The collection of all tables.</param>
1182 private void FinalizeFamilyFileRangesTable(TableIndexedCollection tables)
1183 {
1323 - Table externalFilesTable = tables["ExternalFiles"];
1324 - Table familyFileRangesTable = tables["FamilyFileRanges"];
1325 - Table targetFiles_OptionalDataTable = tables["TargetFiles_OptionalData"];
1184 + var externalFilesTable = tables["ExternalFiles"];
1185 + var familyFileRangesTable = tables["FamilyFileRanges"];
1186 + var targetFiles_OptionalDataTable = tables["TargetFiles_OptionalData"];
1187
1327 - Hashtable usedProtectRanges = new Hashtable();
1188 + var usedProtectRanges = new Hashtable();
1189
1190 if (null != familyFileRangesTable)
1191 {
1331 - foreach (Row row in familyFileRangesTable.Rows)
1192 + foreach (var row in familyFileRangesTable.Rows)
1193 {
1333 - Wix.ProtectRange protectRange = new Wix.ProtectRange();
1194 + var protectRange = new Wix.ProtectRange();
1195
1196 if (null != row[2] && null != row[3])
1197 {
1337 - string[] retainOffsets = (Convert.ToString(row[2])).Split(',');
1338 - string[] retainLengths = (Convert.ToString(row[3])).Split(',');
1198 + var retainOffsets = (Convert.ToString(row[2])).Split(',');
1199 + var retainLengths = (Convert.ToString(row[3])).Split(',');
1200
1201 if (retainOffsets.Length == retainLengths.Length)
1202 {
1342 - for (int i = 0; i < retainOffsets.Length; i++)
1203 + for (var i = 0; i < retainOffsets.Length; i++)
1204 {
1205 if (retainOffsets[i].StartsWith("0x", StringComparison.Ordinal))
1206 {
@@ -1376,11 +1237,11 @@ namespace WixToolset.Core.WindowsInstaller
1237
1238 if (null != externalFilesTable)
1239 {
1379 - foreach (Row row in externalFilesTable.Rows)
1240 + foreach (var row in externalFilesTable.Rows)
1241 {
1381 - Wix.ExternalFile externalFile = (Wix.ExternalFile)this.core.GetIndexedElement(row);
1242 + var externalFile = (Wix.ExternalFile)this.core.GetIndexedElement(row);
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]));
1245 if (null != protectRange)
1246 {
1247 externalFile.AddChild(protectRange);
@@ -1391,16 +1252,16 @@ namespace WixToolset.Core.WindowsInstaller
1252
1253 if (null != targetFiles_OptionalDataTable)
1254 {
1394 - Table targetImagesTable = tables["TargetImages"];
1395 - Table upgradedImagesTable = tables["UpgradedImages"];
1255 + var targetImagesTable = tables["TargetImages"];
1256 + var upgradedImagesTable = tables["UpgradedImages"];
1257
1397 - Hashtable targetImageRows = new Hashtable();
1398 - Hashtable upgradedImagesRows = new Hashtable();
1258 + var targetImageRows = new Hashtable();
1259 + var upgradedImagesRows = new Hashtable();
1260
1261 // index the TargetImages table
1262 if (null != targetImagesTable)
1263 {
1403 - foreach (Row row in targetImagesTable.Rows)
1264 + foreach (var row in targetImagesTable.Rows)
1265 {
1266 targetImageRows.Add(row[0], row);
1267 }
@@ -1409,31 +1270,31 @@ namespace WixToolset.Core.WindowsInstaller
1270 // index the UpgradedImages table
1271 if (null != upgradedImagesTable)
1272 {
1412 - foreach (Row row in upgradedImagesTable.Rows)
1273 + foreach (var row in upgradedImagesTable.Rows)
1274 {
1275 upgradedImagesRows.Add(row[0], row);
1276 }
1277 }
1278
1418 - foreach (Row row in targetFiles_OptionalDataTable.Rows)
1279 + foreach (var row in targetFiles_OptionalDataTable.Rows)
1280 {
1420 - Wix.TargetFile targetFile = (Wix.TargetFile)this.patchTargetFiles[row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)];
1281 + var targetFile = (Wix.TargetFile)this.patchTargetFiles[row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)];
1282
1422 - Row targetImageRow = (Row)targetImageRows[row[0]];
1283 + var targetImageRow = (Row)targetImageRows[row[0]];
1284 if (null == targetImageRow)
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"));
1287 continue;
1288 }
1289
1429 - Row upgradedImagesRow = (Row)upgradedImagesRows[targetImageRow[3]];
1290 + var upgradedImagesRow = (Row)upgradedImagesRows[targetImageRow[3]];
1291 if (null == upgradedImagesRow)
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"));
1294 continue;
1295 }
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]));
1298 if (null != protectRange)
1299 {
1300 targetFile.AddChild(protectRange);
@@ -1444,26 +1305,26 @@ namespace WixToolset.Core.WindowsInstaller
1305
1306 if (null != familyFileRangesTable)
1307 {
1447 - foreach (Row row in familyFileRangesTable.Rows)
1308 + foreach (var row in familyFileRangesTable.Rows)
1309 {
1449 - Wix.ProtectRange protectRange = (Wix.ProtectRange)this.core.GetIndexedElement(row);
1310 + var protectRange = (Wix.ProtectRange)this.core.GetIndexedElement(row);
1311
1312 if (!usedProtectRanges.Contains(protectRange))
1313 {
1453 - Wix.ProtectFile protectFile = new Wix.ProtectFile();
1314 + var protectFile = new Wix.ProtectFile();
1315
1316 protectFile.File = Convert.ToString(row[1]);
1317
1318 protectFile.AddChild(protectRange);
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]));
1321 if (null != family)
1322 {
1323 family.AddChild(protectFile);
1324 }
1325 else
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"));
1328 }
1329 }
1330 }
@@ -1481,16 +1342,16 @@ namespace WixToolset.Core.WindowsInstaller
1342 /// </remarks>
1343 private void FinalizeFeatureComponentsTable(TableIndexedCollection tables)
1344 {
1484 - Table classTable = tables["Class"];
1485 - Table extensionTable = tables["Extension"];
1486 - Table msiAssemblyTable = tables["MsiAssembly"];
1487 - Table publishComponentTable = tables["PublishComponent"];
1488 - Table shortcutTable = tables["Shortcut"];
1489 - Table typeLibTable = tables["TypeLib"];
1345 + var classTable = tables["Class"];
1346 + var extensionTable = tables["Extension"];
1347 + var msiAssemblyTable = tables["MsiAssembly"];
1348 + var publishComponentTable = tables["PublishComponent"];
1349 + var shortcutTable = tables["Shortcut"];
1350 + var typeLibTable = tables["TypeLib"];
1351
1352 if (null != classTable)
1353 {
1493 - foreach (Row row in classTable.Rows)
1354 + foreach (var row in classTable.Rows)
1355 {
1356 this.SetPrimaryFeature(row, 11, 2);
1357 }
@@ -1498,7 +1359,7 @@ namespace WixToolset.Core.WindowsInstaller
1359
1360 if (null != extensionTable)
1361 {
1501 - foreach (Row row in extensionTable.Rows)
1362 + foreach (var row in extensionTable.Rows)
1363 {
1364 this.SetPrimaryFeature(row, 4, 1);
1365 }
@@ -1506,7 +1367,7 @@ namespace WixToolset.Core.WindowsInstaller
1367
1368 if (null != msiAssemblyTable)
1369 {
1509 - foreach (Row row in msiAssemblyTable.Rows)
1370 + foreach (var row in msiAssemblyTable.Rows)
1371 {
1372 this.SetPrimaryFeature(row, 1, 0);
1373 }
@@ -1514,7 +1375,7 @@ namespace WixToolset.Core.WindowsInstaller
1375
1376 if (null != publishComponentTable)
1377 {
1517 - foreach (Row row in publishComponentTable.Rows)
1378 + foreach (var row in publishComponentTable.Rows)
1379 {
1380 this.SetPrimaryFeature(row, 4, 2);
1381 }
@@ -1522,9 +1383,9 @@ namespace WixToolset.Core.WindowsInstaller
1383
1384 if (null != shortcutTable)
1385 {
1525 - foreach (Row row in shortcutTable.Rows)
1386 + foreach (var row in shortcutTable.Rows)
1387 {
1527 - string target = Convert.ToString(row[4]);
1388 + var target = Convert.ToString(row[4]);
1389
1390 if (!target.StartsWith("[", StringComparison.Ordinal) && !target.EndsWith("]", StringComparison.Ordinal))
1391 {
@@ -1535,7 +1396,7 @@ namespace WixToolset.Core.WindowsInstaller
1396
1397 if (null != typeLibTable)
1398 {
1538 - foreach (Row row in typeLibTable.Rows)
1399 + foreach (var row in typeLibTable.Rows)
1400 {
1401 this.SetPrimaryFeature(row, 6, 2);
1402 }
@@ -1551,10 +1412,10 @@ namespace WixToolset.Core.WindowsInstaller
1412 /// </remarks>
1413 private void FinalizeFileTable(TableIndexedCollection tables)
1414 {
1554 - Table fileTable = tables["File"];
1555 - Table mediaTable = tables["Media"];
1556 - Table msiAssemblyTable = tables["MsiAssembly"];
1557 - Table typeLibTable = tables["TypeLib"];
1415 + var fileTable = tables["File"];
1416 + var mediaTable = tables["Media"];
1417 + var msiAssemblyTable = tables["MsiAssembly"];
1418 + var typeLibTable = tables["TypeLib"];
1419
1420 // index the media table by media id
1421 RowDictionary<MediaRow> mediaRows;
@@ -1568,7 +1429,7 @@ namespace WixToolset.Core.WindowsInstaller
1429 {
1430 foreach (FileRow fileRow in fileTable.Rows)
1431 {
1571 - Wix.File file = (Wix.File)this.core.GetIndexedElement("File", fileRow.File);
1432 + var file = (Wix.File)this.core.GetIndexedElement("File", fileRow.File);
1433
1434 // Don't bother processing files that are orphaned (and won't show up in the output anyway)
1435 if (null != file.ParentElement)
@@ -1578,7 +1439,7 @@ namespace WixToolset.Core.WindowsInstaller
1439 {
1440 foreach (MediaRow mediaRow in mediaTable.Rows)
1441 {
1581 - if (fileRow.Sequence <= mediaRow.LastSequence)
1442 + if (fileRow.Sequence <= mediaRow.LastSequence && mediaRow.DiskId != 1)
1443 {
1444 file.DiskId = Convert.ToString(mediaRow.DiskId);
1445 break;
@@ -1587,17 +1448,17 @@ namespace WixToolset.Core.WindowsInstaller
1448 }
1449
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)
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('-', '_'));
1454 }
1455 else if (Wix.YesNoDefaultType.yes == file.Compressed || (Wix.YesNoDefaultType.no != file.Compressed && this.compressed))
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);
1458 }
1459 else // uncompressed
1460 {
1600 - string fileName = (null != file.ShortName ? file.ShortName : file.Name);
1461 + var fileName = (null != file.ShortName ? file.ShortName : file.Name);
1462
1463 if (!this.shortNames && null != file.Name)
1464 {
@@ -1610,7 +1471,7 @@ namespace WixToolset.Core.WindowsInstaller
1471 }
1472 else
1473 {
1613 - string sourcePath = this.GetSourcePath(file);
1474 + var sourcePath = this.GetSourcePath(file);
1475
1476 file.Source = Path.Combine(sourcePath, fileName);
1477 }
@@ -1622,19 +1483,19 @@ namespace WixToolset.Core.WindowsInstaller
1483 // set the file assemblies and manifests
1484 if (null != msiAssemblyTable)
1485 {
1625 - foreach (Row row in msiAssemblyTable.Rows)
1486 + foreach (var row in msiAssemblyTable.Rows)
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]));
1489
1490 if (null == component)
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"));
1493 }
1494 else
1495 {
1496 foreach (Wix.ISchemaElement element in component.Children)
1497 {
1637 - Wix.File file = element as Wix.File;
1498 + var file = element as Wix.File;
1499
1500 if (null != file && Wix.YesNoType.yes == file.KeyPath)
1501 {
@@ -1665,14 +1526,14 @@ namespace WixToolset.Core.WindowsInstaller
1526 // nest the TypeLib elements
1527 if (null != typeLibTable)
1528 {
1668 - foreach (Row row in typeLibTable.Rows)
1529 + foreach (var row in typeLibTable.Rows)
1530 {
1670 - Wix.Component component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2]));
1671 - Wix.TypeLib typeLib = (Wix.TypeLib)this.core.GetIndexedElement(row);
1531 + var component = (Wix.Component)this.core.GetIndexedElement("Component", Convert.ToString(row[2]));
1532 + var typeLib = (Wix.TypeLib)this.core.GetIndexedElement(row);
1533
1534 foreach (Wix.ISchemaElement element in component.Children)
1535 {
1675 - Wix.File file = element as Wix.File;
1536 + var file = element as Wix.File;
1537
1538 if (null != file && Wix.YesNoType.yes == file.KeyPath)
1539 {
@@ -1694,16 +1555,16 @@ namespace WixToolset.Core.WindowsInstaller
1555 /// </remarks>
1556 private void FinalizeMIMETable(TableIndexedCollection tables)
1557 {
1697 - Table extensionTable = tables["Extension"];
1698 - Table mimeTable = tables["MIME"];
1558 + var extensionTable = tables["Extension"];
1559 + var mimeTable = tables["MIME"];
1560
1700 - Hashtable comExtensions = new Hashtable();
1561 + var comExtensions = new Hashtable();
1562
1563 if (null != extensionTable)
1564 {
1704 - foreach (Row row in extensionTable.Rows)
1565 + foreach (var row in extensionTable.Rows)
1566 {
1706 - Wix.Extension extension = (Wix.Extension)this.core.GetIndexedElement(row);
1567 + var extension = (Wix.Extension)this.core.GetIndexedElement(row);
1568
1569 // index the extension
1570 if (!comExtensions.Contains(row[0]))
@@ -1715,7 +1576,7 @@ namespace WixToolset.Core.WindowsInstaller
1576 // set the default MIME element for this extension
1577 if (null != row[3])
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]));
1580
1581 if (null != mime)
1582 {
@@ -1723,7 +1584,7 @@ namespace WixToolset.Core.WindowsInstaller
1584 }
1585 else
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"));
1588 }
1589 }
1590 }
@@ -1731,13 +1592,13 @@ namespace WixToolset.Core.WindowsInstaller
1592
1593 if (null != mimeTable)
1594 {
1734 - foreach (Row row in mimeTable.Rows)
1595 + foreach (var row in mimeTable.Rows)
1596 {
1736 - Wix.MIME mime = (Wix.MIME)this.core.GetIndexedElement(row);
1597 + var mime = (Wix.MIME)this.core.GetIndexedElement(row);
1598
1599 if (comExtensions.Contains(row[1]))
1600 {
1740 - ArrayList extensionElements = (ArrayList)comExtensions[row[1]];
1601 + var extensionElements = (ArrayList)comExtensions[row[1]];
1602
1603 foreach (Wix.Extension extension in extensionElements)
1604 {
@@ -1746,7 +1607,7 @@ namespace WixToolset.Core.WindowsInstaller
1607 }
1608 else
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"));
1611 }
1612 }
1613 }
@@ -1764,31 +1625,31 @@ namespace WixToolset.Core.WindowsInstaller
1625 /// </remarks>
1626 private void FinalizeProgIdTable(TableIndexedCollection tables)
1627 {
1767 - Table classTable = tables["Class"];
1768 - Table progIdTable = tables["ProgId"];
1769 - Table extensionTable = tables["Extension"];
1770 - Table componentTable = tables["Component"];
1628 + var classTable = tables["Class"];
1629 + var progIdTable = tables["ProgId"];
1630 + var extensionTable = tables["Extension"];
1631 + var componentTable = tables["Component"];
1632
1772 - Hashtable addedProgIds = new Hashtable();
1773 - Hashtable classes = new Hashtable();
1774 - Hashtable components = new Hashtable();
1633 + var addedProgIds = new Hashtable();
1634 + var classes = new Hashtable();
1635 + var components = new Hashtable();
1636
1637 // add the default ProgIds for each class (and index the class table)
1638 if (null != classTable)
1639 {
1779 - foreach (Row row in classTable.Rows)
1640 + foreach (var row in classTable.Rows)
1641 {
1781 - Wix.Class wixClass = (Wix.Class)this.core.GetIndexedElement(row);
1642 + var wixClass = (Wix.Class)this.core.GetIndexedElement(row);
1643
1644 if (null != row[3])
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]));
1647
1648 if (null != progId)
1649 {
1650 if (addedProgIds.Contains(progId))
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])));
1653 }
1654 else
1655 {
@@ -1798,7 +1659,7 @@ namespace WixToolset.Core.WindowsInstaller
1659 }
1660 else
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"));
1663 }
1664 }
1665
@@ -1814,13 +1675,13 @@ namespace WixToolset.Core.WindowsInstaller
1675 // add the remaining non-default ProgId entries for each class
1676 if (null != progIdTable)
1677 {
1817 - foreach (Row row in progIdTable.Rows)
1678 + foreach (var row in progIdTable.Rows)
1679 {
1819 - Wix.ProgId progId = (Wix.ProgId)this.core.GetIndexedElement(row);
1680 + var progId = (Wix.ProgId)this.core.GetIndexedElement(row);
1681
1682 if (!addedProgIds.Contains(progId) && null != row[2] && null == progId.ParentElement)
1683 {
1823 - ArrayList classElements = (ArrayList)classes[row[2]];
1684 + var classElements = (ArrayList)classes[row[2]];
1685
1686 if (null != classElements)
1687 {
@@ -1832,7 +1693,7 @@ namespace WixToolset.Core.WindowsInstaller
1693 }
1694 else
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"));
1697 }
1698 }
1699 }
@@ -1840,9 +1701,9 @@ namespace WixToolset.Core.WindowsInstaller
1701
1702 if (null != componentTable)
1703 {
1843 - foreach (Row row in componentTable.Rows)
1704 + foreach (var row in componentTable.Rows)
1705 {
1845 - Wix.Component wixComponent = (Wix.Component)this.core.GetIndexedElement(row);
1706 + var wixComponent = (Wix.Component)this.core.GetIndexedElement(row);
1707
1708 // index the Class elements for nesting of ProgId elements (which don't use the full Class primary key)
1709 if (!components.Contains(wixComponent.Id))
@@ -1856,7 +1717,7 @@ namespace WixToolset.Core.WindowsInstaller
1717 // Check for any progIds that are not hooked up to a class and hook them up to the component specified by the extension
1718 if (null != extensionTable)
1719 {
1859 - foreach (Row row in extensionTable.Rows)
1720 + foreach (var row in extensionTable.Rows)
1721 {
1722 // ignore the extension if it isn't associated with a progId
1723 if (null == row[2])
@@ -1864,12 +1725,12 @@ namespace WixToolset.Core.WindowsInstaller
1725 continue;
1726 }
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]));
1729
1730 // Haven't added the progId yet and it doesn't have a parent progId
1731 if (!addedProgIds.Contains(progId) && null == progId.ParentElement)
1732 {
1872 - ArrayList componentElements = (ArrayList)components[row[1]];
1733 + var componentElements = (ArrayList)components[row[1]];
1734
1735 if (null != componentElements)
1736 {
@@ -1880,7 +1741,7 @@ namespace WixToolset.Core.WindowsInstaller
1741 }
1742 else
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"));
1745 }
1746 }
1747 }
@@ -1896,18 +1757,18 @@ namespace WixToolset.Core.WindowsInstaller
1757 /// </remarks>
1758 private void FinalizePropertyTable(TableIndexedCollection tables)
1759 {
1899 - Table propertyTable = tables["Property"];
1900 - Table customActionTable = tables["CustomAction"];
1760 + var propertyTable = tables["Property"];
1761 + var customActionTable = tables["CustomAction"];
1762
1763 if (null != propertyTable && null != customActionTable)
1764 {
1904 - foreach (Row row in customActionTable.Rows)
1765 + foreach (var row in customActionTable.Rows)
1766 {
1906 - int bits = Convert.ToInt32(row[1]);
1767 + var bits = Convert.ToInt32(row[1]);
1768 if (MsiInterop.MsidbCustomActionTypeHideTarget == (bits & MsiInterop.MsidbCustomActionTypeHideTarget) &&
1769 MsiInterop.MsidbCustomActionTypeInScript == (bits & MsiInterop.MsidbCustomActionTypeInScript))
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]));
1772
1773 // If no other fields on the property are set we must have created it during link
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
1789 /// </remarks>
1790 private void FinalizeRemoveFileTable(TableIndexedCollection tables)
1791 {
1931 - Table removeFileTable = tables["RemoveFile"];
1792 + var removeFileTable = tables["RemoveFile"];
1793
1794 if (null != removeFileTable)
1795 {
1935 - foreach (Row row in removeFileTable.Rows)
1796 + foreach (var row in removeFileTable.Rows)
1797 {
1937 - bool isDirectory = false;
1938 - string property = Convert.ToString(row[3]);
1798 + var isDirectory = false;
1799 + var property = Convert.ToString(row[3]);
1800
1801 // determine if the property is actually authored as a directory
1802 if (null != this.core.GetIndexedElement("Directory", property))
@@ -1943,9 +1804,9 @@ namespace WixToolset.Core.WindowsInstaller
1804 isDirectory = true;
1805 }
1806
1946 - Wix.ISchemaElement element = this.core.GetIndexedElement(row);
1807 + var element = this.core.GetIndexedElement(row);
1808
1948 - Wix.RemoveFile removeFile = element as Wix.RemoveFile;
1809 + var removeFile = element as Wix.RemoveFile;
1810 if (null != removeFile)
1811 {
1812 if (isDirectory)
@@ -1959,7 +1820,7 @@ namespace WixToolset.Core.WindowsInstaller
1820 }
1821 else
1822 {
1962 - Wix.RemoveFolder removeFolder = (Wix.RemoveFolder)element;
1823 + var removeFolder = (Wix.RemoveFolder)element;
1824
1825 if (isDirectory)
1826 {
@@ -1984,19 +1845,19 @@ namespace WixToolset.Core.WindowsInstaller
1845 /// </remarks>
1846 private void FinalizeLockPermissionsTable(TableIndexedCollection tables)
1847 {
1987 - Table createFolderTable = tables["CreateFolder"];
1988 - Table lockPermissionsTable = tables["LockPermissions"];
1848 + var createFolderTable = tables["CreateFolder"];
1849 + var lockPermissionsTable = tables["LockPermissions"];
1850
1990 - Hashtable createFolders = new Hashtable();
1851 + var createFolders = new Hashtable();
1852
1853 // index the CreateFolder table because the foreign key to this table from the
1854 // LockPermissions table is only part of the primary key of this table
1855 if (null != createFolderTable)
1856 {
1996 - foreach (Row row in createFolderTable.Rows)
1857 + foreach (var row in createFolderTable.Rows)
1858 {
1998 - Wix.CreateFolder createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row);
1999 - string directoryId = Convert.ToString(row[0]);
1859 + var createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row);
1860 + var directoryId = Convert.ToString(row[0]);
1861
1862 if (!createFolders.Contains(directoryId))
1863 {
@@ -2008,16 +1869,16 @@ namespace WixToolset.Core.WindowsInstaller
1869
1870 if (null != lockPermissionsTable)
1871 {
2011 - foreach (Row row in lockPermissionsTable.Rows)
1872 + foreach (var row in lockPermissionsTable.Rows)
1873 {
2013 - string id = Convert.ToString(row[0]);
2014 - string table = Convert.ToString(row[1]);
1874 + var id = Convert.ToString(row[0]);
1875 + var table = Convert.ToString(row[1]);
1876
2016 - Wix.Permission permission = (Wix.Permission)this.core.GetIndexedElement(row);
1877 + var permission = (Wix.Permission)this.core.GetIndexedElement(row);
1878
1879 if ("CreateFolder" == table)
1880 {
2020 - ArrayList createFolderElements = (ArrayList)createFolders[id];
1881 + var createFolderElements = (ArrayList)createFolders[id];
1882
1883 if (null != createFolderElements)
1884 {
@@ -2028,12 +1889,12 @@ namespace WixToolset.Core.WindowsInstaller
1889 }
1890 else
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));
1893 }
1894 }
1895 else
1896 {
2036 - Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id);
1897 + var parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id);
1898
1899 if (null != parentElement)
1900 {
@@ -2041,7 +1902,7 @@ namespace WixToolset.Core.WindowsInstaller
1902 }
1903 else
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));
1906 }
1907 }
1908 }
@@ -2058,19 +1919,19 @@ namespace WixToolset.Core.WindowsInstaller
1919 /// </remarks>
1920 private void FinalizeMsiLockPermissionsExTable(TableIndexedCollection tables)
1921 {
2061 - Table createFolderTable = tables["CreateFolder"];
2062 - Table msiLockPermissionsExTable = tables["MsiLockPermissionsEx"];
1922 + var createFolderTable = tables["CreateFolder"];
1923 + var msiLockPermissionsExTable = tables["MsiLockPermissionsEx"];
1924
2064 - Hashtable createFolders = new Hashtable();
1925 + var createFolders = new Hashtable();
1926
1927 // index the CreateFolder table because the foreign key to this table from the
1928 // MsiLockPermissionsEx table is only part of the primary key of this table
1929 if (null != createFolderTable)
1930 {
2070 - foreach (Row row in createFolderTable.Rows)
1931 + foreach (var row in createFolderTable.Rows)
1932 {
2072 - Wix.CreateFolder createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row);
2073 - string directoryId = Convert.ToString(row[0]);
1933 + var createFolder = (Wix.CreateFolder)this.core.GetIndexedElement(row);
1934 + var directoryId = Convert.ToString(row[0]);
1935
1936 if (!createFolders.Contains(directoryId))
1937 {
@@ -2082,16 +1943,16 @@ namespace WixToolset.Core.WindowsInstaller
1943
1944 if (null != msiLockPermissionsExTable)
1945 {
2085 - foreach (Row row in msiLockPermissionsExTable.Rows)
1946 + foreach (var row in msiLockPermissionsExTable.Rows)
1947 {
2087 - string id = Convert.ToString(row[1]);
2088 - string table = Convert.ToString(row[2]);
1948 + var id = Convert.ToString(row[1]);
1949 + var table = Convert.ToString(row[2]);
1950
2090 - Wix.PermissionEx permissionEx = (Wix.PermissionEx)this.core.GetIndexedElement(row);
1951 + var permissionEx = (Wix.PermissionEx)this.core.GetIndexedElement(row);
1952
1953 if ("CreateFolder" == table)
1954 {
2094 - ArrayList createFolderElements = (ArrayList)createFolders[id];
1955 + var createFolderElements = (ArrayList)createFolders[id];
1956
1957 if (null != createFolderElements)
1958 {
@@ -2102,12 +1963,12 @@ namespace WixToolset.Core.WindowsInstaller
1963 }
1964 else
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));
1967 }
1968 }
1969 else
1970 {
2110 - Wix.IParentElement parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id);
1971 + var parentElement = (Wix.IParentElement)this.core.GetIndexedElement(table, id);
1972
1973 if (null != parentElement)
1974 {
@@ -2115,7 +1976,7 @@ namespace WixToolset.Core.WindowsInstaller
1976 }
1977 else
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));
1980 }
1981 }
1982 }
@@ -2129,26 +1990,26 @@ namespace WixToolset.Core.WindowsInstaller
1990 /// <remarks>Does all the complex linking required for the search tables.</remarks>
1991 private void FinalizeSearchTables(TableIndexedCollection tables)
1992 {
2132 - Table appSearchTable = tables["AppSearch"];
2133 - Table ccpSearchTable = tables["CCPSearch"];
2134 - Table drLocatorTable = tables["DrLocator"];
1993 + var appSearchTable = tables["AppSearch"];
1994 + var ccpSearchTable = tables["CCPSearch"];
1995 + var drLocatorTable = tables["DrLocator"];
1996
2136 - Hashtable appSearches = new Hashtable();
2137 - Hashtable ccpSearches = new Hashtable();
2138 - Hashtable drLocators = new Hashtable();
2139 - Hashtable locators = new Hashtable();
2140 - Hashtable usedSearchElements = new Hashtable();
2141 - ArrayList unusedSearchElements = new ArrayList();
1997 + var appSearches = new Hashtable();
1998 + var ccpSearches = new Hashtable();
1999 + var drLocators = new Hashtable();
2000 + var locators = new Hashtable();
2001 + var usedSearchElements = new Hashtable();
2002 + var unusedSearchElements = new ArrayList();
2003
2004 Wix.ComplianceCheck complianceCheck = null;
2005
2006 // index the AppSearch table by signatures
2007 if (null != appSearchTable)
2008 {
2148 - foreach (Row row in appSearchTable.Rows)
2009 + foreach (var row in appSearchTable.Rows)
2010 {
2150 - string property = Convert.ToString(row[0]);
2151 - string signature = Convert.ToString(row[1]);
2011 + var property = Convert.ToString(row[0]);
2012 + var signature = Convert.ToString(row[1]);
2013
2014 if (!appSearches.Contains(signature))
2015 {
@@ -2162,9 +2023,9 @@ namespace WixToolset.Core.WindowsInstaller
2023 // index the CCPSearch table by signatures
2024 if (null != ccpSearchTable)
2025 {
2165 - foreach (Row row in ccpSearchTable.Rows)
2026 + foreach (var row in ccpSearchTable.Rows)
2027 {
2167 - string signature = Convert.ToString(row[0]);
2028 + var signature = Convert.ToString(row[0]);
2029
2030 if (!ccpSearches.Contains(signature))
2031 {
@@ -2184,23 +2045,23 @@ namespace WixToolset.Core.WindowsInstaller
2045 // index the directory searches by their search elements (to get back the original row)
2046 if (null != drLocatorTable)
2047 {
2187 - foreach (Row row in drLocatorTable.Rows)
2048 + foreach (var row in drLocatorTable.Rows)
2049 {
2050 drLocators.Add(this.core.GetIndexedElement(row), row);
2051 }
2052 }
2053
2054 // index the locator tables by their signatures
2194 - string[] locatorTableNames = new string[] { "CompLocator", "RegLocator", "IniLocator", "DrLocator", "Signature" };
2195 - foreach (string locatorTableName in locatorTableNames)
2055 + var locatorTableNames = new string[] { "CompLocator", "RegLocator", "IniLocator", "DrLocator", "Signature" };
2056 + foreach (var locatorTableName in locatorTableNames)
2057 {
2197 - Table locatorTable = tables[locatorTableName];
2058 + var locatorTable = tables[locatorTableName];
2059
2060 if (null != locatorTable)
2061 {
2201 - foreach (Row row in locatorTable.Rows)
2062 + foreach (var row in locatorTable.Rows)
2063 {
2203 - string signature = Convert.ToString(row[0]);
2064 + var signature = Convert.ToString(row[0]);
2065
2066 if (!locators.Contains(signature))
2067 {
@@ -2215,11 +2076,11 @@ namespace WixToolset.Core.WindowsInstaller
2076 // move the DrLocator rows with a parent of CCP_DRIVE first to ensure they get FileSearch children (not FileSearchRef)
2077 foreach (ArrayList locatorRows in locators.Values)
2078 {
2218 - int firstDrLocator = -1;
2079 + var firstDrLocator = -1;
2080
2220 - for (int i = 0; i < locatorRows.Count; i++)
2081 + for (var i = 0; i < locatorRows.Count; i++)
2082 {
2222 - Row locatorRow = (Row)locatorRows[i];
2083 + var locatorRow = (Row)locatorRows[i];
2084
2085 if ("DrLocator" == locatorRow.TableDefinition.Name)
2086 {
@@ -2240,13 +2101,13 @@ namespace WixToolset.Core.WindowsInstaller
2101
2102 foreach (string signature in locators.Keys)
2103 {
2243 - ArrayList locatorRows = (ArrayList)locators[signature];
2244 - ArrayList signatureSearchElements = new ArrayList();
2104 + var locatorRows = (ArrayList)locators[signature];
2105 + var signatureSearchElements = new ArrayList();
2106
2107 foreach (Row locatorRow in locatorRows)
2108 {
2248 - bool used = true;
2249 - Wix.ISchemaElement searchElement = this.core.GetIndexedElement(locatorRow);
2109 + var used = true;
2110 + var searchElement = this.core.GetIndexedElement(locatorRow);
2111
2112 if ("Signature" == locatorRow.TableDefinition.Name && 0 < signatureSearchElements.Count)
2113 {
@@ -2259,7 +2120,7 @@ namespace WixToolset.Core.WindowsInstaller
2120 }
2121 else
2122 {
2262 - Wix.FileSearchRef fileSearchRef = new Wix.FileSearchRef();
2123 + var fileSearchRef = new Wix.FileSearchRef();
2124
2125 fileSearchRef.Id = signature;
2126
@@ -2269,17 +2130,17 @@ namespace WixToolset.Core.WindowsInstaller
2130 }
2131 else if ("DrLocator" == locatorRow.TableDefinition.Name && null != locatorRow[1])
2132 {
2272 - string parentSignature = Convert.ToString(locatorRow[1]);
2133 + var parentSignature = Convert.ToString(locatorRow[1]);
2134
2135 if ("CCP_DRIVE" == parentSignature)
2136 {
2137 if (appSearches.Contains(signature))
2138 {
2278 - StringCollection appSearchPropertyIds = (StringCollection)appSearches[signature];
2139 + var appSearchPropertyIds = (StringCollection)appSearches[signature];
2140
2280 - foreach (string propertyId in appSearchPropertyIds)
2141 + foreach (var propertyId in appSearchPropertyIds)
2142 {
2282 - Wix.Property property = this.EnsureProperty(propertyId);
2143 + var property = this.EnsureProperty(propertyId);
2144 Wix.ComplianceDrive complianceDrive = null;
2145
2146 if (ccpSearches.Contains(signature))
@@ -2309,7 +2170,7 @@ namespace WixToolset.Core.WindowsInstaller
2170 }
2171 else
2172 {
2312 - Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef();
2173 + var directorySearchRef = new Wix.DirectorySearchRef();
2174
2175 directorySearchRef.Id = signature;
2176
@@ -2354,7 +2215,7 @@ namespace WixToolset.Core.WindowsInstaller
2215 }
2216 else
2217 {
2357 - Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef();
2218 + var directorySearchRef = new Wix.DirectorySearchRef();
2219
2220 directorySearchRef.Id = signature;
2221
@@ -2375,8 +2236,8 @@ namespace WixToolset.Core.WindowsInstaller
2236 }
2237 else
2238 {
2378 - bool usedDrLocator = false;
2379 - ArrayList parentLocatorRows = (ArrayList)locators[parentSignature];
2239 + var usedDrLocator = false;
2240 + var parentLocatorRows = (ArrayList)locators[parentSignature];
2241
2242 if (null != parentLocatorRows)
2243 {
@@ -2384,12 +2245,12 @@ namespace WixToolset.Core.WindowsInstaller
2245 {
2246 if ("DrLocator" == parentLocatorRow.TableDefinition.Name)
2247 {
2387 - Wix.IParentElement parentSearchElement = (Wix.IParentElement)this.core.GetIndexedElement(parentLocatorRow);
2248 + var parentSearchElement = (Wix.IParentElement)this.core.GetIndexedElement(parentLocatorRow);
2249
2250 if (parentSearchElement.Children.GetEnumerator().MoveNext())
2251 {
2391 - Row parentDrLocatorRow = (Row)drLocators[parentSearchElement];
2392 - Wix.DirectorySearchRef directorySeachRef = new Wix.DirectorySearchRef();
2252 + var parentDrLocatorRow = (Row)drLocators[parentSearchElement];
2253 + var directorySeachRef = new Wix.DirectorySearchRef();
2254
2255 directorySeachRef.Id = parentSignature;
2256
@@ -2415,7 +2276,7 @@ namespace WixToolset.Core.WindowsInstaller
2276 }
2277 else
2278 {
2418 - Wix.DirectorySearchRef directorySearchRef = new Wix.DirectorySearchRef();
2279 + var directorySearchRef = new Wix.DirectorySearchRef();
2280
2281 directorySearchRef.Id = signature;
2282
@@ -2446,11 +2307,11 @@ namespace WixToolset.Core.WindowsInstaller
2307 }
2308 else if (appSearches.Contains(signature))
2309 {
2449 - StringCollection appSearchPropertyIds = (StringCollection)appSearches[signature];
2310 + var appSearchPropertyIds = (StringCollection)appSearches[signature];
2311
2451 - foreach (string propertyId in appSearchPropertyIds)
2312 + foreach (var propertyId in appSearchPropertyIds)
2313 {
2453 - Wix.Property property = this.EnsureProperty(propertyId);
2314 + var property = this.EnsureProperty(propertyId);
2315
2316 if (ccpSearches.Contains(signature))
2317 {
@@ -2464,7 +2325,7 @@ namespace WixToolset.Core.WindowsInstaller
2325 }
2326 else if ("RegLocator" == locatorRow.TableDefinition.Name)
2327 {
2467 - Wix.RegistrySearchRef registrySearchRef = new Wix.RegistrySearchRef();
2328 + var registrySearchRef = new Wix.RegistrySearchRef();
2329
2330 registrySearchRef.Id = signature;
2331
@@ -2486,7 +2347,7 @@ namespace WixToolset.Core.WindowsInstaller
2347 }
2348 else if ("RegLocator" == locatorRow.TableDefinition.Name)
2349 {
2489 - Wix.RegistrySearchRef registrySearchRef = new Wix.RegistrySearchRef();
2350 + var registrySearchRef = new Wix.RegistrySearchRef();
2351
2352 registrySearchRef.Id = signature;
2353
@@ -2521,19 +2382,19 @@ namespace WixToolset.Core.WindowsInstaller
2382
2383 foreach (Wix.IParentElement unusedSearchElement in unusedSearchElements)
2384 {
2524 - bool used = false;
2385 + var used = false;
2386
2387 foreach (Wix.ISchemaElement schemaElement in unusedSearchElement.Children)
2388 {
2528 - Wix.DirectorySearch directorySearch = schemaElement as Wix.DirectorySearch;
2389 + var directorySearch = schemaElement as Wix.DirectorySearch;
2390 if (null != directorySearch)
2391 {
2531 - StringCollection appSearchProperties = (StringCollection)appSearches[directorySearch.Id];
2392 + var appSearchProperties = (StringCollection)appSearches[directorySearch.Id];
2393
2533 - Wix.ISchemaElement unusedSearchSchemaElement = unusedSearchElement as Wix.ISchemaElement;
2394 + var unusedSearchSchemaElement = unusedSearchElement as Wix.ISchemaElement;
2395 if (null != appSearchProperties)
2396 {
2536 - Wix.Property property = this.EnsureProperty(appSearchProperties[0]);
2397 + var property = this.EnsureProperty(appSearchProperties[0]);
2398
2399 property.AddChild(unusedSearchSchemaElement);
2400 used = true;
@@ -2570,30 +2431,30 @@ namespace WixToolset.Core.WindowsInstaller
2431 private void FinalizeSequenceTables(TableIndexedCollection tables)
2432 {
2433 // finalize the normal sequence tables
2573 - if (OutputType.Product == this.outputType && !this.treatProductAsModule)
2434 + if (OutputType.Product == this.OutputType && !this.TreatProductAsModule)
2435 {
2436 foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable)))
2437 {
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()))
2440 {
2441 continue;
2442 }
2443
2583 - Table actionsTable = new Table(null, this.tableDefinitions["WixAction"]);
2584 - Table table = tables[sequenceTable.ToString()];
2444 + var actionsTable = new Table(this.tableDefinitions["WixAction"]);
2445 + var table = tables[sequenceTable.ToString()];
2446
2447 if (null != table)
2448 {
2588 - ArrayList actionRows = new ArrayList();
2589 - bool needAbsoluteScheduling = this.suppressRelativeActionSequencing;
2590 - WixActionRowCollection nonSequencedActionRows = new WixActionRowCollection();
2591 - WixActionRowCollection suppressedRelativeActionRows = new WixActionRowCollection();
2449 + var actionRows = new ArrayList();
2450 + var needAbsoluteScheduling = this.SuppressRelativeActionSequencing;
2451 + var nonSequencedActionRows = new WixActionRowCollection();
2452 + var suppressedRelativeActionRows = new WixActionRowCollection();
2453
2454 // create a sorted array of actions in this table
2594 - foreach (Row row in table.Rows)
2455 + foreach (var row in table.Rows)
2456 {
2596 - WixActionRow actionRow = (WixActionRow)actionsTable.CreateRow(null);
2457 + var actionRow = (WixActionRow)actionsTable.CreateRow(null);
2458
2459 actionRow.Action = Convert.ToString(row[0]);
2460
@@ -2610,10 +2471,10 @@ namespace WixToolset.Core.WindowsInstaller
2471 }
2472 actionRows.Sort();
2473
2613 - for (int i = 0; i < actionRows.Count && !needAbsoluteScheduling; i++)
2474 + for (var i = 0; i < actionRows.Count && !needAbsoluteScheduling; i++)
2475 {
2615 - WixActionRow actionRow = (WixActionRow)actionRows[i];
2616 - WixActionRow standardActionRow = this.standardActions[actionRow.SequenceTable, actionRow.Action];
2476 + var actionRow = (WixActionRow)actionRows[i];
2477 + this.StandardActions.TryGetValue(actionRow.GetPrimaryKey(), out var standardActionRow);
2478
2479 // create actions for custom actions, dialogs, AppSearch when its moved, and standard actions with non-standard conditions
2480 if ("AppSearch" == actionRow.Action || null == standardActionRow || actionRow.Condition != standardActionRow.Condition)
@@ -2646,11 +2507,11 @@ namespace WixToolset.Core.WindowsInstaller
2507 {
2508 needAbsoluteScheduling = true;
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)
2511 {
2512 actionRow.Before = nextActionRow.Action;
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)
2515 {
2516 actionRow.After = previousActionRow.Action;
2517 }
@@ -2707,24 +2568,24 @@ namespace WixToolset.Core.WindowsInstaller
2568 }
2569 }
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
2572 {
2573 foreach (SequenceTable sequenceTable in Enum.GetValues(typeof(SequenceTable)))
2574 {
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()))
2577 {
2578 continue;
2579 }
2580
2720 - Table actionsTable = new Table(null, this.tableDefinitions["WixAction"]);
2721 - Table table = tables[String.Concat("Module", sequenceTable.ToString())];
2581 + var actionsTable = new Table(this.tableDefinitions["WixAction"]);
2582 + var table = tables[String.Concat("Module", sequenceTable.ToString())];
2583
2584 if (null != table)
2585 {
2725 - foreach (Row row in table.Rows)
2586 + foreach (var row in table.Rows)
2587 {
2727 - WixActionRow actionRow = (WixActionRow)actionsTable.CreateRow(null);
2588 + var actionRow = (WixActionRow)actionsTable.CreateRow(null);
2589
2590 actionRow.Action = Convert.ToString(row[0]);
2591
@@ -2737,15 +2598,15 @@ namespace WixToolset.Core.WindowsInstaller
2598 {
2599 switch (Convert.ToInt32(row[3]))
2600 {
2740 - case 0:
2741 - actionRow.Before = Convert.ToString(row[2]);
2742 - break;
2743 - case 1:
2744 - actionRow.After = Convert.ToString(row[2]);
2745 - break;
2746 - default:
2747 - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[3].Column.Name, row[3]));
2748 - break;
2601 + case 0:
2602 + actionRow.Before = Convert.ToString(row[2]);
2603 + break;
2604 + case 1:
2605 + actionRow.After = Convert.ToString(row[2]);
2606 + break;
2607 + default:
2608 + this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[3].Column.Name, row[3]));
2609 + break;
2610 }
2611 }
2612
@@ -2757,7 +2618,7 @@ namespace WixToolset.Core.WindowsInstaller
2618 actionRow.SequenceTable = sequenceTable;
2619
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)
2622 {
2623 this.CreateActionElement(actionRow);
2624 }
@@ -2777,22 +2638,22 @@ namespace WixToolset.Core.WindowsInstaller
2638 /// </remarks>
2639 private void FinalizeUpgradeTable(TableIndexedCollection tables)
2640 {
2780 - Table launchConditionTable = tables["LaunchCondition"];
2781 - Table upgradeTable = tables["Upgrade"];
2641 + var launchConditionTable = tables["LaunchCondition"];
2642 + var upgradeTable = tables["Upgrade"];
2643 string downgradeErrorMessage = null;
2644 string disallowUpgradeErrorMessage = null;
2784 - Wix.MajorUpgrade majorUpgrade = new Wix.MajorUpgrade();
2645 + var majorUpgrade = new Wix.MajorUpgrade();
2646
2647 // find the DowngradePreventedCondition launch condition message
2648 if (null != launchConditionTable && 0 < launchConditionTable.Rows.Count)
2649 {
2789 - foreach (Row launchRow in launchConditionTable.Rows)
2650 + foreach (var launchRow in launchConditionTable.Rows)
2651 {
2791 - if (Compiler.DowngradePreventedCondition == Convert.ToString(launchRow[0]))
2652 + if (Common.DowngradePreventedCondition == Convert.ToString(launchRow[0]))
2653 {
2654 downgradeErrorMessage = Convert.ToString(launchRow[1]);
2655 }
2795 - else if (Compiler.UpgradePreventedCondition == Convert.ToString(launchRow[0]))
2656 + else if (Common.UpgradePreventedCondition == Convert.ToString(launchRow[0]))
2657 {
2658 disallowUpgradeErrorMessage = Convert.ToString(launchRow[1]);
2659 }
@@ -2801,17 +2662,17 @@ namespace WixToolset.Core.WindowsInstaller
2662
2663 if (null != upgradeTable && 0 < upgradeTable.Rows.Count)
2664 {
2804 - bool hasMajorUpgrade = false;
2665 + var hasMajorUpgrade = false;
2666
2806 - foreach (Row row in upgradeTable.Rows)
2667 + foreach (var row in upgradeTable.Rows)
2668 {
2808 - UpgradeRow upgradeRow = (UpgradeRow)row;
2669 + var upgradeRow = (UpgradeRow)row;
2670
2810 - if (Compiler.UpgradeDetectedProperty == upgradeRow.ActionProperty)
2671 + if (Common.UpgradeDetectedProperty == upgradeRow.ActionProperty)
2672 {
2673 hasMajorUpgrade = true;
2813 - int attr = upgradeRow.Attributes;
2814 - string removeFeatures = upgradeRow.Remove;
2674 + var attr = upgradeRow.Attributes;
2675 + var removeFeatures = upgradeRow.Remove;
2676
2677 if (MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive == (attr & MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive))
2678 {
@@ -2833,7 +2694,7 @@ namespace WixToolset.Core.WindowsInstaller
2694 majorUpgrade.RemoveFeatures = removeFeatures;
2695 }
2696 }
2836 - else if (Compiler.DowngradeDetectedProperty == upgradeRow.ActionProperty)
2697 + else if (Common.DowngradeDetectedProperty == upgradeRow.ActionProperty)
2698 {
2699 hasMajorUpgrade = true;
2700 majorUpgrade.DowngradeErrorMessage = downgradeErrorMessage;
@@ -2853,7 +2714,12 @@ namespace WixToolset.Core.WindowsInstaller
2714 majorUpgrade.DisallowUpgradeErrorMessage = disallowUpgradeErrorMessage;
2715 }
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 +
2723 this.core.RootElement.AddChild(majorUpgrade);
2724 }
2725 }
@@ -2870,16 +2736,16 @@ namespace WixToolset.Core.WindowsInstaller
2736 /// </remarks>
2737 private void FinalizeVerbTable(TableIndexedCollection tables)
2738 {
2873 - Table extensionTable = tables["Extension"];
2874 - Table verbTable = tables["Verb"];
2739 + var extensionTable = tables["Extension"];
2740 + var verbTable = tables["Verb"];
2741
2876 - Hashtable extensionElements = new Hashtable();
2742 + var extensionElements = new Hashtable();
2743
2744 if (null != extensionTable)
2745 {
2880 - foreach (Row row in extensionTable.Rows)
2746 + foreach (var row in extensionTable.Rows)
2747 {
2882 - Wix.Extension extension = (Wix.Extension)this.core.GetIndexedElement(row);
2748 + var extension = (Wix.Extension)this.core.GetIndexedElement(row);
2749
2750 if (!extensionElements.Contains(row[0]))
2751 {
@@ -2892,11 +2758,11 @@ namespace WixToolset.Core.WindowsInstaller
2758
2759 if (null != verbTable)
2760 {
2895 - foreach (Row row in verbTable.Rows)
2761 + foreach (var row in verbTable.Rows)
2762 {
2897 - Wix.Verb verb = (Wix.Verb)this.core.GetIndexedElement(row);
2763 + var verb = (Wix.Verb)this.core.GetIndexedElement(row);
2764
2899 - ArrayList extensionsArray = (ArrayList)extensionElements[row[0]];
2765 + var extensionsArray = (ArrayList)extensionElements[row[0]];
2766 if (null != extensionsArray)
2767 {
2768 foreach (Wix.Extension extension in extensionsArray)
@@ -2906,7 +2772,7 @@ namespace WixToolset.Core.WindowsInstaller
2772 }
2773 else
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"));
2776 }
2777 }
2778 }
@@ -2919,11 +2785,11 @@ namespace WixToolset.Core.WindowsInstaller
2785 /// <returns>The path to the file in the source image.</returns>
2786 private string GetSourcePath(Wix.File file)
2787 {
2922 - StringBuilder sourcePath = new StringBuilder();
2788 + var sourcePath = new StringBuilder();
2789
2924 - Wix.Component component = (Wix.Component)file.ParentElement;
2790 + var component = (Wix.Component)file.ParentElement;
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)
2793 {
2794 string name;
2795
@@ -2968,7 +2834,7 @@ namespace WixToolset.Core.WindowsInstaller
2834 {
2835 unsortedTableNames.Remove(tableName);
2836
2971 - foreach (ColumnDefinition columnDefinition in this.tableDefinitions[tableName].Columns)
2837 + foreach (var columnDefinition in this.tableDefinitions[tableName].Columns)
2838 {
2839 // no dependency to resolve because this column doesn't reference another table
2840 if (null == columnDefinition.KeyTable)
@@ -2976,7 +2842,7 @@ namespace WixToolset.Core.WindowsInstaller
2842 continue;
2843 }
2844
2979 - foreach (string keyTable in columnDefinition.KeyTable.Split(';'))
2845 + foreach (var keyTable in columnDefinition.KeyTable.Split(';'))
2846 {
2847 if (tableName == keyTable)
2848 {
@@ -2988,7 +2854,7 @@ namespace WixToolset.Core.WindowsInstaller
2854 }
2855 else if (!this.tableDefinitions.Contains(keyTable))
2856 {
2991 - this.core.OnMessage(WixErrors.MissingTableDefinition(keyTable));
2857 + this.Messaging.Write(ErrorMessages.MissingTableDefinition(keyTable));
2858 }
2859 else if (unsortedTableNames.Contains(keyTable))
2860 {
@@ -3012,11 +2878,11 @@ namespace WixToolset.Core.WindowsInstaller
2878 /// <returns>A StringCollection containing the ordered table names.</returns>
2879 private StringCollection GetSortedTableNames()
2880 {
3015 - StringCollection sortedTableNames = new StringCollection();
3016 - SortedList unsortedTableNames = new SortedList();
2881 + var sortedTableNames = new StringCollection();
2882 + var unsortedTableNames = new SortedList();
2883
2884 // index the table names
3019 - foreach (TableDefinition tableDefinition in this.tableDefinitions)
2885 + foreach (var tableDefinition in this.tableDefinitions)
2886 {
2887 unsortedTableNames.Add(tableDefinition.Name, tableDefinition.Name);
2888 }
@@ -3034,7 +2900,7 @@ namespace WixToolset.Core.WindowsInstaller
2900 /// Initialize decompilation.
2901 /// </summary>
2902 /// <param name="tables">The collection of all tables.</param>
3037 - private void InitializeDecompile(TableIndexedCollection tables)
2903 + private void InitializeDecompile(TableIndexedCollection tables, int codepage)
2904 {
2905 // reset all the state information
2906 this.compressed = false;
@@ -3043,31 +2909,32 @@ namespace WixToolset.Core.WindowsInstaller
2909 this.shortNames = false;
2910
2911 // set the codepage if its not neutral (0)
3046 - if (0 != this.codepage)
2912 + if (0 != codepage)
2913 {
3048 - switch (this.outputType)
2914 + switch (this.OutputType)
2915 {
3050 - case OutputType.Module:
3051 - ((Wix.Module)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture);
3052 - break;
3053 - case OutputType.PatchCreation:
3054 - ((Wix.PatchCreation)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture);
3055 - break;
3056 - case OutputType.Product:
3057 - ((Wix.Product)this.core.RootElement).Codepage = this.codepage.ToString(CultureInfo.InvariantCulture);
3058 - break;
2916 + case OutputType.Module:
2917 + ((Wix.Module)this.core.RootElement).Codepage = codepage.ToString(CultureInfo.InvariantCulture);
2918 + break;
2919 + case OutputType.PatchCreation:
2920 + ((Wix.PatchCreation)this.core.RootElement).Codepage = codepage.ToString(CultureInfo.InvariantCulture);
2921 + break;
2922 + case OutputType.Product:
2923 + ((Wix.Product)this.core.RootElement).Codepage = codepage.ToString(CultureInfo.InvariantCulture);
2924 + break;
2925 }
2926 }
2927
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
2931 foreach (IDecompilerExtension extension in this.extensions)
2932 {
2933 // Get the optional library from the extension with the rows to be removed.
2934 Library library = extension.GetLibraryToRemove(this.tableDefinitions);
2935 if (null != library)
2936 {
3070 - foreach (Section section in library.Sections)
2937 + foreach (var section in library.Sections)
2938 {
2939 foreach (Table table in section.Tables)
2940 {
@@ -3112,22 +2979,23 @@ namespace WixToolset.Core.WindowsInstaller
2979 }
2980 }
2981 }
2982 +#endif
2983
2984 // remove the rows from the extension libraries (to allow full round-tripping)
2985 foreach (var kvp in indexedExtensionTables)
2986 {
3119 - string tableName = kvp.Key;
3120 - HashSet<string> indexedExtensionRows = kvp.Value;
2987 + var tableName = kvp.Key;
2988 + var indexedExtensionRows = kvp.Value;
2989
3122 - Table table = tables[tableName];
2990 + var table = tables[tableName];
2991 if (null != table)
2992 {
3125 - RowDictionary<Row> originalRows = new RowDictionary<Row>(table);
2993 + var originalRows = new RowDictionary<Row>(table);
2994
2995 // remove the original rows so that they can be added back if they should remain
2996 table.Rows.Clear();
2997
3130 - foreach (Row row in originalRows.Values)
2998 + foreach (var row in originalRows.Values)
2999 {
3000 if (!indexedExtensionRows.Contains(row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)))
3001 {
@@ -3144,11 +3012,11 @@ namespace WixToolset.Core.WindowsInstaller
3012 /// <param name="output">The output being decompiled.</param>
3013 private void DecompileTables(Output output)
3014 {
3147 - StringCollection sortedTableNames = this.GetSortedTableNames();
3015 + var sortedTableNames = this.GetSortedTableNames();
3016
3149 - foreach (string tableName in sortedTableNames)
3017 + foreach (var tableName in sortedTableNames)
3018 {
3151 - Table table = output.Tables[tableName];
3019 + var table = output.Tables[tableName];
3020
3021 // table does not exist in this database or should not be decompiled
3022 if (null == table || !this.DecompilableTable(output, tableName))
@@ -3156,438 +3024,440 @@ namespace WixToolset.Core.WindowsInstaller
3024 continue;
3025 }
3026
3159 - this.core.OnMessage(WixVerboses.DecompilingTable(table.Name));
3027 + this.Messaging.Write(VerboseMessages.DecompilingTable(table.Name));
3028
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)
3031 {
3164 - Wix.EnsureTable ensureTable = new Wix.EnsureTable();
3032 + var ensureTable = new Wix.EnsureTable();
3033 ensureTable.Id = table.Name;
3034 this.core.RootElement.AddChild(ensureTable);
3035 }
3036
3037 switch (table.Name)
3038 {
3171 - case "_SummaryInformation":
3172 - this.Decompile_SummaryInformationTable(table);
3173 - break;
3174 - case "AdminExecuteSequence":
3175 - case "AdminUISequence":
3176 - case "AdvtExecuteSequence":
3177 - case "InstallExecuteSequence":
3178 - case "InstallUISequence":
3179 - case "ModuleAdminExecuteSequence":
3180 - case "ModuleAdminUISequence":
3181 - case "ModuleAdvtExecuteSequence":
3182 - case "ModuleInstallExecuteSequence":
3183 - case "ModuleInstallUISequence":
3184 - // handled in FinalizeSequenceTables
3185 - 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 - {
3039 + case "_SummaryInformation":
3040 + this.Decompile_SummaryInformationTable(table);
3041 + break;
3042 + case "AdminExecuteSequence":
3043 + case "AdminUISequence":
3044 + case "AdvtExecuteSequence":
3045 + case "InstallExecuteSequence":
3046 + case "InstallUISequence":
3047 + case "ModuleAdminExecuteSequence":
3048 + case "ModuleAdminUISequence":
3049 + case "ModuleAdvtExecuteSequence":
3050 + case "ModuleInstallExecuteSequence":
3051 + case "ModuleInstallUISequence":
3052 + // handled in FinalizeSequenceTables
3053 + break;
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;
3066 case "BBControl":
3067 + this.DecompileBBControlTable(table);
3068 + break;
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;
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;
3090 case "Control":
3091 + this.DecompileControlTable(table);
3092 + break;
3093 case "ControlCondition":
3094 + this.DecompileControlConditionTable(table);
3095 + break;
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;
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;
3132 case "Error":
3133 + this.DecompileErrorTable(table);
3134 + break;
3135 case "EventMapping":
3520 - case "RadioButton":
3521 - case "TextStyle":
3522 - case "UIText":
3523 - return !this.suppressUI;
3524 - case "ModuleAdminExecuteSequence":
3525 - case "ModuleAdminUISequence":
3526 - case "ModuleAdvtExecuteSequence":
3136 + this.DecompileEventMappingTable(table);
3137 + break;
3138 + case "Extension":
3139 + this.DecompileExtensionTable(table);
3140 + break;
3141 + case "ExternalFiles":
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;
3195 case "ModuleAdvtUISequence":
3196 + this.Messaging.Write(WarningMessages.DeprecatedTable(table.Name));
3197 + break;
3198 case "ModuleComponents":
3199 + // handled by DecompileComponentTable (since the ModuleComponents table
3200 + // rows are created by nesting components under the Module element)
3201 + break;
3202 case "ModuleConfiguration":
3203 + this.DecompileModuleConfigurationTable(table);
3204 + break;
3205 case "ModuleDependency":
3531 - case "ModuleIgnoreTable":
3532 - case "ModuleInstallExecuteSequence":
3533 - case "ModuleInstallUISequence":
3206 + this.DecompileModuleDependencyTable(table);
3207 + break;
3208 case "ModuleExclusion":
3209 + this.DecompileModuleExclusionTable(table);
3210 + break;
3211 + case "ModuleIgnoreTable":
3212 + this.DecompileModuleIgnoreTableTable(table);
3213 + break;
3214 case "ModuleSignature":
3215 + this.DecompileModuleSignatureTable(table);
3216 + break;
3217 case "ModuleSubstitution":
3537 - if (OutputType.Module != output.Type)
3538 - {
3539 - this.core.OnMessage(WixWarnings.SkippingMergeModuleTable(output.SourceLineNumbers, tableName));
3540 - return false;
3541 - }
3542 - else
3543 - {
3544 - return true;
3545 - }
3546 - case "ExternalFiles":
3547 - case "FamilyFileRanges":
3548 - case "ImageFamilies":
3218 + this.DecompileModuleSubstitutionTable(table);
3219 + break;
3220 + case "MoveFile":
3221 + this.DecompileMoveFileTable(table);
3222 + break;
3223 + case "MsiAssembly":
3224 + // handled in FinalizeFileTable
3225 + break;
3226 + case "MsiDigitalCertificate":
3227 + this.DecompileMsiDigitalCertificateTable(table);
3228 + break;
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;
3265 case "PatchMetadata":
3266 + this.DecompilePatchMetadataTable(table);
3267 + break;
3268 case "PatchSequence":
3269 + this.DecompilePatchSequenceTable(table);
3270 + break;
3271 + case "ProgId":
3272 + this.DecompileProgIdTable(table);
3273 + break;
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;
3322 case "TargetFiles_OptionalData":
3323 + this.DecompileTargetFiles_OptionalDataTable(table);
3324 + break;
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;
3337 case "UpgradedFiles_OptionalData":
3338 + this.DecompileUpgradedFiles_OptionalDataTable(table);
3339 + break;
3340 case "UpgradedFilesToIgnore":
3341 + this.DecompileUpgradedFilesToIgnoreTable(table);
3342 + break;
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)
3356 {
3559 - this.core.OnMessage(WixWarnings.SkippingPatchCreationTable(output.SourceLineNumbers, tableName));
3560 - return false;
3357 + extension.DecompileTable(table);
3358 }
3359 else
3360 +#endif
3361 + if (!this.SuppressCustomTables)
3362 {
3564 - return true;
3363 + this.DecompileCustomTable(table);
3364 }
3566 - case "MsiPatchHeaders":
3567 - case "MsiPatchMetadata":
3568 - case "MsiPatchOldAssemblyName":
3569 - case "MsiPatchOldAssemblyFile":
3570 - case "MsiPatchSequence":
3571 - case "Patch":
3572 - case "PatchPackage":
3573 - this.core.OnMessage(WixWarnings.PatchTable(output.SourceLineNumbers, tableName));
3365 + break;
3366 + }
3367 + }
3368 + }
3369 +
3370 + /// <summary>
3371 + /// Determine if a particular table should be decompiled with the current settings.
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));
3410 return false;
3575 - case "_SummaryInformation":
3411 + }
3412 + else
3413 + {
3414 return true;
3577 - case "_Validation":
3578 - case "MsiAssemblyName":
3579 - case "MsiFileHash":
3415 + }
3416 + case "ExternalFiles":
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));
3430 return false;
3581 - default: // all other tables are allowed in any output except for a patch creation package
3582 - if (OutputType.PatchCreation == output.Type)
3583 - {
3584 - this.core.OnMessage(WixWarnings.IllegalPatchCreationTable(output.SourceLineNumbers, tableName));
3585 - return false;
3586 - }
3587 - else
3588 - {
3589 - return true;
3590 - }
3431 + }
3432 + else
3433 + {
3434 + return true;
3435 + }
3436 + case "MsiPatchHeaders":
3437 + case "MsiPatchMetadata":
3438 + case "MsiPatchOldAssemblyName":
3439 + case "MsiPatchOldAssemblyFile":
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 + }
3461 }
3462 }
3463
@@ -3597,113 +3467,116 @@ namespace WixToolset.Core.WindowsInstaller
3467 /// <param name="table">The table to decompile.</param>
3468 private void Decompile_SummaryInformationTable(Table table)
3469 {
3600 - if (OutputType.Module == this.outputType || OutputType.Product == this.outputType)
3470 + if (OutputType.Module == this.OutputType || OutputType.Product == this.OutputType)
3471 {
3602 - Wix.Package package = new Wix.Package();
3472 + var package = new Wix.Package();
3473
3604 - foreach (Row row in table.Rows)
3474 + foreach (var row in table.Rows)
3475 {
3606 - string value = Convert.ToString(row[1]);
3476 + var value = Convert.ToString(row[1]);
3477
3478 if (null != value && 0 < value.Length)
3479 {
3480 switch (Convert.ToInt32(row[0]))
3481 {
3612 - case 1:
3613 - if ("1252" != value)
3614 - {
3615 - package.SummaryCodepage = value;
3616 - }
3617 - break;
3618 - case 3:
3619 - package.Description = value;
3620 - break;
3621 - case 4:
3622 - package.Manufacturer = value;
3623 - break;
3624 - case 5:
3625 - if ("Installer" != value)
3626 - {
3627 - package.Keywords = value;
3628 - }
3629 - break;
3630 - case 6:
3482 + case 1:
3483 + if ("1252" != value)
3484 + {
3485 + package.SummaryCodepage = value;
3486 + }
3487 + break;
3488 + case 3:
3489 + package.Description = value;
3490 + break;
3491 + case 4:
3492 + package.Manufacturer = value;
3493 + break;
3494 + case 5:
3495 + if ("Installer" != value)
3496 + {
3497 + package.Keywords = value;
3498 + }
3499 + break;
3500 + case 6:
3501 + if (!value.StartsWith("This installer database contains the logic and data required to install "))
3502 + {
3503 package.Comments = value;
3632 - break;
3633 - case 7:
3634 - string[] template = value.Split(';');
3635 - if (0 < template.Length && 0 < template[template.Length - 1].Length)
3636 - {
3637 - package.Languages = template[template.Length - 1];
3638 - }
3504 + }
3505 + break;
3506 + case 7:
3507 + var template = value.Split(';');
3508 + if (0 < template.Length && 0 < template[template.Length - 1].Length)
3509 + {
3510 + package.Languages = template[template.Length - 1];
3511 + }
3512
3640 - if (1 < template.Length && null != template[0] && 0 < template[0].Length)
3641 - {
3642 - 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))
3513 + if (1 < template.Length && null != template[0] && 0 < template[0].Length)
3514 + {
3515 + switch (template[0])
3516 {
3670 - this.shortNames = true;
3671 - package.ShortNames = Wix.YesNoType.yes;
3517 + case "Intel":
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;
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 + }
3546
3674 - if (0x2 == (wordCount & 0x2))
3675 - {
3676 - this.compressed = true;
3677 -
3678 - if (OutputType.Product == this.outputType)
3679 - {
3680 - package.Compressed = Wix.YesNoType.yes;
3681 - }
3682 - }
3547 + if (0x2 == (wordCount & 0x2))
3548 + {
3549 + this.compressed = true;
3550
3684 - if (0x4 == (wordCount & 0x4))
3551 + if (OutputType.Product == this.OutputType)
3552 {
3686 - package.AdminImage = Wix.YesNoType.yes;
3553 + package.Compressed = Wix.YesNoType.yes;
3554 }
3555 + }
3556
3689 - if (0x8 == (wordCount & 0x8))
3690 - {
3691 - package.InstallPrivileges = Wix.Package.InstallPrivilegesType.limited;
3692 - }
3557 + if (0x4 == (wordCount & 0x4))
3558 + {
3559 + package.AdminImage = Wix.YesNoType.yes;
3560 + }
3561
3562 + if (0x8 == (wordCount & 0x8))
3563 + {
3564 + package.InstallPrivileges = Wix.Package.InstallPrivilegesType.limited;
3565 + }
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;
3574 break;
3695 - case 19:
3696 - int security = Convert.ToInt32(row[1], CultureInfo.InvariantCulture);
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 - }
3575 + case 4:
3576 + package.ReadOnly = Wix.YesNoDefaultType.yes;
3577 break;
3578 + }
3579 + break;
3580 }
3581 }
3582 }
@@ -3712,79 +3585,79 @@ namespace WixToolset.Core.WindowsInstaller
3585 }
3586 else
3587 {
3715 - Wix.PatchInformation patchInformation = new Wix.PatchInformation();
3588 + var patchInformation = new Wix.PatchInformation();
3589
3717 - foreach (Row row in table.Rows)
3590 + foreach (var row in table.Rows)
3591 {
3719 - int propertyId = Convert.ToInt32(row[0]);
3720 - string value = Convert.ToString(row[1]);
3592 + var propertyId = Convert.ToInt32(row[0]);
3593 + var value = Convert.ToString(row[1]);
3594
3595 if (null != row[1] && 0 < value.Length)
3596 {
3597 switch (propertyId)
3598 {
3726 - case 1:
3727 - if ("1252" != value)
3728 - {
3729 - patchInformation.SummaryCodepage = value;
3730 - }
3731 - break;
3732 - case 3:
3733 - patchInformation.Description = value;
3734 - break;
3735 - case 4:
3736 - patchInformation.Manufacturer = value;
3737 - break;
3738 - case 5:
3739 - if ("Installer,Patching,PCP,Database" != value)
3740 - {
3741 - patchInformation.Keywords = value;
3742 - }
3743 - break;
3744 - case 6:
3745 - patchInformation.Comments = value;
3746 - break;
3747 - case 7:
3748 - string[] template = value.Split(';');
3749 - if (0 < template.Length && 0 < template[template.Length - 1].Length)
3750 - {
3751 - patchInformation.Languages = template[template.Length - 1];
3752 - }
3599 + case 1:
3600 + if ("1252" != value)
3601 + {
3602 + patchInformation.SummaryCodepage = value;
3603 + }
3604 + break;
3605 + case 3:
3606 + patchInformation.Description = value;
3607 + break;
3608 + case 4:
3609 + patchInformation.Manufacturer = value;
3610 + break;
3611 + case 5:
3612 + if ("Installer,Patching,PCP,Database" != value)
3613 + {
3614 + patchInformation.Keywords = value;
3615 + }
3616 + break;
3617 + case 6:
3618 + patchInformation.Comments = value;
3619 + break;
3620 + case 7:
3621 + var template = value.Split(';');
3622 + if (0 < template.Length && 0 < template[template.Length - 1].Length)
3623 + {
3624 + patchInformation.Languages = template[template.Length - 1];
3625 + }
3626
3754 - if (1 < template.Length && null != template[0] && 0 < template[0].Length)
3755 - {
3756 - patchInformation.Platforms = template[0];
3757 - }
3758 - break;
3759 - case 15:
3760 - int wordCount = Convert.ToInt32(value, CultureInfo.InvariantCulture);
3761 - if (0x1 == (wordCount & 0x1))
3762 - {
3763 - patchInformation.ShortNames = Wix.YesNoType.yes;
3764 - }
3627 + if (1 < template.Length && null != template[0] && 0 < template[0].Length)
3628 + {
3629 + patchInformation.Platforms = template[0];
3630 + }
3631 + break;
3632 + case 15:
3633 + var wordCount = Convert.ToInt32(value, CultureInfo.InvariantCulture);
3634 + if (0x1 == (wordCount & 0x1))
3635 + {
3636 + patchInformation.ShortNames = Wix.YesNoType.yes;
3637 + }
3638
3766 - if (0x2 == (wordCount & 0x2))
3767 - {
3768 - patchInformation.Compressed = Wix.YesNoType.yes;
3769 - }
3639 + if (0x2 == (wordCount & 0x2))
3640 + {
3641 + patchInformation.Compressed = Wix.YesNoType.yes;
3642 + }
3643
3771 - if (0x4 == (wordCount & 0x4))
3772 - {
3773 - patchInformation.AdminImage = Wix.YesNoType.yes;
3774 - }
3644 + if (0x4 == (wordCount & 0x4))
3645 + {
3646 + patchInformation.AdminImage = Wix.YesNoType.yes;
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;
3655 break;
3776 - case 19:
3777 - int security = Convert.ToInt32(value, CultureInfo.InvariantCulture);
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 - }
3656 + case 4:
3657 + patchInformation.ReadOnly = Wix.YesNoDefaultType.yes;
3658 break;
3659 + }
3660 + break;
3661 }
3662 }
3663 }
@@ -3799,9 +3672,9 @@ namespace WixToolset.Core.WindowsInstaller
3672 /// <param name="table">The table to decompile.</param>
3673 private void DecompileActionTextTable(Table table)
3674 {
3802 - foreach (Row row in table.Rows)
3675 + foreach (var row in table.Rows)
3676 {
3804 - Wix.ProgressText progressText = new Wix.ProgressText();
3677 + var progressText = new Wix.ProgressText();
3678
3679 progressText.Action = Convert.ToString(row[0]);
3680
@@ -3825,9 +3698,9 @@ namespace WixToolset.Core.WindowsInstaller
3698 /// <param name="table">The table to decompile.</param>
3699 private void DecompileAppIdTable(Table table)
3700 {
3828 - foreach (Row row in table.Rows)
3701 + foreach (var row in table.Rows)
3702 {
3830 - Wix.AppId appId = new Wix.AppId();
3703 + var appId = new Wix.AppId();
3704
3705 appId.Advertise = Wix.YesNoType.yes;
3706
@@ -3876,7 +3749,7 @@ namespace WixToolset.Core.WindowsInstaller
3749 {
3750 foreach (BBControlRow bbControlRow in table.Rows)
3751 {
3879 - Wix.Control control = new Wix.Control();
3752 + var control = new Wix.Control();
3753
3754 control.Id = bbControlRow.BBControl;
3755
@@ -3900,14 +3773,14 @@ namespace WixToolset.Core.WindowsInstaller
3773 control.Text = bbControlRow.Text;
3774 }
3775
3903 - Wix.Billboard billboard = (Wix.Billboard)this.core.GetIndexedElement("Billboard", bbControlRow.Billboard);
3776 + var billboard = (Wix.Billboard)this.core.GetIndexedElement("Billboard", bbControlRow.Billboard);
3777 if (null != billboard)
3778 {
3779 billboard.AddChild(control);
3780 }
3781 else
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"));
3784 }
3785 }
3786 }
@@ -3918,12 +3791,12 @@ namespace WixToolset.Core.WindowsInstaller
3791 /// <param name="table">The table to decompile.</param>
3792 private void DecompileBillboardTable(Table table)
3793 {
3921 - Hashtable billboardActions = new Hashtable();
3922 - SortedList billboards = new SortedList();
3794 + var billboardActions = new Hashtable();
3795 + var billboards = new SortedList();
3796
3924 - foreach (Row row in table.Rows)
3797 + foreach (var row in table.Rows)
3798 {
3926 - Wix.Billboard billboard = new Wix.Billboard();
3799 + var billboard = new Wix.Billboard();
3800
3801 billboard.Id = Convert.ToString(row[0]);
3802
@@ -3935,8 +3808,8 @@ namespace WixToolset.Core.WindowsInstaller
3808
3809 foreach (Row row in billboards.Values)
3810 {
3938 - Wix.Billboard billboard = (Wix.Billboard)this.core.GetIndexedElement(row);
3939 - Wix.BillboardAction billboardAction = (Wix.BillboardAction)billboardActions[row[2]];
3811 + var billboard = (Wix.Billboard)this.core.GetIndexedElement(row);
3812 + var billboardAction = (Wix.BillboardAction)billboardActions[row[2]];
3813
3814 if (null == billboardAction)
3815 {
@@ -3958,9 +3831,9 @@ namespace WixToolset.Core.WindowsInstaller
3831 /// <param name="table">The table to decompile.</param>
3832 private void DecompileBinaryTable(Table table)
3833 {
3961 - foreach (Row row in table.Rows)
3834 + foreach (var row in table.Rows)
3835 {
3963 - Wix.Binary binary = new Wix.Binary();
3836 + var binary = new Wix.Binary();
3837
3838 binary.Id = Convert.ToString(row[0]);
3839
@@ -3976,9 +3849,9 @@ namespace WixToolset.Core.WindowsInstaller
3849 /// <param name="table">The table to decompile.</param>
3850 private void DecompileBindImageTable(Table table)
3851 {
3979 - foreach (Row row in table.Rows)
3852 + foreach (var row in table.Rows)
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]));
3855
3856 if (null != file)
3857 {
@@ -3986,7 +3859,7 @@ namespace WixToolset.Core.WindowsInstaller
3859 }
3860 else
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"));
3863 }
3864 }
3865 }
@@ -3997,9 +3870,9 @@ namespace WixToolset.Core.WindowsInstaller
3870 /// <param name="table">The table to decompile.</param>
3871 private void DecompileClassTable(Table table)
3872 {
4000 - foreach (Row row in table.Rows)
3873 + foreach (var row in table.Rows)
3874 {
4002 - Wix.Class wixClass = new Wix.Class();
3875 + var wixClass = new Wix.Class();
3876
3877 wixClass.Advertise = Wix.YesNoType.yes;
3878
@@ -4007,21 +3880,21 @@ namespace WixToolset.Core.WindowsInstaller
3880
3881 switch (Convert.ToString(row[1]))
3882 {
4010 - case "LocalServer":
4011 - wixClass.Context = Wix.Class.ContextType.LocalServer;
4012 - break;
4013 - case "LocalServer32":
4014 - wixClass.Context = Wix.Class.ContextType.LocalServer32;
4015 - break;
4016 - case "InprocServer":
4017 - wixClass.Context = Wix.Class.ContextType.InprocServer;
4018 - break;
4019 - case "InprocServer32":
4020 - wixClass.Context = Wix.Class.ContextType.InprocServer32;
4021 - break;
4022 - default:
4023 - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
4024 - break;
3883 + case "LocalServer":
3884 + wixClass.Context = Wix.Class.ContextType.LocalServer;
3885 + break;
3886 + case "LocalServer32":
3887 + wixClass.Context = Wix.Class.ContextType.LocalServer32;
3888 + break;
3889 + case "InprocServer":
3890 + wixClass.Context = Wix.Class.ContextType.InprocServer;
3891 + break;
3892 + case "InprocServer32":
3893 + wixClass.Context = Wix.Class.ContextType.InprocServer32;
3894 + break;
3895 + default:
3896 + this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[1].Column.Name, row[1]));
3897 + break;
3898 }
3899
3900 // ProgId children are handled in FinalizeProgIdTable
@@ -4038,17 +3911,17 @@ namespace WixToolset.Core.WindowsInstaller
3911
3912 if (null != row[6])
3913 {
4041 - string[] fileTypeMaskStrings = (Convert.ToString(row[6])).Split(';');
3914 + var fileTypeMaskStrings = (Convert.ToString(row[6])).Split(';');
3915
3916 try
3917 {
4045 - foreach (string fileTypeMaskString in fileTypeMaskStrings)
3918 + foreach (var fileTypeMaskString in fileTypeMaskStrings)
3919 {
4047 - string[] fileTypeMaskParts = fileTypeMaskString.Split(',');
3920 + var fileTypeMaskParts = fileTypeMaskString.Split(',');
3921
3922 if (4 == fileTypeMaskParts.Length)
3923 {
4051 - Wix.FileTypeMask fileTypeMask = new Wix.FileTypeMask();
3924 + var fileTypeMask = new Wix.FileTypeMask();
3925
3926 fileTypeMask.Offset = Convert.ToInt32(fileTypeMaskParts[0], CultureInfo.InvariantCulture);
3927
@@ -4066,11 +3939,11 @@ namespace WixToolset.Core.WindowsInstaller
3939 }
3940 catch (FormatException)
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]));
3943 }
3944 catch (OverflowException)
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]));
3947 }
3948 }
3949
@@ -4102,18 +3975,18 @@ namespace WixToolset.Core.WindowsInstaller
3975 }
3976 else
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]));
3979 }
3980 }
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]));
3983 if (null != component)
3984 {
3985 component.AddChild(wixClass);
3986 }
3987 else
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"));
3990 }
3991
3992 this.core.IndexElement(row, wixClass);
@@ -4127,10 +4000,10 @@ namespace WixToolset.Core.WindowsInstaller
4000 private void DecompileComboBoxTable(Table table)
4001 {
4002 Wix.ComboBox comboBox = null;
4130 - SortedList comboBoxRows = new SortedList();
4003 + var comboBoxRows = new SortedList();
4004
4005 // sort the combo boxes by their property and order
4133 - foreach (Row row in table.Rows)
4006 + foreach (var row in table.Rows)
4007 {
4008 comboBoxRows.Add(String.Concat("{0}|{1:0000000000}", row[0], row[1]), row);
4009 }
@@ -4146,7 +4019,7 @@ namespace WixToolset.Core.WindowsInstaller
4019 this.core.UIElement.AddChild(comboBox);
4020 }
4021
4149 - Wix.ListItem listItem = new Wix.ListItem();
4022 + var listItem = new Wix.ListItem();
4023
4024 listItem.Value = Convert.ToString(row[2]);
4025
@@ -4167,7 +4040,7 @@ namespace WixToolset.Core.WindowsInstaller
4040 {
4041 foreach (ControlRow controlRow in table.Rows)
4042 {
4170 - Wix.Control control = new Wix.Control();
4043 + var control = new Wix.Control();
4044
4045 control.Id = controlRow.Control;
4046
@@ -4190,64 +4063,64 @@ namespace WixToolset.Core.WindowsInstaller
4063
4064 switch (control.Type)
4065 {
4193 - case "Bitmap":
4194 - specialAttributes = MsiInterop.BitmapControlAttributes;
4195 - break;
4196 - case "CheckBox":
4197 - specialAttributes = MsiInterop.CheckboxControlAttributes;
4198 - break;
4199 - case "ComboBox":
4200 - specialAttributes = MsiInterop.ComboboxControlAttributes;
4201 - break;
4202 - case "DirectoryCombo":
4203 - specialAttributes = MsiInterop.VolumeControlAttributes;
4204 - break;
4205 - case "Edit":
4206 - specialAttributes = MsiInterop.EditControlAttributes;
4207 - break;
4208 - case "Icon":
4209 - specialAttributes = MsiInterop.IconControlAttributes;
4210 - break;
4211 - case "ListBox":
4212 - specialAttributes = MsiInterop.ListboxControlAttributes;
4213 - break;
4214 - case "ListView":
4215 - specialAttributes = MsiInterop.ListviewControlAttributes;
4216 - break;
4217 - case "MaskedEdit":
4218 - specialAttributes = MsiInterop.EditControlAttributes;
4219 - break;
4220 - case "PathEdit":
4221 - specialAttributes = MsiInterop.EditControlAttributes;
4222 - break;
4223 - case "ProgressBar":
4224 - specialAttributes = MsiInterop.ProgressControlAttributes;
4225 - break;
4226 - case "PushButton":
4227 - specialAttributes = MsiInterop.ButtonControlAttributes;
4228 - break;
4229 - case "RadioButtonGroup":
4230 - specialAttributes = MsiInterop.RadioControlAttributes;
4231 - break;
4232 - case "Text":
4233 - specialAttributes = MsiInterop.TextControlAttributes;
4234 - break;
4235 - case "VolumeCostList":
4236 - specialAttributes = MsiInterop.VolumeControlAttributes;
4237 - break;
4238 - case "VolumeSelectCombo":
4239 - specialAttributes = MsiInterop.VolumeControlAttributes;
4240 - break;
4241 - default:
4242 - specialAttributes = null;
4243 - break;
4066 + case "Bitmap":
4067 + specialAttributes = MsiInterop.BitmapControlAttributes;
4068 + break;
4069 + case "CheckBox":
4070 + specialAttributes = MsiInterop.CheckboxControlAttributes;
4071 + break;
4072 + case "ComboBox":
4073 + specialAttributes = MsiInterop.ComboboxControlAttributes;
4074 + break;
4075 + case "DirectoryCombo":
4076 + specialAttributes = MsiInterop.VolumeControlAttributes;
4077 + break;
4078 + case "Edit":
4079 + specialAttributes = MsiInterop.EditControlAttributes;
4080 + break;
4081 + case "Icon":
4082 + specialAttributes = MsiInterop.IconControlAttributes;
4083 + break;
4084 + case "ListBox":
4085 + specialAttributes = MsiInterop.ListboxControlAttributes;
4086 + break;
4087 + case "ListView":
4088 + specialAttributes = MsiInterop.ListviewControlAttributes;
4089 + break;
4090 + case "MaskedEdit":
4091 + specialAttributes = MsiInterop.EditControlAttributes;
4092 + break;
4093 + case "PathEdit":
4094 + specialAttributes = MsiInterop.EditControlAttributes;
4095 + break;
4096 + case "ProgressBar":
4097 + specialAttributes = MsiInterop.ProgressControlAttributes;
4098 + break;
4099 + case "PushButton":
4100 + specialAttributes = MsiInterop.ButtonControlAttributes;
4101 + break;
4102 + case "RadioButtonGroup":
4103 + specialAttributes = MsiInterop.RadioControlAttributes;
4104 + break;
4105 + case "Text":
4106 + specialAttributes = MsiInterop.TextControlAttributes;
4107 + break;
4108 + case "VolumeCostList":
4109 + specialAttributes = MsiInterop.VolumeControlAttributes;
4110 + break;
4111 + case "VolumeSelectCombo":
4112 + specialAttributes = MsiInterop.VolumeControlAttributes;
4113 + break;
4114 + default:
4115 + specialAttributes = null;
4116 + break;
4117 }
4118
4119 if (null != specialAttributes)
4120 {
4248 - bool iconSizeSet = false;
4121 + var iconSizeSet = false;
4122
4250 - for (int i = 16; 32 > i; i++)
4123 + for (var i = 16; 32 > i; i++)
4124 {
4125 if (1 == ((controlRow.Attributes >> i) & 1))
4126 {
@@ -4261,115 +4134,115 @@ namespace WixToolset.Core.WindowsInstaller
4134 // unknown attribute
4135 if (null == attribute)
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));
4138 continue;
4139 }
4140
4141 switch (attribute)
4142 {
4270 - case "Bitmap":
4271 - control.Bitmap = Wix.YesNoType.yes;
4272 - break;
4273 - case "CDROM":
4274 - control.CDROM = Wix.YesNoType.yes;
4275 - break;
4276 - case "ComboList":
4277 - control.ComboList = Wix.YesNoType.yes;
4278 - break;
4279 - case "ElevationShield":
4280 - control.ElevationShield = Wix.YesNoType.yes;
4281 - break;
4282 - case "Fixed":
4283 - control.Fixed = Wix.YesNoType.yes;
4284 - break;
4285 - case "FixedSize":
4286 - control.FixedSize = Wix.YesNoType.yes;
4287 - break;
4288 - case "Floppy":
4289 - control.Floppy = Wix.YesNoType.yes;
4290 - break;
4291 - case "FormatSize":
4292 - control.FormatSize = Wix.YesNoType.yes;
4293 - break;
4294 - case "HasBorder":
4295 - control.HasBorder = Wix.YesNoType.yes;
4296 - break;
4297 - case "Icon":
4298 - control.Icon = Wix.YesNoType.yes;
4299 - break;
4300 - case "Icon16":
4301 - if (iconSizeSet)
4302 - {
4303 - control.IconSize = Wix.Control.IconSizeType.Item48;
4304 - }
4305 - else
4306 - {
4307 - iconSizeSet = true;
4308 - control.IconSize = Wix.Control.IconSizeType.Item16;
4309 - }
4310 - break;
4311 - case "Icon32":
4312 - if (iconSizeSet)
4313 - {
4314 - control.IconSize = Wix.Control.IconSizeType.Item48;
4315 - }
4316 - else
4317 - {
4318 - iconSizeSet = true;
4319 - control.IconSize = Wix.Control.IconSizeType.Item32;
4320 - }
4321 - break;
4322 - case "Image":
4323 - control.Image = Wix.YesNoType.yes;
4324 - break;
4325 - case "Multiline":
4326 - control.Multiline = Wix.YesNoType.yes;
4327 - break;
4328 - case "NoPrefix":
4329 - control.NoPrefix = Wix.YesNoType.yes;
4330 - break;
4331 - case "NoWrap":
4332 - control.NoWrap = Wix.YesNoType.yes;
4333 - break;
4334 - case "Password":
4335 - control.Password = Wix.YesNoType.yes;
4336 - break;
4337 - case "ProgressBlocks":
4338 - control.ProgressBlocks = Wix.YesNoType.yes;
4339 - break;
4340 - case "PushLike":
4341 - control.PushLike = Wix.YesNoType.yes;
4342 - break;
4343 - case "RAMDisk":
4344 - control.RAMDisk = Wix.YesNoType.yes;
4345 - break;
4346 - case "Remote":
4347 - control.Remote = Wix.YesNoType.yes;
4348 - break;
4349 - case "Removable":
4350 - control.Removable = Wix.YesNoType.yes;
4351 - break;
4352 - case "ShowRollbackCost":
4353 - control.ShowRollbackCost = Wix.YesNoType.yes;
4354 - break;
4355 - case "Sorted":
4356 - control.Sorted = Wix.YesNoType.yes;
4357 - break;
4358 - case "Transparent":
4359 - control.Transparent = Wix.YesNoType.yes;
4360 - break;
4361 - case "UserLanguage":
4362 - control.UserLanguage = Wix.YesNoType.yes;
4363 - break;
4364 - default:
4365 - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknowControlAttribute, attribute));
4143 + case "Bitmap":
4144 + control.Bitmap = Wix.YesNoType.yes;
4145 + break;
4146 + case "CDROM":
4147 + control.CDROM = Wix.YesNoType.yes;
4148 + break;
4149 + case "ComboList":
4150 + control.ComboList = Wix.YesNoType.yes;
4151 + break;
4152 + case "ElevationShield":
4153 + control.ElevationShield = Wix.YesNoType.yes;
4154 + break;
4155 + case "Fixed":
4156 + control.Fixed = Wix.YesNoType.yes;
4157 + break;
4158 + case "FixedSize":
4159 + control.FixedSize = Wix.YesNoType.yes;
4160 + break;
4161 + case "Floppy":
4162 + control.Floppy = Wix.YesNoType.yes;
4163 + break;
4164 + case "FormatSize":
4165 + control.FormatSize = Wix.YesNoType.yes;
4166 + break;
4167 + case "HasBorder":
4168 + control.HasBorder = Wix.YesNoType.yes;
4169 + break;
4170 + case "Icon":
4171 + control.Icon = Wix.YesNoType.yes;
4172 + break;
4173 + case "Icon16":
4174 + if (iconSizeSet)
4175 + {
4176 + control.IconSize = Wix.Control.IconSizeType.Item48;
4177 + }
4178 + else
4179 + {
4180 + iconSizeSet = true;
4181 + control.IconSize = Wix.Control.IconSizeType.Item16;
4182 + }
4183 + break;
4184 + case "Icon32":
4185 + if (iconSizeSet)
4186 + {
4187 + control.IconSize = Wix.Control.IconSizeType.Item48;
4188 + }
4189 + else
4190 + {
4191 + iconSizeSet = true;
4192 + control.IconSize = Wix.Control.IconSizeType.Item32;
4193 + }
4194 + break;
4195 + case "Image":
4196 + control.Image = Wix.YesNoType.yes;
4197 + break;
4198 + case "Multiline":
4199 + control.Multiline = Wix.YesNoType.yes;
4200 + break;
4201 + case "NoPrefix":
4202 + control.NoPrefix = Wix.YesNoType.yes;
4203 + break;
4204 + case "NoWrap":
4205 + control.NoWrap = Wix.YesNoType.yes;
4206 + break;
4207 + case "Password":
4208 + control.Password = Wix.YesNoType.yes;
4209 + break;
4210 + case "ProgressBlocks":
4211 + control.ProgressBlocks = Wix.YesNoType.yes;
4212 + break;
4213 + case "PushLike":
4214 + control.PushLike = Wix.YesNoType.yes;
4215 + break;
4216 + case "RAMDisk":
4217 + control.RAMDisk = Wix.YesNoType.yes;
4218 + break;
4219 + case "Remote":
4220 + control.Remote = Wix.YesNoType.yes;
4221 + break;
4222 + case "Removable":
4223 + control.Removable = Wix.YesNoType.yes;
4224 + break;
4225 + case "ShowRollbackCost":
4226 + control.ShowRollbackCost = Wix.YesNoType.yes;
4227 + break;
4228 + case "Sorted":
4229 + control.Sorted = Wix.YesNoType.yes;
4230 + break;
4231 + case "Transparent":
4232 + control.Transparent = Wix.YesNoType.yes;
4233 + break;
4234 + case "UserLanguage":
4235 + control.UserLanguage = Wix.YesNoType.yes;
4236 + break;
4237 + default:
4238 + throw new InvalidOperationException($"Unknown control attribute: '{attribute}'.");
4239 }
4240 }
4241 }
4242 }
4243 else if (0 < (controlRow.Attributes & 0xFFFF0000))
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));
4246 }
4247 }
4248
@@ -4386,7 +4259,7 @@ namespace WixToolset.Core.WindowsInstaller
4259
4260 if (null != controlRow.Help)
4261 {
4389 - string[] help = controlRow.Help.Split('|');
4262 + var help = controlRow.Help.Split('|');
4263
4264 if (2 == help.Length)
4265 {
@@ -4412,42 +4285,42 @@ namespace WixToolset.Core.WindowsInstaller
4285 /// <param name="table">The table to decompile.</param>
4286 private void DecompileControlConditionTable(Table table)
4287 {
4415 - foreach (Row row in table.Rows)
4288 + foreach (var row in table.Rows)
4289 {
4417 - Wix.Condition condition = new Wix.Condition();
4290 + var condition = new Wix.Condition();
4291
4292 switch (Convert.ToString(row[2]))
4293 {
4421 - case "Default":
4422 - condition.Action = Wix.Condition.ActionType.@default;
4423 - break;
4424 - case "Disable":
4425 - condition.Action = Wix.Condition.ActionType.disable;
4426 - break;
4427 - case "Enable":
4428 - condition.Action = Wix.Condition.ActionType.enable;
4429 - break;
4430 - case "Hide":
4431 - condition.Action = Wix.Condition.ActionType.hide;
4432 - break;
4433 - case "Show":
4434 - condition.Action = Wix.Condition.ActionType.show;
4435 - break;
4436 - default:
4437 - this.core.OnMessage(WixWarnings.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2]));
4438 - break;
4294 + case "Default":
4295 + condition.Action = Wix.Condition.ActionType.@default;
4296 + break;
4297 + case "Disable":
4298 + condition.Action = Wix.Condition.ActionType.disable;
4299 + break;
4300 + case "Enable":
4301 + condition.Action = Wix.Condition.ActionType.enable;
4302 + break;
4303 + case "Hide":
4304 + condition.Action = Wix.Condition.ActionType.hide;
4305 + break;
4306 + case "Show":
4307 + condition.Action = Wix.Condition.ActionType.show;
4308 + break;
4309 + default:
4310 + this.Messaging.Write(WarningMessages.IllegalColumnValue(row.SourceLineNumbers, table.Name, row.Fields[2].Column.Name, row[2]));
4311 + break;
4312 }
4313
4314 condition.Content = Convert.ToString(row[3]);
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]));
4317 if (null != control)
4318 {
4319 control.AddChild(condition);
4320 }
4321 else
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"));
4324 }
4325 }
4326 }
@@ -4458,13 +4331,13 @@ namespace WixToolset.Core.WindowsInstaller
4331 /// <param name="table">The table to decompile.</param>
4332 private void DecompileControlEventTable(Table table)
4333 {
4461 - SortedList controlEvents = new SortedList();
4334 + var controlEvents = new SortedList();
4335
4463 - foreach (Row row in table.Rows)
4336 + foreach (var row in table.Rows)
4337 {
4465 - Wix.Publish publish = new Wix.Publish();
4338 + var publish = new Wix.Publish();
4339
4467 - string publishEvent = Convert.ToString(row[2]);
4340 + var publishEvent = Convert.ToString(row[2]);
4341 if (publishEvent.StartsWith("[", StringComparison.Ordinal) && publishEvent.EndsWith("]", StringComparison.Ordinal))
4342 {
4343 publish.Property = publishEvent.Substring(1, publishEvent.Length - 2);
@@ -4492,8 +4365,8 @@ namespace WixToolset.Core.WindowsInstaller
4365
4366 foreach (Row row in controlEvents.Values)
4367 {
4495 - Wix.Control 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);
4368 + var control = (Wix.Control)this.core.GetIndexedElement("Control", Convert.ToString(row[0]), Convert.ToString(row[1]));
4369 + var publish = (Wix.Publish)this.core.GetIndexedElement(row);
4370
4371 if (null != control)
4372 {
@@ -4501,7 +4374,7 @@ namespace WixToolset.Core.WindowsInstaller
4374 }
4375 else
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"));
4378 }
4379 }
4380 }
@@ -4512,17 +4385,17 @@ namespace WixToolset.Core.WindowsInstaller
4385 /// <param name="table">The table to decompile.</param>
4386 private void DecompileCustomTable(Table table)
4387 {
4515 - if (0 < table.Rows.Count || this.suppressDroppingEmptyTables)
4388 + if (0 < table.Rows.Count || this.SuppressDroppingEmptyTables)
4389 {
4517 - Wix.CustomTable customTable = new Wix.CustomTable();
4390 + var customTable = new Wix.CustomTable();
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));
4393
4394 customTable.Id = table.Name;
4395
4523 - foreach (ColumnDefinition columnDefinition in table.Definition.Columns)
4396 + foreach (var columnDefinition in table.Definition.Columns)
4397 {
4525 - Wix.Column column = new Wix.Column();
4398 + var column = new Wix.Column();
4399
4400 column.Id = columnDefinition.Name;
4401
@@ -4530,86 +4403,86 @@ namespace WixToolset.Core.WindowsInstaller
4403 {
4404 switch (columnDefinition.Category)
4405 {
4533 - case ColumnCategory.Text:
4534 - column.Category = Wix.Column.CategoryType.Text;
4535 - break;
4536 - case ColumnCategory.UpperCase:
4537 - column.Category = Wix.Column.CategoryType.UpperCase;
4538 - break;
4539 - case ColumnCategory.LowerCase:
4540 - column.Category = Wix.Column.CategoryType.LowerCase;
4541 - break;
4542 - case ColumnCategory.Integer:
4543 - column.Category = Wix.Column.CategoryType.Integer;
4544 - break;
4545 - case ColumnCategory.DoubleInteger:
4546 - column.Category = Wix.Column.CategoryType.DoubleInteger;
4547 - break;
4548 - case ColumnCategory.TimeDate:
4549 - column.Category = Wix.Column.CategoryType.TimeDate;
4550 - break;
4551 - case ColumnCategory.Identifier:
4552 - column.Category = Wix.Column.CategoryType.Identifier;
4553 - break;
4554 - case ColumnCategory.Property:
4555 - column.Category = Wix.Column.CategoryType.Property;
4556 - break;
4557 - case ColumnCategory.Filename:
4558 - column.Category = Wix.Column.CategoryType.Filename;
4559 - break;
4560 - case ColumnCategory.WildCardFilename:
4561 - column.Category = Wix.Column.CategoryType.WildCardFilename;
4562 - break;
4563 - case ColumnCategory.Path:
4564 - column.Category = Wix.Column.CategoryType.Path;
4565 - break;
4566 - case ColumnCategory.Paths:
4567 - column.Category = Wix.Column.CategoryType.Paths;
4568 - break;
4569 - case ColumnCategory.AnyPath:
4570 - column.Category = Wix.Column.CategoryType.AnyPath;
4571 - break;
4572 - case ColumnCategory.DefaultDir:
4573 - column.Category = Wix.Column.CategoryType.DefaultDir;
4574 - break;
4575 - case ColumnCategory.RegPath:
4576 - column.Category = Wix.Column.CategoryType.RegPath;
4577 - break;
4578 - case ColumnCategory.Formatted:
4579 - column.Category = Wix.Column.CategoryType.Formatted;
4580 - break;
4581 - case ColumnCategory.FormattedSDDLText:
4582 - column.Category = Wix.Column.CategoryType.FormattedSddl;
4583 - break;
4584 - case ColumnCategory.Template:
4585 - column.Category = Wix.Column.CategoryType.Template;
4586 - break;
4587 - case ColumnCategory.Condition:
4588 - column.Category = Wix.Column.CategoryType.Condition;
4589 - break;
4590 - case ColumnCategory.Guid:
4591 - column.Category = Wix.Column.CategoryType.Guid;
4592 - break;
4593 - case ColumnCategory.Version:
4594 - column.Category = Wix.Column.CategoryType.Version;
4595 - break;
4596 - case ColumnCategory.Language:
4597 - column.Category = Wix.Column.CategoryType.Language;
4598 - break;
4599 - case ColumnCategory.Binary:
4600 - column.Category = Wix.Column.CategoryType.Binary;
4601 - break;
4602 - case ColumnCategory.CustomSource:
4603 - column.Category = Wix.Column.CategoryType.CustomSource;
4604 - break;
4605 - case ColumnCategory.Cabinet:
4606 - column.Category = Wix.Column.CategoryType.Cabinet;
4607 - break;
4608 - case ColumnCategory.Shortcut:
4609 - column.Category = Wix.Column.CategoryType.Shortcut;
4610 - break;
4611 - default:
4612 - throw new InvalidOperationException(String.Format(CultureInfo.CurrentUICulture, WixStrings.EXP_UnknownCustomColumnCategory, columnDefinition.Category.ToString()));
4406 + case ColumnCategory.Text:
4407 + column.Category = Wix.Column.CategoryType.Text;
4408 + break;
4409 + case ColumnCategory.UpperCase:
4410 + column.Category = Wix.Column.CategoryType.UpperCase;
4411 + break;
4412 + case ColumnCategory.LowerCase:
4413 + column.Category = Wix.Column.CategoryType.LowerCase;
4414 + break;
4415 + case ColumnCategory.Integer:
4416 + column.Category = Wix.Column.CategoryType.Integer;
4417 + break;
4418 + case ColumnCategory.DoubleInteger:
4419 + column.Category = Wix.Column.CategoryType.DoubleInteger;
4420 + break;
4421 + case ColumnCategory.TimeDate:
4422 + column.Category = Wix.Column.CategoryType.TimeDate;
4423 + break;
4424 + case ColumnCategory.Identifier:
4425 + column.Category = Wix.Column.CategoryType.Identifier;
4426 + break;
4427 + case ColumnCategory.Property:
4428 + column.Category = Wix.Column.CategoryType.Property;
4429 + break;
4430 + case ColumnCategory.Filename:
4431 + column.Category = Wix.Column.CategoryType.Filename;
4432 + break;
4433 + case ColumnCategory.WildCardFilename:
4434 + column.Category = Wix.Column.CategoryType.WildCardFilename;
4435 + break;
4436 + case ColumnCategory.Path:
4437 + column.Category = Wix.Column.CategoryType.Path;
4438 + break;
4439 + case ColumnCategory.Paths:
4440 + column.Category = Wix.Column.CategoryType.Paths;
4441 + break;
4442 + case ColumnCategory.AnyPath:
4443 + column.Category = Wix.Column.CategoryType.AnyPath;
4444 + break;
4445 + case ColumnCategory.DefaultDir:
4446 + column.Category = Wix.Column.CategoryType.DefaultDir;
4447 + break;
4448 + case ColumnCategory.RegPath:
4449 + column.Category = Wix.Column.CategoryType.RegPath;
4450 + break;
4451 + case ColumnCategory.Formatted:
4452 + column.Category = Wix.Column.CategoryType.Formatted;
4453 + break;
4454 + case ColumnCategory.FormattedSDDLText:
4455 + column.Category = Wix.Column.CategoryType.FormattedSddl;
4456 + break;
4457 + case ColumnCategory.Template:
4458 + column.Category = Wix.Column.CategoryType.Template;
4459 + break;
4460 + case ColumnCategory.Condition:
4461 + column.Category = Wix.Column.CategoryType.Condition;
4462 + break;
4463 + case ColumnCategory.Guid:
4464 + column.Category = Wix.Column.CategoryType.Guid;
4465 + break;
4466 + case ColumnCategory.Version:
4467 + column.Category = Wix.Column.CategoryType.Version;
4468 + break;
4469 + case ColumnCategory.Language:
4470 + column.Category = Wix.Column.CategoryType.Language;
4471 + break;
4472 + case ColumnCategory.Binary:
4473 + column.Category = Wix.Column.CategoryType.Binary;
4474 + break;
4475 + case ColumnCategory.CustomSource:
4476 + column.Category = Wix.Column.CategoryType.CustomSource;
4477 + break;
4478 + case ColumnCategory.Cabinet:
4479 + column.Category = Wix.Column.CategoryType.Cabinet;
4480 + break;
4481 + case ColumnCategory.Shortcut:
4482 + column.Category = Wix.Column.CategoryType.Shortcut;
4483 + break;
4484 + default:
4485 + throw new InvalidOperationException($"Unknown custom column category '{columnDefinition.Category.ToString()}'.");
4486 }
4487 }
4488
@@ -4618,9 +4491,9 @@ namespace WixToolset.Core.WindowsInstaller
4491 column.Description = columnDefinition.Description;
4492 }
4493
4621 - if (columnDefinition.IsKeyColumnSet)
4494 + if (columnDefinition.KeyColumn.HasValue)
4495 {
4623 - column.KeyColumn = columnDefinition.KeyColumn;
4496 + column.KeyColumn = columnDefinition.KeyColumn.Value;
4497 }
4498
4499 if (null != columnDefinition.KeyTable)
@@ -4633,37 +4506,37 @@ namespace WixToolset.Core.WindowsInstaller
4506 column.Localizable = Wix.YesNoType.yes;
4507 }
4508
4636 - if (columnDefinition.IsMaxValueSet)
4509 + if (columnDefinition.MaxValue.HasValue)
4510 {
4638 - column.MaxValue = columnDefinition.MaxValue;
4511 + column.MaxValue = columnDefinition.MaxValue.Value;
4512 }
4513
4641 - if (columnDefinition.IsMinValueSet)
4514 + if (columnDefinition.MinValue.HasValue)
4515 {
4643 - column.MinValue = columnDefinition.MinValue;
4516 + column.MinValue = columnDefinition.MinValue.Value;
4517 }
4518
4519 if (ColumnModularizeType.None != columnDefinition.ModularizeType)
4520 {
4521 switch (columnDefinition.ModularizeType)
4522 {
4650 - case ColumnModularizeType.Column:

This file is too large to show in full.

src/WixToolset.Core.WindowsInstaller/Decompile/DecompilerCore.cs renamed
+8 -52
@@ -4,20 +4,17 @@ namespace WixToolset
4 {
5 using System;
6 using System.Collections;
7 - using WixToolset.Data;
7 + using WixToolset.Data.WindowsInstaller;
8 using WixToolset.Extensibility;
9 using Wix = WixToolset.Data.Serialize;
10
11 -#if TODO
11 /// <summary>
12 /// The base of the decompiler. Holds some variables used by the decompiler and extensions,
13 /// as well as some utility methods.
14 /// </summary>
16 - internal class DecompilerCore : IDecompilerCore
15 + internal class DecompilerCore
16 {
18 - private Hashtable elements;
19 - private Wix.IParentElement rootElement;
20 - private bool showPedanticMessages;
17 + private readonly Hashtable elements;
18 private Wix.UI uiElement;
19
20 /// <summary>
@@ -28,36 +25,14 @@ namespace WixToolset
25 internal DecompilerCore(Wix.IParentElement rootElement)
26 {
27 this.elements = new Hashtable();
31 - 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; }
28 + this.RootElement = rootElement;
29 }
30
31 /// <summary>
32 /// Gets the root element of the decompiled output.
33 /// </summary>
34 /// <value>The root element of the decompiled output.</value>
47 - public Wix.IParentElement RootElement
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 - }
35 + public Wix.IParentElement RootElement { get; }
36
37 /// <summary>
38 /// Gets the UI element.
@@ -70,7 +45,7 @@ namespace WixToolset
45 if (null == this.uiElement)
46 {
47 this.uiElement = new Wix.UI();
73 - this.rootElement.AddChild(this.uiElement);
48 + this.RootElement.AddChild(this.uiElement);
49 }
50
51 return this.uiElement;
@@ -95,8 +70,8 @@ namespace WixToolset
70 /// <returns>The DateTime.</returns>
71 public DateTime ConvertIntegerToDateTime(int value)
72 {
98 - int date = value / 65536;
99 - int time = value % 65536;
73 + var date = value / 65536;
74 + var time = value % 65536;
75
76 return new DateTime(1980 + (date / 512), (date % 512) / 32, date % 32, time / 2048, (time % 2048) / 32, (time % 32) * 2);
77 }
@@ -131,24 +106,5 @@ namespace WixToolset
106 {
107 this.elements.Add(String.Concat(row.TableDefinition.Name, ':', row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)), element);
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 - }
109 }
153 -#endif
110 }
src/WixToolset.Core.WindowsInstaller/MsiBackend.cs
+20 -3
@@ -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
3 namespace WixToolset.Core.WindowsInstaller
4 {
@@ -38,9 +38,26 @@ namespace WixToolset.Core.WindowsInstaller
38 return result;
39 }
40
41 - public BindResult Decompile(IDecompileContext context)
41 + public DecompileResult Decompile(IDecompileContext context)
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;
61 }
62
63 public bool Inscribe(IInscribeContext context)
src/WixToolset.Core.WindowsInstaller/MsmBackend.cs
+20 -3
@@ -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
3 namespace WixToolset.Core.WindowsInstaller
4 {
@@ -43,9 +43,26 @@ namespace WixToolset.Core.WindowsInstaller
43 return result;
44 }
45
46 - public BindResult Decompile(IDecompileContext context)
46 + public DecompileResult Decompile(IDecompileContext context)
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;
66 }
67
68 public bool Inscribe(IInscribeContext context)
src/WixToolset.Core.WindowsInstaller/MspBackend.cs
+2 -2
@@ -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
3 namespace WixToolset.Core.WindowsInstaller
4 {
@@ -21,7 +21,7 @@ namespace WixToolset.Core.WindowsInstaller
21 throw new NotImplementedException();
22 }
23
24 - public BindResult Decompile(IDecompileContext context)
24 + public DecompileResult Decompile(IDecompileContext context)
25 {
26 throw new NotImplementedException();
27 }
src/WixToolset.Core.WindowsInstaller/MstBackend.cs
+2 -2
@@ -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
3 namespace WixToolset.Core.WindowsInstaller
4 {
@@ -25,7 +25,7 @@ namespace WixToolset.Core.WindowsInstaller
25 throw new NotImplementedException();
26 }
27
28 - public BindResult Decompile(IDecompileContext context)
28 + public DecompileResult Decompile(IDecompileContext context)
29 {
30 throw new NotImplementedException();
31 }
src/WixToolset.Core/CommandLine/DecompileCommand.cs new
+212
@@ -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 +
3 +namespace 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 +}
src/WixToolset.Core/DecompileContext.cs
+19 -1
@@ -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
3 namespace WixToolset.Core
4 {
@@ -17,12 +17,30 @@ namespace WixToolset.Core
17
18 public IServiceProvider ServiceProvider { get; }
19
20 + public string DecompilePath { get; set; }
21 +
22 public OutputType DecompileType { get; set; }
23
24 public IEnumerable<IDecompilerExtension> Extensions { get; set; }
25
26 + public string ExtractFolder { get; set; }
27 +
28 + public string BaseSourcePath { get; set; }
29 +
30 public string IntermediateFolder { get; set; }
31
32 + public bool IsAdminImage { get; set; }
33 +
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; }
45 }
46 }
src/WixToolset.Core/Decompiler.cs
+6 -6
@@ -19,7 +19,7 @@ namespace WixToolset.Core
19
20 public IServiceProvider ServiceProvider { get; }
21
22 - public BindResult Decompile(IDecompileContext context)
22 + public DecompileResult Decompile(IDecompileContext context)
23 {
24 // Pre-decompile.
25 //
@@ -30,22 +30,22 @@ namespace WixToolset.Core
30
31 // Decompile.
32 //
33 - var bindResult = this.BackendDecompile(context);
33 + var result = this.BackendDecompile(context);
34
35 - if (bindResult != null)
35 + if (result != null)
36 {
37 // Post-decompile.
38 //
39 foreach (var extension in context.Extensions)
40 {
41 - extension.PostDecompile(bindResult);
41 + extension.PostDecompile(result);
42 }
43 }
44
45 - return bindResult;
45 + return result;
46 }
47
48 - private BindResult BackendDecompile(IDecompileContext context)
48 + private DecompileResult BackendDecompile(IDecompileContext context)
49 {
50 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>();
51
src/WixToolset.Core/IDecompiler.cs
+2 -2
@@ -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
3 namespace WixToolset.Core
4 {
@@ -6,6 +6,6 @@ namespace WixToolset.Core
6
7 public interface IDecompiler
8 {
9 - BindResult Decompile(IDecompileContext context);
9 + DecompileResult Decompile(IDecompileContext context);
10 }
11 }
src/WixToolset.Core/OptimizeCA.cs
+2 -2
@@ -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
3 namespace WixToolset.Core
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.
9 /// </summary>
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 {
13 /// <summary>
14 /// No custom actions are skipped.
src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs new
+41
@@ -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 +
3 +namespace 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 +}
src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/Expected.wxs new
+21
@@ -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
src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.cab
Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.cab differ
src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.msi
Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileSingleFileCompressed/example.msi differ
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+3
@@ -20,6 +20,9 @@
20 <Content Include="TestData\InstanceTransform\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
21 <Content Include="TestData\InstanceTransform\Package.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" />
26 <Content Include="TestData\ExampleExtension\data\example.txt" CopyToOutputDirectory="PreserveNewest" />
27 <Content Include="TestData\ExampleExtension\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
28 <Content Include="TestData\ExampleExtension\Package.wxs" CopyToOutputDirectory="PreserveNewest" />