aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2018-10-24 21:00:13 -0700
committerRob Mensching <rob@robmensching.com>2018-10-24 21:17:34 -0700
commit0ecb2ac1ba28d33b0b3d17a2d7134d2f5485814d (patch)
tree42ce582bfc472c8b1bada41696670ed94e6ddff6 /src/WixToolset.Core
parent0a67f66835c882763e1504895cbec3acb9284f3d (diff)
downloadwix-0ecb2ac1ba28d33b0b3d17a2d7134d2f5485814d.tar.gz
wix-0ecb2ac1ba28d33b0b3d17a2d7134d2f5485814d.tar.bz2
wix-0ecb2ac1ba28d33b0b3d17a2d7134d2f5485814d.zip
Minor code clean up to match .editorconfig
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r--src/WixToolset.Core/Common.cs109
-rw-r--r--src/WixToolset.Core/Compiler.cs15842
-rw-r--r--src/WixToolset.Core/Localizer.cs2
-rw-r--r--src/WixToolset.Core/Preprocessor.cs2
4 files changed, 7939 insertions, 8016 deletions
diff --git a/src/WixToolset.Core/Common.cs b/src/WixToolset.Core/Common.cs
index 2d8f9509..610bfcaa 100644
--- a/src/WixToolset.Core/Common.cs
+++ b/src/WixToolset.Core/Common.cs
@@ -21,6 +21,12 @@ namespace WixToolset.Core
21 /// </summary> 21 /// </summary>
22 public static class Common 22 public static class Common
23 { 23 {
24 // TODO: Find a place to put all of these so they doesn't have to be public and exposed by WixToolset.Core.dll
25 public const string UpgradeDetectedProperty = "WIX_UPGRADE_DETECTED";
26 public const string UpgradePreventedCondition = "NOT WIX_UPGRADE_DETECTED";
27 public const string DowngradeDetectedProperty = "WIX_DOWNGRADE_DETECTED";
28 public const string DowngradePreventedCondition = "NOT WIX_DOWNGRADE_DETECTED";
29
24 //------------------------------------------------------------------------------------------------- 30 //-------------------------------------------------------------------------------------------------
25 // Layout of an Access Mask (from http://technet.microsoft.com/en-us/library/cc783530(WS.10).aspx) 31 // Layout of an Access Mask (from http://technet.microsoft.com/en-us/library/cc783530(WS.10).aspx)
26 // 32 //
@@ -45,7 +51,8 @@ namespace WixToolset.Core
45 // GENERIC_EXECUTE (0x20000000L) 51 // GENERIC_EXECUTE (0x20000000L)
46 // GENERIC_WRITE (0x40000000L) 52 // GENERIC_WRITE (0x40000000L)
47 // GENERIC_READ (0x80000000L) 53 // GENERIC_READ (0x80000000L)
48 internal static readonly string[] GenericPermissions = { "GenericAll", "GenericExecute", "GenericWrite", "GenericRead" }; 54 // TODO: Find a place to put this that it doesn't have to be public and exposed by WixToolset.Core.dll
55 public static readonly string[] GenericPermissions = { "GenericAll", "GenericExecute", "GenericWrite", "GenericRead" };
49 56
50 // Standard Access Rights (per WinNT.h) 57 // Standard Access Rights (per WinNT.h)
51 // ---------------------- 58 // ----------------------
@@ -54,7 +61,8 @@ namespace WixToolset.Core
54 // WRITE_DAC (0x00040000L) 61 // WRITE_DAC (0x00040000L)
55 // WRITE_OWNER (0x00080000L) 62 // WRITE_OWNER (0x00080000L)
56 // SYNCHRONIZE (0x00100000L) 63 // SYNCHRONIZE (0x00100000L)
57 internal static readonly string[] StandardPermissions = { "Delete", "ReadPermission", "ChangePermission", "TakeOwnership", "Synchronize" }; 64 // TODO: Find a place to put this that it doesn't have to be public and exposed by WixToolset.Core.dll
65 public static readonly string[] StandardPermissions = { "Delete", "ReadPermission", "ChangePermission", "TakeOwnership", "Synchronize" };
58 66
59 // Object-Specific Access Rights 67 // Object-Specific Access Rights
60 // ============================= 68 // =============================
@@ -69,11 +77,13 @@ namespace WixToolset.Core
69 // FILE_DELETE_CHILD ( 0x0040 ) 77 // FILE_DELETE_CHILD ( 0x0040 )
70 // FILE_READ_ATTRIBUTES ( 0x0080 ) 78 // FILE_READ_ATTRIBUTES ( 0x0080 )
71 // FILE_WRITE_ATTRIBUTES ( 0x0100 ) 79 // FILE_WRITE_ATTRIBUTES ( 0x0100 )
72 internal static readonly string[] FolderPermissions = { "Read", "CreateFile", "CreateChild", "ReadExtendedAttributes", "WriteExtendedAttributes", "Traverse", "DeleteChild", "ReadAttributes", "WriteAttributes" }; 80 // TODO: Find a place to put this that it doesn't have to be public and exposed by WixToolset.Core.dll
81 public static readonly string[] FolderPermissions = { "Read", "CreateFile", "CreateChild", "ReadExtendedAttributes", "WriteExtendedAttributes", "Traverse", "DeleteChild", "ReadAttributes", "WriteAttributes" };
73 82
74 // Registry Access Rights (per TODO) 83 // Registry Access Rights (per TODO)
75 // ---------------------- 84 // ----------------------
76 internal static readonly string[] RegistryPermissions = { "Read", "Write", "CreateSubkeys", "EnumerateSubkeys", "Notify", "CreateLink" }; 85 // TODO: Find a place to put this that it doesn't have to be public and exposed by WixToolset.Core.dll
86 public static readonly string[] RegistryPermissions = { "Read", "Write", "CreateSubkeys", "EnumerateSubkeys", "Notify", "CreateLink" };
77 87
78 // File Access Rights (per WinNT.h) 88 // File Access Rights (per WinNT.h)
79 // ------------------ 89 // ------------------
@@ -89,7 +99,8 @@ namespace WixToolset.Core
89 // 99 //
90 // STANDARD_RIGHTS_REQUIRED (0x000F0000L) 100 // STANDARD_RIGHTS_REQUIRED (0x000F0000L)
91 // FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) 101 // FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF)
92 internal static readonly string[] FilePermissions = { "Read", "Write", "Append", "ReadExtendedAttributes", "WriteExtendedAttributes", "Execute", "FileAllRights", "ReadAttributes", "WriteAttributes" }; 102 // TODO: Find a place to put this that it doesn't have to be public and exposed by WixToolset.Core.dll
103 public static readonly string[] FilePermissions = { "Read", "Write", "Append", "ReadExtendedAttributes", "WriteExtendedAttributes", "Execute", "FileAllRights", "ReadAttributes", "WriteAttributes" };
93 104
94 public static readonly Regex WixVariableRegex = new Regex(@"(\!|\$)\((?<namespace>loc|wix|bind|bindpath)\.(?<fullname>(?<name>[_A-Za-z][0-9A-Za-z_]+)(\.(?<scope>[_A-Za-z][0-9A-Za-z_\.]*))?)(\=(?<value>.+?))?\)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.ExplicitCapture); 105 public static readonly Regex WixVariableRegex = new Regex(@"(\!|\$)\((?<namespace>loc|wix|bind|bindpath)\.(?<fullname>(?<name>[_A-Za-z][0-9A-Za-z_]+)(\.(?<scope>[_A-Za-z][0-9A-Za-z_\.]*))?)(\=(?<value>.+?))?\)", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.ExplicitCapture);
95 106
@@ -107,58 +118,6 @@ namespace WixToolset.Core
107 private static readonly Regex LegalWildcardShortFilename = new Regex(String.Concat("^", LegalWildcardShortFilenameCharacters, @"{1,16}(\.", LegalWildcardShortFilenameCharacters, "{0,6})?$")); 118 private static readonly Regex LegalWildcardShortFilename = new Regex(String.Concat("^", LegalWildcardShortFilenameCharacters, @"{1,16}(\.", LegalWildcardShortFilenameCharacters, "{0,6})?$"));
108 119
109 /// <summary> 120 /// <summary>
110 /// Cleans up the temp files.
111 /// </summary>
112 /// <param name="path">The temporary directory to delete.</param>
113 /// <param name="messageHandler">The message handler.</param>
114 /// <returns>True if all files were deleted, false otherwise.</returns>
115 internal static bool DeleteTempFiles(string path, IMessaging messageHandler)
116 {
117 // try three times and give up with a warning if the temp files aren't gone by then
118 int retryLimit = 3;
119 bool removedReadOnly = false;
120
121 for (int i = 0; i < retryLimit; i++)
122 {
123 try
124 {
125 Directory.Delete(path, true); // toast the whole temp directory
126 break; // no exception means we got success the first time
127 }
128 catch (UnauthorizedAccessException)
129 {
130 if (!removedReadOnly) // should only need to unmark readonly once - there's no point in doing it again and again
131 {
132 removedReadOnly = true;
133 RecursiveFileAttributes(path, FileAttributes.ReadOnly, false, messageHandler); // toasting will fail if any files are read-only. Try changing them to not be.
134 }
135 else
136 {
137 messageHandler.Write(WarningMessages.AccessDeniedForDeletion(null, path));
138 return false;
139 }
140 }
141 catch (DirectoryNotFoundException)
142 {
143 // if the path doesn't exist, then there is nothing for us to worry about
144 break;
145 }
146 catch (IOException) // directory in use
147 {
148 if (i == (retryLimit - 1)) // last try failed still, give up
149 {
150 messageHandler.Write(WarningMessages.DirectoryInUse(null, path));
151 return false;
152 }
153
154 System.Threading.Thread.Sleep(300); // sleep a bit before trying again
155 }
156 }
157
158 return true;
159 }
160
161 /// <summary>
162 /// Gets a valid code page from the given web name or integer value. 121 /// Gets a valid code page from the given web name or integer value.
163 /// </summary> 122 /// </summary>
164 /// <param name="value">A code page web name or integer value as a string.</param> 123 /// <param name="value">A code page web name or integer value as a string.</param>
@@ -316,30 +275,6 @@ namespace WixToolset.Core
316 } 275 }
317 276
318 /// <summary> 277 /// <summary>
319 /// Get the value of an attribute with type YesNoType.
320 /// </summary>
321 /// <param name="sourceLineNumbers">Source information for the value.</param>
322 /// <param name="elementName">Name of the element for this attribute, used for a possible exception.</param>
323 /// <param name="attributeName">Name of the attribute.</param>
324 /// <param name="value">Value to process.</param>
325 /// <returns>Returns true for a value of 'yes' and false for a value of 'no'.</returns>
326 /// <exception cref="WixException">Thrown when the attribute's value is not 'yes' or 'no'.</exception>
327 internal static bool IsYes(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string value)
328 {
329 switch (value)
330 {
331 case "no":
332 case "false":
333 return false;
334 case "yes":
335 case "true":
336 return true;
337 default:
338 throw new WixException(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, elementName, attributeName, value, "no", "yes"));
339 }
340 }
341
342 /// <summary>
343 /// Verifies the given string is a valid module or bundle version. 278 /// Verifies the given string is a valid module or bundle version.
344 /// </summary> 279 /// </summary>
345 /// <param name="version">The version to verify.</param> 280 /// <param name="version">The version to verify.</param>
@@ -471,18 +406,6 @@ namespace WixToolset.Core
471 } 406 }
472 } 407 }
473 408
474 public static string GetFileHash(string path)
475 {
476 using (SHA1Managed managed = new SHA1Managed())
477 {
478 using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Delete | FileShare.Read))
479 {
480 byte[] hash = managed.ComputeHash(stream);
481 return BitConverter.ToString(hash).Replace("-", String.Empty);
482 }
483 }
484 }
485
486 /// <summary> 409 /// <summary>
487 /// Takes an id, and demodularizes it (if possible). 410 /// Takes an id, and demodularizes it (if possible).
488 /// </summary> 411 /// </summary>
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs
index ffe907e8..f35533ac 100644
--- a/src/WixToolset.Core/Compiler.cs
+++ b/src/WixToolset.Core/Compiler.cs
@@ -24,10 +24,6 @@ namespace WixToolset.Core
24 /// </summary> 24 /// </summary>
25 internal class Compiler : ICompiler 25 internal class Compiler : ICompiler
26 { 26 {
27 public const string UpgradeDetectedProperty = "WIX_UPGRADE_DETECTED";
28 public const string UpgradePreventedCondition = "NOT WIX_UPGRADE_DETECTED";
29 public const string DowngradeDetectedProperty = "WIX_DOWNGRADE_DETECTED";
30 public const string DowngradePreventedCondition = "NOT WIX_DOWNGRADE_DETECTED";
31 public const string DefaultComponentIdPlaceholderFormat = "WixComponentIdPlaceholder{0}"; 27 public const string DefaultComponentIdPlaceholderFormat = "WixComponentIdPlaceholder{0}";
32 public const string DefaultComponentIdPlaceholderWixVariableFormat = "!(wix.{0})"; 28 public const string DefaultComponentIdPlaceholderWixVariableFormat = "!(wix.{0})";
33 public const string BurnUXContainerId = "WixUXContainer"; 29 public const string BurnUXContainerId = "WixUXContainer";
@@ -297,12 +293,12 @@ namespace WixToolset.Core
297 293
298 if (!String.IsNullOrEmpty(value)) 294 if (!String.IsNullOrEmpty(value))
299 { 295 {
300 Regex regex = new Regex(@"\[(?<identifier>[a-zA-Z_][a-zA-Z0-9_\.]*)]", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.ExplicitCapture); 296 var regex = new Regex(@"\[(?<identifier>[a-zA-Z_][a-zA-Z0-9_\.]*)]", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.ExplicitCapture);
301 MatchCollection matches = regex.Matches(value); 297 var matches = regex.Matches(value);
302 298
303 foreach (Match match in matches) 299 foreach (Match match in matches)
304 { 300 {
305 Group group = match.Groups["identifier"]; 301 var group = match.Groups["identifier"];
306 if (group.Success) 302 if (group.Success)
307 { 303 {
308 this.Core.Write(WarningMessages.PropertyValueContainsPropertyReference(sourceLineNumbers, property.Id, group.Value)); 304 this.Core.Write(WarningMessages.PropertyValueContainsPropertyReference(sourceLineNumbers, property.Id, group.Value));
@@ -317,7 +313,7 @@ namespace WixToolset.Core
317 // Add the row to a separate section if requested. 313 // Add the row to a separate section if requested.
318 if (fragment) 314 if (fragment)
319 { 315 {
320 string id = String.Concat(this.Core.ActiveSection.Id, ".", property.Id); 316 var id = String.Concat(this.Core.ActiveSection.Id, ".", property.Id);
321 317
322 section = this.Core.CreateSection(id, SectionType.Fragment, this.Core.ActiveSection.Codepage, this.Context.CompilationId); 318 section = this.Core.CreateSection(id, SectionType.Fragment, this.Core.ActiveSection.Codepage, this.Context.CompilationId);
323 319
@@ -384,53 +380,53 @@ namespace WixToolset.Core
384 /// <param name="typeLibVersion">Optional TypeLib Version for CLSID Interfaces (if any).</param> 380 /// <param name="typeLibVersion">Optional TypeLib Version for CLSID Interfaces (if any).</param>
385 private void ParseAppIdElement(XElement node, string componentId, YesNoType advertise, string fileServer, string typeLibId, string typeLibVersion) 381 private void ParseAppIdElement(XElement node, string componentId, YesNoType advertise, string fileServer, string typeLibId, string typeLibVersion)
386 { 382 {
387 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 383 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
388 string appId = null; 384 string appId = null;
389 string remoteServerName = null; 385 string remoteServerName = null;
390 string localService = null; 386 string localService = null;
391 string serviceParameters = null; 387 string serviceParameters = null;
392 string dllSurrogate = null; 388 string dllSurrogate = null;
393 YesNoType activateAtStorage = YesNoType.NotSet; 389 var activateAtStorage = YesNoType.NotSet;
394 YesNoType appIdAdvertise = YesNoType.NotSet; 390 var appIdAdvertise = YesNoType.NotSet;
395 YesNoType runAsInteractiveUser = YesNoType.NotSet; 391 var runAsInteractiveUser = YesNoType.NotSet;
396 string description = null; 392 string description = null;
397 393
398 foreach (XAttribute attrib in node.Attributes()) 394 foreach (var attrib in node.Attributes())
399 { 395 {
400 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 396 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
401 { 397 {
402 switch (attrib.Name.LocalName) 398 switch (attrib.Name.LocalName)
403 { 399 {
404 case "Id": 400 case "Id":
405 appId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 401 appId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
406 break; 402 break;
407 case "ActivateAtStorage": 403 case "ActivateAtStorage":
408 activateAtStorage = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 404 activateAtStorage = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
409 break; 405 break;
410 case "Advertise": 406 case "Advertise":
411 appIdAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 407 appIdAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
412 break; 408 break;
413 case "Description": 409 case "Description":
414 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 410 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
415 break; 411 break;
416 case "DllSurrogate": 412 case "DllSurrogate":
417 dllSurrogate = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 413 dllSurrogate = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
418 break; 414 break;
419 case "LocalService": 415 case "LocalService":
420 localService = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 416 localService = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
421 break; 417 break;
422 case "RemoteServerName": 418 case "RemoteServerName":
423 remoteServerName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 419 remoteServerName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
424 break; 420 break;
425 case "RunAsInteractiveUser": 421 case "RunAsInteractiveUser":
426 runAsInteractiveUser = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 422 runAsInteractiveUser = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
427 break; 423 break;
428 case "ServiceParameters": 424 case "ServiceParameters":
429 serviceParameters = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 425 serviceParameters = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
430 break; 426 break;
431 default: 427 default:
432 this.Core.UnexpectedAttribute(node, attrib); 428 this.Core.UnexpectedAttribute(node, attrib);
433 break; 429 break;
434 } 430 }
435 } 431 }
436 else 432 else
@@ -459,18 +455,18 @@ namespace WixToolset.Core
459 advertise = YesNoType.No; 455 advertise = YesNoType.No;
460 } 456 }
461 457
462 foreach (XElement child in node.Elements()) 458 foreach (var child in node.Elements())
463 { 459 {
464 if (CompilerCore.WixNamespace == child.Name.Namespace) 460 if (CompilerCore.WixNamespace == child.Name.Namespace)
465 { 461 {
466 switch (child.Name.LocalName) 462 switch (child.Name.LocalName)
467 { 463 {
468 case "Class": 464 case "Class":
469 this.ParseClassElement(child, componentId, advertise, fileServer, typeLibId, typeLibVersion, appId); 465 this.ParseClassElement(child, componentId, advertise, fileServer, typeLibId, typeLibVersion, appId);
470 break; 466 break;
471 default: 467 default:
472 this.Core.UnexpectedElement(node, child); 468 this.Core.UnexpectedElement(node, child);
473 break; 469 break;
474 } 470 }
475 } 471 }
476 else 472 else
@@ -555,25 +551,25 @@ namespace WixToolset.Core
555 /// <param name="componentId">Parent's component id.</param> 551 /// <param name="componentId">Parent's component id.</param>
556 private void ParseAssemblyName(XElement node, string componentId) 552 private void ParseAssemblyName(XElement node, string componentId)
557 { 553 {
558 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 554 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
559 string id = null; 555 string id = null;
560 string value = null; 556 string value = null;
561 557
562 foreach (XAttribute attrib in node.Attributes()) 558 foreach (var attrib in node.Attributes())
563 { 559 {
564 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 560 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
565 { 561 {
566 switch (attrib.Name.LocalName) 562 switch (attrib.Name.LocalName)
567 { 563 {
568 case "Id": 564 case "Id":
569 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 565 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
570 break; 566 break;
571 case "Value": 567 case "Value":
572 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 568 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
573 break; 569 break;
574 default: 570 default:
575 this.Core.UnexpectedAttribute(node, attrib); 571 this.Core.UnexpectedAttribute(node, attrib);
576 break; 572 break;
577 } 573 }
578 } 574 }
579 else 575 else
@@ -606,39 +602,39 @@ namespace WixToolset.Core
606 [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 602 [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
607 private Identifier ParseBinaryElement(XElement node) 603 private Identifier ParseBinaryElement(XElement node)
608 { 604 {
609 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 605 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
610 Identifier id = null; 606 Identifier id = null;
611 string sourceFile = null; 607 string sourceFile = null;
612 YesNoType suppressModularization = YesNoType.NotSet; 608 var suppressModularization = YesNoType.NotSet;
613 609
614 foreach (XAttribute attrib in node.Attributes()) 610 foreach (var attrib in node.Attributes())
615 { 611 {
616 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 612 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
617 { 613 {
618 switch (attrib.Name.LocalName) 614 switch (attrib.Name.LocalName)
619 { 615 {
620 case "Id": 616 case "Id":
621 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 617 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
622 break; 618 break;
623 case "SourceFile": 619 case "SourceFile":
624 case "src": 620 case "src":
625 if (null != sourceFile) 621 if (null != sourceFile)
626 { 622 {
627 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile", "src")); 623 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile", "src"));
628 } 624 }
629 625
630 if ("src" == attrib.Name.LocalName) 626 if ("src" == attrib.Name.LocalName)
631 { 627 {
632 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile")); 628 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile"));
633 } 629 }
634 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 630 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
635 break; 631 break;
636 case "SuppressModularization": 632 case "SuppressModularization":
637 suppressModularization = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 633 suppressModularization = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
638 break; 634 break;
639 default: 635 default:
640 this.Core.UnexpectedAttribute(node, attrib); 636 this.Core.UnexpectedAttribute(node, attrib);
641 break; 637 break;
642 } 638 }
643 } 639 }
644 else 640 else
@@ -695,25 +691,25 @@ namespace WixToolset.Core
695 /// <returns>Identifier for the new row.</returns> 691 /// <returns>Identifier for the new row.</returns>
696 private string ParseIconElement(XElement node) 692 private string ParseIconElement(XElement node)
697 { 693 {
698 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 694 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
699 Identifier id = null; 695 Identifier id = null;
700 string sourceFile = null; 696 string sourceFile = null;
701 697
702 foreach (XAttribute attrib in node.Attributes()) 698 foreach (var attrib in node.Attributes())
703 { 699 {
704 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 700 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
705 { 701 {
706 switch (attrib.Name.LocalName) 702 switch (attrib.Name.LocalName)
707 { 703 {
708 case "Id": 704 case "Id":
709 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 705 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
710 break; 706 break;
711 case "SourceFile": 707 case "SourceFile":
712 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 708 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
713 break; 709 break;
714 default: 710 default:
715 this.Core.UnexpectedAttribute(node, attrib); 711 this.Core.UnexpectedAttribute(node, attrib);
716 break; 712 break;
717 } 713 }
718 } 714 }
719 else 715 else
@@ -764,22 +760,22 @@ namespace WixToolset.Core
764 /// <param name="node">Element to parse.</param> 760 /// <param name="node">Element to parse.</param>
765 private void ParseInstanceTransformsElement(XElement node) 761 private void ParseInstanceTransformsElement(XElement node)
766 { 762 {
767 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 763 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
768 string property = null; 764 string property = null;
769 765
770 foreach (XAttribute attrib in node.Attributes()) 766 foreach (var attrib in node.Attributes())
771 { 767 {
772 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 768 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
773 { 769 {
774 switch (attrib.Name.LocalName) 770 switch (attrib.Name.LocalName)
775 { 771 {
776 case "Property": 772 case "Property":
777 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 773 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
778 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property); 774 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property);
779 break; 775 break;
780 default: 776 default:
781 this.Core.UnexpectedAttribute(node, attrib); 777 this.Core.UnexpectedAttribute(node, attrib);
782 break; 778 break;
783 } 779 }
784 } 780 }
785 else 781 else
@@ -794,18 +790,18 @@ namespace WixToolset.Core
794 } 790 }
795 791
796 // find unexpected child elements 792 // find unexpected child elements
797 foreach (XElement child in node.Elements()) 793 foreach (var child in node.Elements())
798 { 794 {
799 if (CompilerCore.WixNamespace == child.Name.Namespace) 795 if (CompilerCore.WixNamespace == child.Name.Namespace)
800 { 796 {
801 switch (child.Name.LocalName) 797 switch (child.Name.LocalName)
802 { 798 {
803 case "Instance": 799 case "Instance":
804 ParseInstanceElement(child, property); 800 this.ParseInstanceElement(child, property);
805 break; 801 break;
806 default: 802 default:
807 this.Core.UnexpectedElement(node, child); 803 this.Core.UnexpectedElement(node, child);
808 break; 804 break;
809 } 805 }
810 } 806 }
811 else 807 else
@@ -822,33 +818,33 @@ namespace WixToolset.Core
822 /// <param name="componentId">Identifier of instance property.</param> 818 /// <param name="componentId">Identifier of instance property.</param>
823 private void ParseInstanceElement(XElement node, string propertyId) 819 private void ParseInstanceElement(XElement node, string propertyId)
824 { 820 {
825 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 821 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
826 string id = null; 822 string id = null;
827 string productCode = null; 823 string productCode = null;
828 string productName = null; 824 string productName = null;
829 string upgradeCode = null; 825 string upgradeCode = null;
830 826
831 foreach (XAttribute attrib in node.Attributes()) 827 foreach (var attrib in node.Attributes())
832 { 828 {
833 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 829 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
834 { 830 {
835 switch (attrib.Name.LocalName) 831 switch (attrib.Name.LocalName)
836 { 832 {
837 case "Id": 833 case "Id":
838 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 834 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
839 break; 835 break;
840 case "ProductCode": 836 case "ProductCode":
841 productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); 837 productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true);
842 break; 838 break;
843 case "ProductName": 839 case "ProductName":
844 productName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 840 productName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
845 break; 841 break;
846 case "UpgradeCode": 842 case "UpgradeCode":
847 upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 843 upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
848 break; 844 break;
849 default: 845 default:
850 this.Core.UnexpectedAttribute(node, attrib); 846 this.Core.UnexpectedAttribute(node, attrib);
851 break; 847 break;
852 } 848 }
853 } 849 }
854 else 850 else
@@ -893,34 +889,34 @@ namespace WixToolset.Core
893 /// <param name="componentId">Identifier of parent component.</param> 889 /// <param name="componentId">Identifier of parent component.</param>
894 private void ParseCategoryElement(XElement node, string componentId) 890 private void ParseCategoryElement(XElement node, string componentId)
895 { 891 {
896 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 892 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
897 string id = null; 893 string id = null;
898 string appData = null; 894 string appData = null;
899 string feature = null; 895 string feature = null;
900 string qualifier = null; 896 string qualifier = null;
901 897
902 foreach (XAttribute attrib in node.Attributes()) 898 foreach (var attrib in node.Attributes())
903 { 899 {
904 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 900 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
905 { 901 {
906 switch (attrib.Name.LocalName) 902 switch (attrib.Name.LocalName)
907 { 903 {
908 case "Id": 904 case "Id":
909 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 905 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
910 break; 906 break;
911 case "AppData": 907 case "AppData":
912 appData = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 908 appData = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
913 break; 909 break;
914 case "Feature": 910 case "Feature":
915 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 911 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
916 this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature); 912 this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature);
917 break; 913 break;
918 case "Qualifier": 914 case "Qualifier":
919 qualifier = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 915 qualifier = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
920 break; 916 break;
921 default: 917 default:
922 this.Core.UnexpectedAttribute(node, attrib); 918 this.Core.UnexpectedAttribute(node, attrib);
923 break; 919 break;
924 } 920 }
925 } 921 }
926 else 922 else
@@ -971,105 +967,105 @@ namespace WixToolset.Core
971 /// <param name="parentAppId">Optional parent AppId.</param> 967 /// <param name="parentAppId">Optional parent AppId.</param>
972 private void ParseClassElement(XElement node, string componentId, YesNoType advertise, string fileServer, string typeLibId, string typeLibVersion, string parentAppId) 968 private void ParseClassElement(XElement node, string componentId, YesNoType advertise, string fileServer, string typeLibId, string typeLibVersion, string parentAppId)
973 { 969 {
974 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 970 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
975 971
976 string appId = null; 972 string appId = null;
977 string argument = null; 973 string argument = null;
978 bool class16bit = false; 974 var class16bit = false;
979 bool class32bit = false; 975 var class32bit = false;
980 string classId = null; 976 string classId = null;
981 YesNoType classAdvertise = YesNoType.NotSet; 977 var classAdvertise = YesNoType.NotSet;
982 string[] contexts = new string[0]; 978 var contexts = new string[0];
983 string formattedContextString = null; 979 string formattedContextString = null;
984 bool control = false; 980 var control = false;
985 string defaultInprocHandler = null; 981 string defaultInprocHandler = null;
986 string defaultProgId = null; 982 string defaultProgId = null;
987 string description = null; 983 string description = null;
988 string fileTypeMask = null; 984 string fileTypeMask = null;
989 string foreignServer = null; 985 string foreignServer = null;
990 string icon = null; 986 string icon = null;
991 int iconIndex = CompilerConstants.IntegerNotSet; 987 var iconIndex = CompilerConstants.IntegerNotSet;
992 string insertable = null; 988 string insertable = null;
993 string localFileServer = null; 989 string localFileServer = null;
994 bool programmable = false; 990 var programmable = false;
995 YesNoType relativePath = YesNoType.NotSet; 991 var relativePath = YesNoType.NotSet;
996 bool safeForInit = false; 992 var safeForInit = false;
997 bool safeForScripting = false; 993 var safeForScripting = false;
998 bool shortServerPath = false; 994 var shortServerPath = false;
999 string threadingModel = null; 995 string threadingModel = null;
1000 string version = null; 996 string version = null;
1001 997
1002 foreach (XAttribute attrib in node.Attributes()) 998 foreach (var attrib in node.Attributes())
1003 { 999 {
1004 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 1000 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
1005 { 1001 {
1006 switch (attrib.Name.LocalName) 1002 switch (attrib.Name.LocalName)
1007 { 1003 {
1008 case "Id": 1004 case "Id":
1009 classId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 1005 classId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
1010 break; 1006 break;
1011 case "Advertise": 1007 case "Advertise":
1012 classAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1008 classAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1013 break; 1009 break;
1014 case "AppId": 1010 case "AppId":
1015 appId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 1011 appId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
1016 break; 1012 break;
1017 case "Argument": 1013 case "Argument":
1018 argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1014 argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1019 break; 1015 break;
1020 case "Context": 1016 case "Context":
1021 contexts = this.Core.GetAttributeValue(sourceLineNumbers, attrib).Split("\r\n\t ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); 1017 contexts = this.Core.GetAttributeValue(sourceLineNumbers, attrib).Split("\r\n\t ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
1022 break; 1018 break;
1023 case "Control": 1019 case "Control":
1024 control = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1020 control = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1025 break; 1021 break;
1026 case "Description": 1022 case "Description":
1027 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1023 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1028 break; 1024 break;
1029 case "Handler": 1025 case "Handler":
1030 defaultInprocHandler = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1026 defaultInprocHandler = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1031 break; 1027 break;
1032 case "Icon": 1028 case "Icon":
1033 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 1029 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
1034 break; 1030 break;
1035 case "IconIndex": 1031 case "IconIndex":
1036 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, short.MinValue + 1, short.MaxValue); 1032 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int16.MinValue + 1, Int16.MaxValue);
1037 break; 1033 break;
1038 case "RelativePath": 1034 case "RelativePath":
1039 relativePath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1035 relativePath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1040 break; 1036 break;
1041 1037
1042 // The following attributes result in rows always added to the Registry table rather than the Class table 1038 // The following attributes result in rows always added to the Registry table rather than the Class table
1043 case "Insertable": 1039 case "Insertable":
1044 insertable = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? "Insertable" : "NotInsertable"; 1040 insertable = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? "Insertable" : "NotInsertable";
1045 break; 1041 break;
1046 case "Programmable": 1042 case "Programmable":
1047 programmable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1043 programmable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1048 break; 1044 break;
1049 case "SafeForInitializing": 1045 case "SafeForInitializing":
1050 safeForInit = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1046 safeForInit = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1051 break; 1047 break;
1052 case "SafeForScripting": 1048 case "SafeForScripting":
1053 safeForScripting = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1049 safeForScripting = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1054 break; 1050 break;
1055 case "ForeignServer": 1051 case "ForeignServer":
1056 foreignServer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1052 foreignServer = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1057 break; 1053 break;
1058 case "Server": 1054 case "Server":
1059 localFileServer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1055 localFileServer = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1060 break; 1056 break;
1061 case "ShortPath": 1057 case "ShortPath":
1062 shortServerPath = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1058 shortServerPath = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1063 break; 1059 break;
1064 case "ThreadingModel": 1060 case "ThreadingModel":
1065 threadingModel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1061 threadingModel = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1066 break; 1062 break;
1067 case "Version": 1063 case "Version":
1068 version = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1064 version = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1069 break; 1065 break;
1070 default: 1066 default:
1071 this.Core.UnexpectedAttribute(node, attrib); 1067 this.Core.UnexpectedAttribute(node, attrib);
1072 break; 1068 break;
1073 } 1069 }
1074 } 1070 }
1075 else 1071 else
@@ -1083,8 +1079,8 @@ namespace WixToolset.Core
1083 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); 1079 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
1084 } 1080 }
1085 1081
1086 HashSet<string> uniqueContexts = new HashSet<string>(); 1082 var uniqueContexts = new HashSet<string>();
1087 foreach (string context in contexts) 1083 foreach (var context in contexts)
1088 { 1084 {
1089 if (uniqueContexts.Contains(context)) 1085 if (uniqueContexts.Contains(context))
1090 { 1086 {
@@ -1136,44 +1132,44 @@ namespace WixToolset.Core
1136 } 1132 }
1137 1133
1138 // Local variables used strictly for child node processing. 1134 // Local variables used strictly for child node processing.
1139 int fileTypeMaskIndex = 0; 1135 var fileTypeMaskIndex = 0;
1140 YesNoType firstProgIdForClass = YesNoType.Yes; 1136 var firstProgIdForClass = YesNoType.Yes;
1141 1137
1142 foreach (XElement child in node.Elements()) 1138 foreach (var child in node.Elements())
1143 { 1139 {
1144 if (CompilerCore.WixNamespace == child.Name.Namespace) 1140 if (CompilerCore.WixNamespace == child.Name.Namespace)
1145 { 1141 {
1146 switch (child.Name.LocalName) 1142 switch (child.Name.LocalName)
1147 { 1143 {
1148 case "FileTypeMask": 1144 case "FileTypeMask":
1149 if (YesNoType.Yes == advertise) 1145 if (YesNoType.Yes == advertise)
1150 { 1146 {
1151 fileTypeMask = String.Concat(fileTypeMask, null == fileTypeMask ? String.Empty : ";", this.ParseFileTypeMaskElement(child)); 1147 fileTypeMask = String.Concat(fileTypeMask, null == fileTypeMask ? String.Empty : ";", this.ParseFileTypeMaskElement(child));
1152 } 1148 }
1153 else if (YesNoType.No == advertise) 1149 else if (YesNoType.No == advertise)
1154 { 1150 {
1155 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 1151 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
1156 this.Core.CreateRegistryRow(childSourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("FileType\\", classId, "\\", fileTypeMaskIndex.ToString()), String.Empty, this.ParseFileTypeMaskElement(child), componentId); 1152 this.Core.CreateRegistryRow(childSourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("FileType\\", classId, "\\", fileTypeMaskIndex.ToString()), String.Empty, this.ParseFileTypeMaskElement(child), componentId);
1157 fileTypeMaskIndex++; 1153 fileTypeMaskIndex++;
1158 } 1154 }
1159 break; 1155 break;
1160 case "Interface": 1156 case "Interface":
1161 this.ParseInterfaceElement(child, componentId, class16bit ? classId : null, class32bit ? classId : null, typeLibId, typeLibVersion); 1157 this.ParseInterfaceElement(child, componentId, class16bit ? classId : null, class32bit ? classId : null, typeLibId, typeLibVersion);
1162 break; 1158 break;
1163 case "ProgId": 1159 case "ProgId":
1164 { 1160 {
1165 bool foundExtension = false; 1161 var foundExtension = false;
1166 string progId = this.ParseProgIdElement(child, componentId, advertise, classId, description, null, ref foundExtension, firstProgIdForClass); 1162 var progId = this.ParseProgIdElement(child, componentId, advertise, classId, description, null, ref foundExtension, firstProgIdForClass);
1167 if (null == defaultProgId) 1163 if (null == defaultProgId)
1168 { 1164 {
1169 defaultProgId = progId; 1165 defaultProgId = progId;
1170 } 1166 }
1171 firstProgIdForClass = YesNoType.No; 1167 firstProgIdForClass = YesNoType.No;
1172 } 1168 }
1173 break; 1169 break;
1174 default: 1170 default:
1175 this.Core.UnexpectedElement(node, child); 1171 this.Core.UnexpectedElement(node, child);
1176 break; 1172 break;
1177 } 1173 }
1178 } 1174 }
1179 else 1175 else
@@ -1203,7 +1199,7 @@ namespace WixToolset.Core
1203 // add a Class row for each context 1199 // add a Class row for each context
1204 if (!this.Core.EncounteredError) 1200 if (!this.Core.EncounteredError)
1205 { 1201 {
1206 foreach (string context in contexts) 1202 foreach (var context in contexts)
1207 { 1203 {
1208 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Class); 1204 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Class);
1209 row.Set(0, classId); 1205 row.Set(0, classId);
@@ -1262,7 +1258,7 @@ namespace WixToolset.Core
1262 } 1258 }
1263 1259
1264 // add the core registry keys for each context in the class 1260 // add the core registry keys for each context in the class
1265 foreach (string context in contexts) 1261 foreach (var context in contexts)
1266 { 1262 {
1267 if (context.StartsWith("InprocServer", StringComparison.Ordinal)) // dll server 1263 if (context.StartsWith("InprocServer", StringComparison.Ordinal)) // dll server
1268 { 1264 {
@@ -1338,19 +1334,19 @@ namespace WixToolset.Core
1338 { 1334 {
1339 switch (defaultInprocHandler) // ClassId Default Inproc Handler 1335 switch (defaultInprocHandler) // ClassId Default Inproc Handler
1340 { 1336 {
1341 case "1": 1337 case "1":
1342 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler"), String.Empty, "ole.dll", componentId); 1338 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler"), String.Empty, "ole.dll", componentId);
1343 break; 1339 break;
1344 case "2": 1340 case "2":
1345 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, "ole32.dll", componentId); 1341 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, "ole32.dll", componentId);
1346 break; 1342 break;
1347 case "3": 1343 case "3":
1348 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler"), String.Empty, "ole.dll", componentId); 1344 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler"), String.Empty, "ole.dll", componentId);
1349 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, "ole32.dll", componentId); 1345 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, "ole32.dll", componentId);
1350 break; 1346 break;
1351 default: 1347 default:
1352 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, defaultInprocHandler, componentId); 1348 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\InprocHandler32"), String.Empty, defaultInprocHandler, componentId);
1353 break; 1349 break;
1354 } 1350 }
1355 } 1351 }
1356 1352
@@ -1365,7 +1361,7 @@ namespace WixToolset.Core
1365 threadingModel = Compiler.UppercaseFirstChar(threadingModel); 1361 threadingModel = Compiler.UppercaseFirstChar(threadingModel);
1366 1362
1367 // add a threading model for each context in the class 1363 // add a threading model for each context in the class
1368 foreach (string context in contexts) 1364 foreach (var context in contexts)
1369 { 1365 {
1370 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", context), "ThreadingModel", threadingModel, componentId); 1366 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Concat("CLSID\\", classId, "\\", context), "ThreadingModel", threadingModel, componentId);
1371 } 1367 }
@@ -1421,43 +1417,43 @@ namespace WixToolset.Core
1421 /// <param name="typelibVersion">Version of the TypeLib to which this interface belongs. Required if typeLibId is specified</param> 1417 /// <param name="typelibVersion">Version of the TypeLib to which this interface belongs. Required if typeLibId is specified</param>
1422 private void ParseInterfaceElement(XElement node, string componentId, string proxyId, string proxyId32, string typeLibId, string typelibVersion) 1418 private void ParseInterfaceElement(XElement node, string componentId, string proxyId, string proxyId32, string typeLibId, string typelibVersion)
1423 { 1419 {
1424 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 1420 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
1425 string baseInterface = null; 1421 string baseInterface = null;
1426 string interfaceId = null; 1422 string interfaceId = null;
1427 string name = null; 1423 string name = null;
1428 int numMethods = CompilerConstants.IntegerNotSet; 1424 var numMethods = CompilerConstants.IntegerNotSet;
1429 bool versioned = true; 1425 var versioned = true;
1430 1426
1431 foreach (XAttribute attrib in node.Attributes()) 1427 foreach (var attrib in node.Attributes())
1432 { 1428 {
1433 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 1429 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
1434 { 1430 {
1435 switch (attrib.Name.LocalName) 1431 switch (attrib.Name.LocalName)
1436 { 1432 {
1437 case "Id": 1433 case "Id":
1438 interfaceId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 1434 interfaceId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
1439 break; 1435 break;
1440 case "BaseInterface": 1436 case "BaseInterface":
1441 baseInterface = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 1437 baseInterface = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
1442 break; 1438 break;
1443 case "Name": 1439 case "Name":
1444 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1440 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1445 break; 1441 break;
1446 case "NumMethods": 1442 case "NumMethods":
1447 numMethods = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 1443 numMethods = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
1448 break; 1444 break;
1449 case "ProxyStubClassId": 1445 case "ProxyStubClassId":
1450 proxyId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib); 1446 proxyId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib);
1451 break; 1447 break;
1452 case "ProxyStubClassId32": 1448 case "ProxyStubClassId32":
1453 proxyId32 = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 1449 proxyId32 = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
1454 break; 1450 break;
1455 case "Versioned": 1451 case "Versioned":
1456 versioned = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1452 versioned = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1457 break; 1453 break;
1458 default: 1454 default:
1459 this.Core.UnexpectedAttribute(node, attrib); 1455 this.Core.UnexpectedAttribute(node, attrib);
1460 break; 1456 break;
1461 } 1457 }
1462 } 1458 }
1463 else 1459 else
@@ -1516,30 +1512,30 @@ namespace WixToolset.Core
1516 /// <returns>String representing the file type mask elements.</returns> 1512 /// <returns>String representing the file type mask elements.</returns>
1517 private string ParseFileTypeMaskElement(XElement node) 1513 private string ParseFileTypeMaskElement(XElement node)
1518 { 1514 {
1519 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 1515 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
1520 int cb = 0; 1516 var cb = 0;
1521 int offset = CompilerConstants.IntegerNotSet; 1517 var offset = CompilerConstants.IntegerNotSet;
1522 string mask = null; 1518 string mask = null;
1523 string value = null; 1519 string value = null;
1524 1520
1525 foreach (XAttribute attrib in node.Attributes()) 1521 foreach (var attrib in node.Attributes())
1526 { 1522 {
1527 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 1523 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
1528 { 1524 {
1529 switch (attrib.Name.LocalName) 1525 switch (attrib.Name.LocalName)
1530 { 1526 {
1531 case "Mask": 1527 case "Mask":
1532 mask = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1528 mask = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1533 break; 1529 break;
1534 case "Offset": 1530 case "Offset":
1535 offset = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 1531 offset = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
1536 break; 1532 break;
1537 case "Value": 1533 case "Value":
1538 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1534 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1539 break; 1535 break;
1540 default: 1536 default:
1541 this.Core.UnexpectedAttribute(node, attrib); 1537 this.Core.UnexpectedAttribute(node, attrib);
1542 break; 1538 break;
1543 } 1539 }
1544 } 1540 }
1545 else 1541 else
@@ -1585,53 +1581,53 @@ namespace WixToolset.Core
1585 /// <returns>Signature for search element.</returns> 1581 /// <returns>Signature for search element.</returns>
1586 private void ParseProductSearchElement(XElement node, string propertyId) 1582 private void ParseProductSearchElement(XElement node, string propertyId)
1587 { 1583 {
1588 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 1584 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
1589 1585
1590 string upgradeCode = null; 1586 string upgradeCode = null;
1591 string language = null; 1587 string language = null;
1592 string maximum = null; 1588 string maximum = null;
1593 string minimum = null; 1589 string minimum = null;
1594 int options = MsiInterop.MsidbUpgradeAttributesVersionMinInclusive | MsiInterop.MsidbUpgradeAttributesOnlyDetect; 1590 var options = MsiInterop.MsidbUpgradeAttributesVersionMinInclusive | MsiInterop.MsidbUpgradeAttributesOnlyDetect;
1595 1591
1596 foreach (XAttribute attrib in node.Attributes()) 1592 foreach (var attrib in node.Attributes())
1597 { 1593 {
1598 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 1594 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
1599 { 1595 {
1600 switch (attrib.Name.LocalName) 1596 switch (attrib.Name.LocalName)
1601 { 1597 {
1602 case "ExcludeLanguages": 1598 case "ExcludeLanguages":
1603 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 1599 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
1604 { 1600 {
1605 options |= MsiInterop.MsidbUpgradeAttributesLanguagesExclusive; 1601 options |= MsiInterop.MsidbUpgradeAttributesLanguagesExclusive;
1606 } 1602 }
1607 break; 1603 break;
1608 case "IncludeMaximum": 1604 case "IncludeMaximum":
1609 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 1605 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
1610 { 1606 {
1611 options |= MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive; 1607 options |= MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive;
1612 } 1608 }
1613 break; 1609 break;
1614 case "IncludeMinimum": // this is "yes" by default 1610 case "IncludeMinimum": // this is "yes" by default
1615 if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 1611 if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
1616 { 1612 {
1617 options &= ~MsiInterop.MsidbUpgradeAttributesVersionMinInclusive; 1613 options &= ~MsiInterop.MsidbUpgradeAttributesVersionMinInclusive;
1618 } 1614 }
1619 break; 1615 break;
1620 case "Language": 1616 case "Language":
1621 language = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1617 language = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1622 break; 1618 break;
1623 case "Minimum": 1619 case "Minimum":
1624 minimum = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1620 minimum = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1625 break; 1621 break;
1626 case "Maximum": 1622 case "Maximum":
1627 maximum = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1623 maximum = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1628 break; 1624 break;
1629 case "UpgradeCode": 1625 case "UpgradeCode":
1630 upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 1626 upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
1631 break; 1627 break;
1632 default: 1628 default:
1633 this.Core.UnexpectedAttribute(node, attrib); 1629 this.Core.UnexpectedAttribute(node, attrib);
1634 break; 1630 break;
1635 } 1631 }
1636 } 1632 }
1637 else 1633 else
@@ -1666,63 +1662,63 @@ namespace WixToolset.Core
1666 /// <returns>Signature for search element.</returns> 1662 /// <returns>Signature for search element.</returns>
1667 private string ParseRegistrySearchElement(XElement node) 1663 private string ParseRegistrySearchElement(XElement node)
1668 { 1664 {
1669 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 1665 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
1670 bool explicitWin64 = false; 1666 var explicitWin64 = false;
1671 Identifier id = null; 1667 Identifier id = null;
1672 string key = null; 1668 string key = null;
1673 string name = null; 1669 string name = null;
1674 string signature = null; 1670 string signature = null;
1675 int root = CompilerConstants.IntegerNotSet; 1671 var root = CompilerConstants.IntegerNotSet;
1676 int type = CompilerConstants.IntegerNotSet; 1672 var type = CompilerConstants.IntegerNotSet;
1677 bool search64bit = false; 1673 var search64bit = false;
1678 1674
1679 foreach (XAttribute attrib in node.Attributes()) 1675 foreach (var attrib in node.Attributes())
1680 { 1676 {
1681 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 1677 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
1682 { 1678 {
1683 switch (attrib.Name.LocalName) 1679 switch (attrib.Name.LocalName)
1684 { 1680 {
1685 case "Id": 1681 case "Id":
1686 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 1682 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
1687 break; 1683 break;
1688 case "Key": 1684 case "Key":
1689 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1685 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1690 break; 1686 break;
1691 case "Name": 1687 case "Name":
1692 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1688 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1693 break; 1689 break;
1694 case "Root": 1690 case "Root":
1695 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, false); 1691 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, false);
1696 break; 1692 break;
1697 case "Type": 1693 case "Type":
1698 string typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 1694 var typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
1699 if (0 < typeValue.Length) 1695 if (0 < typeValue.Length)
1696 {
1697 var typeType = Wix.RegistrySearch.ParseTypeType(typeValue);
1698 switch (typeType)
1700 { 1699 {
1701 Wix.RegistrySearch.TypeType typeType = Wix.RegistrySearch.ParseTypeType(typeValue); 1700 case Wix.RegistrySearch.TypeType.directory:
1702 switch (typeType) 1701 type = 0;
1703 { 1702 break;
1704 case Wix.RegistrySearch.TypeType.directory: 1703 case Wix.RegistrySearch.TypeType.file:
1705 type = 0; 1704 type = 1;
1706 break; 1705 break;
1707 case Wix.RegistrySearch.TypeType.file: 1706 case Wix.RegistrySearch.TypeType.raw:
1708 type = 1; 1707 type = 2;
1709 break; 1708 break;
1710 case Wix.RegistrySearch.TypeType.raw: 1709 default:
1711 type = 2; 1710 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Type", typeValue, "directory", "file", "raw"));
1712 break; 1711 break;
1713 default:
1714 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Type", typeValue, "directory", "file", "raw"));
1715 break;
1716 }
1717 } 1712 }
1718 break; 1713 }
1719 case "Win64": 1714 break;
1720 explicitWin64 = true; 1715 case "Win64":
1721 search64bit = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1716 explicitWin64 = true;
1722 break; 1717 search64bit = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1723 default: 1718 break;
1724 this.Core.UnexpectedAttribute(node, attrib); 1719 default:
1725 break; 1720 this.Core.UnexpectedAttribute(node, attrib);
1721 break;
1726 } 1722 }
1727 } 1723 }
1728 else 1724 else
@@ -1757,53 +1753,53 @@ namespace WixToolset.Core
1757 } 1753 }
1758 1754
1759 signature = id.Id; 1755 signature = id.Id;
1760 bool oneChild = false; 1756 var oneChild = false;
1761 foreach (XElement child in node.Elements()) 1757 foreach (var child in node.Elements())
1762 { 1758 {
1763 if (CompilerCore.WixNamespace == child.Name.Namespace) 1759 if (CompilerCore.WixNamespace == child.Name.Namespace)
1764 { 1760 {
1765 switch (child.Name.LocalName) 1761 switch (child.Name.LocalName)
1766 { 1762 {
1767 case "DirectorySearch": 1763 case "DirectorySearch":
1768 if (oneChild) 1764 if (oneChild)
1769 { 1765 {
1770 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 1766 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
1771 } 1767 }
1772 oneChild = true; 1768 oneChild = true;
1773 1769
1774 // directorysearch parentage should work like directory element, not the rest of the signature type because of the DrLocator.Parent column 1770 // directorysearch parentage should work like directory element, not the rest of the signature type because of the DrLocator.Parent column
1775 signature = this.ParseDirectorySearchElement(child, id.Id); 1771 signature = this.ParseDirectorySearchElement(child, id.Id);
1776 break; 1772 break;
1777 case "DirectorySearchRef": 1773 case "DirectorySearchRef":
1778 if (oneChild) 1774 if (oneChild)
1779 { 1775 {
1780 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 1776 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
1781 } 1777 }
1782 oneChild = true; 1778 oneChild = true;
1783 signature = this.ParseDirectorySearchRefElement(child, id.Id); 1779 signature = this.ParseDirectorySearchRefElement(child, id.Id);
1784 break; 1780 break;
1785 case "FileSearch": 1781 case "FileSearch":
1786 if (oneChild) 1782 if (oneChild)
1787 { 1783 {
1788 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 1784 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
1789 } 1785 }
1790 oneChild = true; 1786 oneChild = true;
1791 signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet); 1787 signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet);
1792 id = new Identifier(signature, AccessModifier.Private); // FileSearch signatures override parent signatures 1788 id = new Identifier(signature, AccessModifier.Private); // FileSearch signatures override parent signatures
1793 break; 1789 break;
1794 case "FileSearchRef": 1790 case "FileSearchRef":
1795 if (oneChild) 1791 if (oneChild)
1796 { 1792 {
1797 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 1793 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
1798 } 1794 }
1799 oneChild = true; 1795 oneChild = true;
1800 string newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures 1796 var newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures
1801 id = new Identifier(newId, AccessModifier.Private); 1797 id = new Identifier(newId, AccessModifier.Private);
1802 signature = null; 1798 signature = null;
1803 break; 1799 break;
1804 default: 1800 default:
1805 this.Core.UnexpectedElement(node, child); 1801 this.Core.UnexpectedElement(node, child);
1806 break; 1802 break;
1807 } 1803 }
1808 } 1804 }
1809 else 1805 else
@@ -1832,22 +1828,22 @@ namespace WixToolset.Core
1832 /// <returns>Signature of referenced search element.</returns> 1828 /// <returns>Signature of referenced search element.</returns>
1833 private string ParseRegistrySearchRefElement(XElement node) 1829 private string ParseRegistrySearchRefElement(XElement node)
1834 { 1830 {
1835 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 1831 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
1836 string id = null; 1832 string id = null;
1837 1833
1838 foreach (XAttribute attrib in node.Attributes()) 1834 foreach (var attrib in node.Attributes())
1839 { 1835 {
1840 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 1836 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
1841 { 1837 {
1842 switch (attrib.Name.LocalName) 1838 switch (attrib.Name.LocalName)
1843 { 1839 {
1844 case "Id": 1840 case "Id":
1845 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 1841 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
1846 this.Core.CreateSimpleReference(sourceLineNumbers, "RegLocator", id); 1842 this.Core.CreateSimpleReference(sourceLineNumbers, "RegLocator", id);
1847 break; 1843 break;
1848 default: 1844 default:
1849 this.Core.UnexpectedAttribute(node, attrib); 1845 this.Core.UnexpectedAttribute(node, attrib);
1850 break; 1846 break;
1851 } 1847 }
1852 } 1848 }
1853 else 1849 else
@@ -1873,42 +1869,42 @@ namespace WixToolset.Core
1873 /// <returns>Returns list of string signatures.</returns> 1869 /// <returns>Returns list of string signatures.</returns>
1874 private List<string> ParseSearchSignatures(XElement node) 1870 private List<string> ParseSearchSignatures(XElement node)
1875 { 1871 {
1876 List<string> signatures = new List<string>(); 1872 var signatures = new List<string>();
1877 1873
1878 foreach (XElement child in node.Elements()) 1874 foreach (var child in node.Elements())
1879 { 1875 {
1880 string signature = null; 1876 string signature = null;
1881 if (CompilerCore.WixNamespace == child.Name.Namespace) 1877 if (CompilerCore.WixNamespace == child.Name.Namespace)
1882 { 1878 {
1883 switch (child.Name.LocalName) 1879 switch (child.Name.LocalName)
1884 { 1880 {
1885 case "ComplianceDrive": 1881 case "ComplianceDrive":
1886 signature = this.ParseComplianceDriveElement(child); 1882 signature = this.ParseComplianceDriveElement(child);
1887 break; 1883 break;
1888 case "ComponentSearch": 1884 case "ComponentSearch":
1889 signature = this.ParseComponentSearchElement(child); 1885 signature = this.ParseComponentSearchElement(child);
1890 break; 1886 break;
1891 case "DirectorySearch": 1887 case "DirectorySearch":
1892 signature = this.ParseDirectorySearchElement(child, String.Empty); 1888 signature = this.ParseDirectorySearchElement(child, String.Empty);
1893 break; 1889 break;
1894 case "DirectorySearchRef": 1890 case "DirectorySearchRef":
1895 signature = this.ParseDirectorySearchRefElement(child, String.Empty); 1891 signature = this.ParseDirectorySearchRefElement(child, String.Empty);
1896 break; 1892 break;
1897 case "IniFileSearch": 1893 case "IniFileSearch":
1898 signature = this.ParseIniFileSearchElement(child); 1894 signature = this.ParseIniFileSearchElement(child);
1899 break; 1895 break;
1900 case "ProductSearch": 1896 case "ProductSearch":
1901 // handled in ParsePropertyElement 1897 // handled in ParsePropertyElement
1902 break; 1898 break;
1903 case "RegistrySearch": 1899 case "RegistrySearch":
1904 signature = this.ParseRegistrySearchElement(child); 1900 signature = this.ParseRegistrySearchElement(child);
1905 break; 1901 break;
1906 case "RegistrySearchRef": 1902 case "RegistrySearchRef":
1907 signature = this.ParseRegistrySearchRefElement(child); 1903 signature = this.ParseRegistrySearchRefElement(child);
1908 break; 1904 break;
1909 default: 1905 default:
1910 this.Core.UnexpectedElement(node, child); 1906 this.Core.UnexpectedElement(node, child);
1911 break; 1907 break;
1912 } 1908 }
1913 } 1909 }
1914 else 1910 else
@@ -1933,36 +1929,36 @@ namespace WixToolset.Core
1933 /// <returns>Signature of nested search elements.</returns> 1929 /// <returns>Signature of nested search elements.</returns>
1934 private string ParseComplianceDriveElement(XElement node) 1930 private string ParseComplianceDriveElement(XElement node)
1935 { 1931 {
1936 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 1932 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
1937 string signature = null; 1933 string signature = null;
1938 1934
1939 bool oneChild = false; 1935 var oneChild = false;
1940 foreach (XElement child in node.Elements()) 1936 foreach (var child in node.Elements())
1941 { 1937 {
1942 if (CompilerCore.WixNamespace == child.Name.Namespace) 1938 if (CompilerCore.WixNamespace == child.Name.Namespace)
1943 { 1939 {
1944 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 1940 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
1945 switch (child.Name.LocalName) 1941 switch (child.Name.LocalName)
1946 { 1942 {
1947 case "DirectorySearch": 1943 case "DirectorySearch":
1948 if (oneChild) 1944 if (oneChild)
1949 { 1945 {
1950 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); 1946 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName));
1951 } 1947 }
1952 oneChild = true; 1948 oneChild = true;
1953 signature = this.ParseDirectorySearchElement(child, "CCP_DRIVE"); 1949 signature = this.ParseDirectorySearchElement(child, "CCP_DRIVE");
1954 break; 1950 break;
1955 case "DirectorySearchRef": 1951 case "DirectorySearchRef":
1956 if (oneChild) 1952 if (oneChild)
1957 { 1953 {
1958 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); 1954 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName));
1959 } 1955 }
1960 oneChild = true; 1956 oneChild = true;
1961 signature = this.ParseDirectorySearchRefElement(child, "CCP_DRIVE"); 1957 signature = this.ParseDirectorySearchRefElement(child, "CCP_DRIVE");
1962 break; 1958 break;
1963 default: 1959 default:
1964 this.Core.UnexpectedElement(node, child); 1960 this.Core.UnexpectedElement(node, child);
1965 break; 1961 break;
1966 } 1962 }
1967 } 1963 }
1968 else 1964 else
@@ -1985,17 +1981,17 @@ namespace WixToolset.Core
1985 /// <param name="node">Element to parse.</param> 1981 /// <param name="node">Element to parse.</param>
1986 private void ParseComplianceCheckElement(XElement node) 1982 private void ParseComplianceCheckElement(XElement node)
1987 { 1983 {
1988 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 1984 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
1989 1985
1990 foreach (XAttribute attrib in node.Attributes()) 1986 foreach (var attrib in node.Attributes())
1991 { 1987 {
1992 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 1988 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
1993 { 1989 {
1994 switch (attrib.Name.LocalName) 1990 switch (attrib.Name.LocalName)
1995 { 1991 {
1996 default: 1992 default:
1997 this.Core.UnexpectedAttribute(node, attrib); 1993 this.Core.UnexpectedAttribute(node, attrib);
1998 break; 1994 break;
1999 } 1995 }
2000 } 1996 }
2001 else 1997 else
@@ -2007,8 +2003,8 @@ namespace WixToolset.Core
2007 string signature = null; 2003 string signature = null;
2008 2004
2009 // see if this property is used for appSearch 2005 // see if this property is used for appSearch
2010 List<string> signatures = this.ParseSearchSignatures(node); 2006 var signatures = this.ParseSearchSignatures(node);
2011 foreach (string sig in signatures) 2007 foreach (var sig in signatures)
2012 { 2008 {
2013 // if we haven't picked a signature for this ComplianceCheck pick 2009 // if we haven't picked a signature for this ComplianceCheck pick
2014 // this one 2010 // this one
@@ -2048,137 +2044,137 @@ namespace WixToolset.Core
2048 [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 2044 [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
2049 private void ParseComponentElement(XElement node, ComplexReferenceParentType parentType, string parentId, string parentLanguage, int diskId, string directoryId, string srcPath) 2045 private void ParseComponentElement(XElement node, ComplexReferenceParentType parentType, string parentId, string parentLanguage, int diskId, string directoryId, string srcPath)
2050 { 2046 {
2051 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 2047 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
2052 2048
2053 int bits = 0; 2049 var bits = 0;
2054 int comPlusBits = CompilerConstants.IntegerNotSet; 2050 var comPlusBits = CompilerConstants.IntegerNotSet;
2055 string condition = null; 2051 string condition = null;
2056 bool encounteredODBCDataSource = false; 2052 var encounteredODBCDataSource = false;
2057 bool explicitWin64 = false; 2053 var explicitWin64 = false;
2058 int files = 0; 2054 var files = 0;
2059 string guid = "*"; 2055 var guid = "*";
2060 string componentIdPlaceholder = String.Format(Compiler.DefaultComponentIdPlaceholderFormat, this.componentIdPlaceholdersResolver.VariableCount); // placeholder id for defaulting Component/@Id to keypath id. 2056 var componentIdPlaceholder = String.Format(Compiler.DefaultComponentIdPlaceholderFormat, this.componentIdPlaceholdersResolver.VariableCount); // placeholder id for defaulting Component/@Id to keypath id.
2061 string componentIdPlaceholderWixVariable = String.Format(Compiler.DefaultComponentIdPlaceholderWixVariableFormat, componentIdPlaceholder); 2057 var componentIdPlaceholderWixVariable = String.Format(Compiler.DefaultComponentIdPlaceholderWixVariableFormat, componentIdPlaceholder);
2062 Identifier id = new Identifier(componentIdPlaceholderWixVariable, AccessModifier.Private); 2058 var id = new Identifier(componentIdPlaceholderWixVariable, AccessModifier.Private);
2063 int keyBits = 0; 2059 var keyBits = 0;
2064 bool keyFound = false; 2060 var keyFound = false;
2065 string keyPath = null; 2061 string keyPath = null;
2066 bool shouldAddCreateFolder = false; 2062 var shouldAddCreateFolder = false;
2067 bool win64 = false; 2063 var win64 = false;
2068 bool multiInstance = false; 2064 var multiInstance = false;
2069 List<string> symbols = new List<string>(); 2065 var symbols = new List<string>();
2070 string feature = null; 2066 string feature = null;
2071 2067
2072 foreach (XAttribute attrib in node.Attributes()) 2068 foreach (var attrib in node.Attributes())
2073 { 2069 {
2074 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 2070 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
2075 { 2071 {
2076 switch (attrib.Name.LocalName) 2072 switch (attrib.Name.LocalName)
2077 { 2073 {
2078 case "Id": 2074 case "Id":
2079 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 2075 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
2080 break; 2076 break;
2081 case "ComPlusFlags": 2077 case "ComPlusFlags":
2082 comPlusBits = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 2078 comPlusBits = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
2083 break; 2079 break;
2084 case "DisableRegistryReflection": 2080 case "DisableRegistryReflection":
2085 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 2081 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2086 { 2082 {
2087 bits |= MsiInterop.MsidbComponentAttributesDisableRegistryReflection; 2083 bits |= MsiInterop.MsidbComponentAttributesDisableRegistryReflection;
2088 } 2084 }
2089 break; 2085 break;
2090 case "Directory": 2086 case "Directory":
2091 directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId); 2087 directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId);
2092 break; 2088 break;
2093 case "DiskId": 2089 case "DiskId":
2094 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); 2090 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
2095 break; 2091 break;
2096 case "Feature": 2092 case "Feature":
2097 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2093 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2098 break; 2094 break;
2099 case "Guid": 2095 case "Guid":
2100 guid = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true, true); 2096 guid = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true, true);
2101 break; 2097 break;
2102 case "KeyPath": 2098 case "KeyPath":
2103 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 2099 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2104 { 2100 {
2105 keyFound = true; 2101 keyFound = true;
2106 keyPath = null; 2102 keyPath = null;
2107 keyBits = 0; 2103 keyBits = 0;
2108 shouldAddCreateFolder = true; 2104 shouldAddCreateFolder = true;
2109 } 2105 }
2110 break; 2106 break;
2111 case "Location": 2107 case "Location":
2112 string location = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 2108 var location = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
2113 if (0 < location.Length) 2109 if (0 < location.Length)
2114 { 2110 {
2115 Wix.Component.LocationType locationType = Wix.Component.ParseLocationType(location); 2111 var locationType = Wix.Component.ParseLocationType(location);
2116 switch (locationType) 2112 switch (locationType)
2117 {
2118 case Wix.Component.LocationType.either:
2119 bits |= MsiInterop.MsidbComponentAttributesOptional;
2120 break;
2121 case Wix.Component.LocationType.local: // this is the default
2122 break;
2123 case Wix.Component.LocationType.source:
2124 bits |= MsiInterop.MsidbComponentAttributesSourceOnly;
2125 break;
2126 default:
2127 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "either", "local", "source"));
2128 break;
2129 }
2130 }
2131 break;
2132 case "MultiInstance":
2133 multiInstance = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
2134 break;
2135 case "NeverOverwrite":
2136 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2137 {
2138 bits |= MsiInterop.MsidbComponentAttributesNeverOverwrite;
2139 }
2140 break;
2141 case "Permanent":
2142 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2143 {
2144 bits |= MsiInterop.MsidbComponentAttributesPermanent;
2145 }
2146 break;
2147 case "Shared":
2148 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2149 {
2150 bits |= MsiInterop.MsidbComponentAttributesShared;
2151 }
2152 break;
2153 case "SharedDllRefCount":
2154 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2155 {
2156 bits |= MsiInterop.MsidbComponentAttributesSharedDllRefCount;
2157 }
2158 break;
2159 case "Transitive":
2160 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2161 {
2162 bits |= MsiInterop.MsidbComponentAttributesTransitive;
2163 }
2164 break;
2165 case "UninstallWhenSuperseded":
2166 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2167 {
2168 bits |= MsiInterop.MsidbComponentAttributesUninstallOnSupersedence;
2169 }
2170 break;
2171 case "Win64":
2172 explicitWin64 = true;
2173 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2174 { 2113 {
2175 bits |= MsiInterop.MsidbComponentAttributes64bit; 2114 case Wix.Component.LocationType.either:
2176 win64 = true; 2115 bits |= MsiInterop.MsidbComponentAttributesOptional;
2116 break;
2117 case Wix.Component.LocationType.local: // this is the default
2118 break;
2119 case Wix.Component.LocationType.source:
2120 bits |= MsiInterop.MsidbComponentAttributesSourceOnly;
2121 break;
2122 default:
2123 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "either", "local", "source"));
2124 break;
2177 } 2125 }
2178 break; 2126 }
2179 default: 2127 break;
2180 this.Core.UnexpectedAttribute(node, attrib); 2128 case "MultiInstance":
2181 break; 2129 multiInstance = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
2130 break;
2131 case "NeverOverwrite":
2132 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2133 {
2134 bits |= MsiInterop.MsidbComponentAttributesNeverOverwrite;
2135 }
2136 break;
2137 case "Permanent":
2138 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2139 {
2140 bits |= MsiInterop.MsidbComponentAttributesPermanent;
2141 }
2142 break;
2143 case "Shared":
2144 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2145 {
2146 bits |= MsiInterop.MsidbComponentAttributesShared;
2147 }
2148 break;
2149 case "SharedDllRefCount":
2150 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2151 {
2152 bits |= MsiInterop.MsidbComponentAttributesSharedDllRefCount;
2153 }
2154 break;
2155 case "Transitive":
2156 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2157 {
2158 bits |= MsiInterop.MsidbComponentAttributesTransitive;
2159 }
2160 break;
2161 case "UninstallWhenSuperseded":
2162 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2163 {
2164 bits |= MsiInterop.MsidbComponentAttributesUninstallOnSupersedence;
2165 }
2166 break;
2167 case "Win64":
2168 explicitWin64 = true;
2169 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
2170 {
2171 bits |= MsiInterop.MsidbComponentAttributes64bit;
2172 win64 = true;
2173 }
2174 break;
2175 default:
2176 this.Core.UnexpectedAttribute(node, attrib);
2177 break;
2182 } 2178 }
2183 } 2179 }
2184 else 2180 else
@@ -2227,134 +2223,134 @@ namespace WixToolset.Core
2227 } 2223 }
2228 } 2224 }
2229 2225
2230 foreach (XElement child in node.Elements()) 2226 foreach (var child in node.Elements())
2231 { 2227 {
2232 YesNoType keyPathSet = YesNoType.NotSet; 2228 var keyPathSet = YesNoType.NotSet;
2233 string keyPossible = null; 2229 string keyPossible = null;
2234 int keyBit = 0; 2230 var keyBit = 0;
2235 2231
2236 if (CompilerCore.WixNamespace == child.Name.Namespace) 2232 if (CompilerCore.WixNamespace == child.Name.Namespace)
2237 { 2233 {
2238 switch (child.Name.LocalName) 2234 switch (child.Name.LocalName)
2239 { 2235 {
2240 case "AppId": 2236 case "AppId":
2241 this.ParseAppIdElement(child, id.Id, YesNoType.NotSet, null, null, null); 2237 this.ParseAppIdElement(child, id.Id, YesNoType.NotSet, null, null, null);
2242 break; 2238 break;
2243 case "Category": 2239 case "Category":
2244 this.ParseCategoryElement(child, id.Id); 2240 this.ParseCategoryElement(child, id.Id);
2245 break; 2241 break;
2246 case "Class": 2242 case "Class":
2247 this.ParseClassElement(child, id.Id, YesNoType.NotSet, null, null, null, null); 2243 this.ParseClassElement(child, id.Id, YesNoType.NotSet, null, null, null, null);
2248 break; 2244 break;
2249 case "Condition": 2245 case "Condition":
2250 if (null != condition) 2246 if (null != condition)
2251 { 2247 {
2252 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 2248 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
2253 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); 2249 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName));
2254 } 2250 }
2255 condition = this.ParseConditionElement(child, node.Name.LocalName, null, null); 2251 condition = this.ParseConditionElement(child, node.Name.LocalName, null, null);
2256 break; 2252 break;
2257 case "CopyFile": 2253 case "CopyFile":
2258 this.ParseCopyFileElement(child, id.Id, null); 2254 this.ParseCopyFileElement(child, id.Id, null);
2259 break; 2255 break;
2260 case "CreateFolder": 2256 case "CreateFolder":
2261 string createdFolder = this.ParseCreateFolderElement(child, id.Id, directoryId, win64); 2257 var createdFolder = this.ParseCreateFolderElement(child, id.Id, directoryId, win64);
2262 if (directoryId == createdFolder) 2258 if (directoryId == createdFolder)
2263 { 2259 {
2264 shouldAddCreateFolder = false; 2260 shouldAddCreateFolder = false;
2265 } 2261 }
2266 break; 2262 break;
2267 case "Environment": 2263 case "Environment":
2268 this.ParseEnvironmentElement(child, id.Id); 2264 this.ParseEnvironmentElement(child, id.Id);
2269 break; 2265 break;
2270 case "Extension": 2266 case "Extension":
2271 this.ParseExtensionElement(child, id.Id, YesNoType.NotSet, null); 2267 this.ParseExtensionElement(child, id.Id, YesNoType.NotSet, null);
2272 break; 2268 break;
2273 case "File": 2269 case "File":
2274 keyPathSet = this.ParseFileElement(child, id.Id, directoryId, diskId, srcPath, out keyPossible, win64, guid); 2270 keyPathSet = this.ParseFileElement(child, id.Id, directoryId, diskId, srcPath, out keyPossible, win64, guid);
2275 if (null != keyPossible) 2271 if (null != keyPossible)
2276 { 2272 {
2277 keyBit = 0; 2273 keyBit = 0;
2278 } 2274 }
2279 files++; 2275 files++;
2280 break; 2276 break;
2281 case "IniFile": 2277 case "IniFile":
2282 this.ParseIniFileElement(child, id.Id); 2278 this.ParseIniFileElement(child, id.Id);
2283 break; 2279 break;
2284 case "Interface": 2280 case "Interface":
2285 this.ParseInterfaceElement(child, id.Id, null, null, null, null); 2281 this.ParseInterfaceElement(child, id.Id, null, null, null, null);
2286 break; 2282 break;
2287 case "IsolateComponent": 2283 case "IsolateComponent":
2288 this.ParseIsolateComponentElement(child, id.Id); 2284 this.ParseIsolateComponentElement(child, id.Id);
2289 break; 2285 break;
2290 case "ODBCDataSource": 2286 case "ODBCDataSource":
2291 keyPathSet = this.ParseODBCDataSource(child, id.Id, null, out keyPossible); 2287 keyPathSet = this.ParseODBCDataSource(child, id.Id, null, out keyPossible);
2292 keyBit = MsiInterop.MsidbComponentAttributesODBCDataSource; 2288 keyBit = MsiInterop.MsidbComponentAttributesODBCDataSource;
2293 encounteredODBCDataSource = true; 2289 encounteredODBCDataSource = true;
2294 break; 2290 break;
2295 case "ODBCDriver": 2291 case "ODBCDriver":
2296 this.ParseODBCDriverOrTranslator(child, id.Id, null, TupleDefinitionType.ODBCDriver); 2292 this.ParseODBCDriverOrTranslator(child, id.Id, null, TupleDefinitionType.ODBCDriver);
2297 break; 2293 break;
2298 case "ODBCTranslator": 2294 case "ODBCTranslator":
2299 this.ParseODBCDriverOrTranslator(child, id.Id, null, TupleDefinitionType.ODBCTranslator); 2295 this.ParseODBCDriverOrTranslator(child, id.Id, null, TupleDefinitionType.ODBCTranslator);
2300 break; 2296 break;
2301 case "ProgId": 2297 case "ProgId":
2302 bool foundExtension = false; 2298 var foundExtension = false;
2303 this.ParseProgIdElement(child, id.Id, YesNoType.NotSet, null, null, null, ref foundExtension, YesNoType.NotSet); 2299 this.ParseProgIdElement(child, id.Id, YesNoType.NotSet, null, null, null, ref foundExtension, YesNoType.NotSet);
2304 break; 2300 break;
2305 case "RegistryKey": 2301 case "RegistryKey":
2306 keyPathSet = this.ParseRegistryKeyElement(child, id.Id, CompilerConstants.IntegerNotSet, null, win64, out keyPossible); 2302 keyPathSet = this.ParseRegistryKeyElement(child, id.Id, CompilerConstants.IntegerNotSet, null, win64, out keyPossible);
2307 keyBit = MsiInterop.MsidbComponentAttributesRegistryKeyPath; 2303 keyBit = MsiInterop.MsidbComponentAttributesRegistryKeyPath;
2308 break; 2304 break;
2309 case "RegistryValue": 2305 case "RegistryValue":
2310 keyPathSet = this.ParseRegistryValueElement(child, id.Id, CompilerConstants.IntegerNotSet, null, win64, out keyPossible); 2306 keyPathSet = this.ParseRegistryValueElement(child, id.Id, CompilerConstants.IntegerNotSet, null, win64, out keyPossible);
2311 keyBit = MsiInterop.MsidbComponentAttributesRegistryKeyPath; 2307 keyBit = MsiInterop.MsidbComponentAttributesRegistryKeyPath;
2312 break; 2308 break;
2313 case "RemoveFile": 2309 case "RemoveFile":
2314 this.ParseRemoveFileElement(child, id.Id, directoryId); 2310 this.ParseRemoveFileElement(child, id.Id, directoryId);
2315 break; 2311 break;
2316 case "RemoveFolder": 2312 case "RemoveFolder":
2317 this.ParseRemoveFolderElement(child, id.Id, directoryId); 2313 this.ParseRemoveFolderElement(child, id.Id, directoryId);
2318 break; 2314 break;
2319 case "RemoveRegistryKey": 2315 case "RemoveRegistryKey":
2320 this.ParseRemoveRegistryKeyElement(child, id.Id); 2316 this.ParseRemoveRegistryKeyElement(child, id.Id);
2321 break; 2317 break;
2322 case "RemoveRegistryValue": 2318 case "RemoveRegistryValue":
2323 this.ParseRemoveRegistryValueElement(child, id.Id); 2319 this.ParseRemoveRegistryValueElement(child, id.Id);
2324 break; 2320 break;
2325 case "ReserveCost": 2321 case "ReserveCost":
2326 this.ParseReserveCostElement(child, id.Id, directoryId); 2322 this.ParseReserveCostElement(child, id.Id, directoryId);
2327 break; 2323 break;
2328 case "ServiceConfig": 2324 case "ServiceConfig":
2329 this.ParseServiceConfigElement(child, id.Id, null); 2325 this.ParseServiceConfigElement(child, id.Id, null);
2330 break; 2326 break;
2331 case "ServiceConfigFailureActions": 2327 case "ServiceConfigFailureActions":
2332 this.ParseServiceConfigFailureActionsElement(child, id.Id, null); 2328 this.ParseServiceConfigFailureActionsElement(child, id.Id, null);
2333 break; 2329 break;
2334 case "ServiceControl": 2330 case "ServiceControl":
2335 this.ParseServiceControlElement(child, id.Id); 2331 this.ParseServiceControlElement(child, id.Id);
2336 break; 2332 break;
2337 case "ServiceInstall": 2333 case "ServiceInstall":
2338 this.ParseServiceInstallElement(child, id.Id, win64); 2334 this.ParseServiceInstallElement(child, id.Id, win64);
2339 break; 2335 break;
2340 case "Shortcut": 2336 case "Shortcut":
2341 this.ParseShortcutElement(child, id.Id, node.Name.LocalName, directoryId, YesNoType.No); 2337 this.ParseShortcutElement(child, id.Id, node.Name.LocalName, directoryId, YesNoType.No);
2342 break; 2338 break;
2343 case "SymbolPath": 2339 case "SymbolPath":
2344 symbols.Add(this.ParseSymbolPathElement(child)); 2340 symbols.Add(this.ParseSymbolPathElement(child));
2345 break; 2341 break;
2346 case "TypeLib": 2342 case "TypeLib":
2347 this.ParseTypeLibElement(child, id.Id, null, win64); 2343 this.ParseTypeLibElement(child, id.Id, null, win64);
2348 break; 2344 break;
2349 default: 2345 default:
2350 this.Core.UnexpectedElement(node, child); 2346 this.Core.UnexpectedElement(node, child);
2351 break; 2347 break;
2352 } 2348 }
2353 } 2349 }
2354 else 2350 else
2355 { 2351 {
2356 Dictionary<string, string> context = new Dictionary<string, string>() { { "ComponentId", id.Id }, { "DirectoryId", directoryId }, { "Win64", win64.ToString() }, }; 2352 var context = new Dictionary<string, string>() { { "ComponentId", id.Id }, { "DirectoryId", directoryId }, { "Win64", win64.ToString() }, };
2357 ComponentKeyPath possibleKeyPath = this.Core.ParsePossibleKeyPathExtensionElement(node, child, context); 2353 var possibleKeyPath = this.Core.ParsePossibleKeyPathExtensionElement(node, child, context);
2358 if (null != possibleKeyPath) 2354 if (null != possibleKeyPath)
2359 { 2355 {
2360 if (ComponentKeyPathType.None == possibleKeyPath.Type) 2356 if (ComponentKeyPathType.None == possibleKeyPath.Type)
@@ -2407,7 +2403,7 @@ namespace WixToolset.Core
2407 } 2403 }
2408 2404
2409 // check for conditions that exclude this component from using generated guids 2405 // check for conditions that exclude this component from using generated guids
2410 bool isGeneratableGuidOk = "*" == guid; 2406 var isGeneratableGuidOk = "*" == guid;
2411 if (isGeneratableGuidOk) 2407 if (isGeneratableGuidOk)
2412 { 2408 {
2413 if (encounteredODBCDataSource) 2409 if (encounteredODBCDataSource)
@@ -2501,31 +2497,31 @@ namespace WixToolset.Core
2501 [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 2497 [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
2502 private void ParseComponentGroupElement(XElement node, ComplexReferenceParentType parentType, string parentId) 2498 private void ParseComponentGroupElement(XElement node, ComplexReferenceParentType parentType, string parentId)
2503 { 2499 {
2504 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 2500 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
2505 Identifier id = null; 2501 Identifier id = null;
2506 string directoryId = null; 2502 string directoryId = null;
2507 string source = null; 2503 string source = null;
2508 2504
2509 foreach (XAttribute attrib in node.Attributes()) 2505 foreach (var attrib in node.Attributes())
2510 { 2506 {
2511 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 2507 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
2512 { 2508 {
2513 switch (attrib.Name.LocalName) 2509 switch (attrib.Name.LocalName)
2514 { 2510 {
2515 case "Id": 2511 case "Id":
2516 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 2512 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
2517 break; 2513 break;
2518 case "Directory": 2514 case "Directory":
2519 // If the inline syntax is invalid it returns null. Use a static error identifier so the null 2515 // If the inline syntax is invalid it returns null. Use a static error identifier so the null
2520 // directory identifier here doesn't trickle down false errors into child elements. 2516 // directory identifier here doesn't trickle down false errors into child elements.
2521 directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null) ?? "ErrorParsingInlineSyntax"; 2517 directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null) ?? "ErrorParsingInlineSyntax";
2522 break; 2518 break;
2523 case "Source": 2519 case "Source":
2524 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 2520 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
2525 break; 2521 break;
2526 default: 2522 default:
2527 this.Core.UnexpectedAttribute(node, attrib); 2523 this.Core.UnexpectedAttribute(node, attrib);
2528 break; 2524 break;
2529 } 2525 }
2530 } 2526 }
2531 else 2527 else
@@ -2545,24 +2541,24 @@ namespace WixToolset.Core
2545 source = String.Concat(source, Path.DirectorySeparatorChar); 2541 source = String.Concat(source, Path.DirectorySeparatorChar);
2546 } 2542 }
2547 2543
2548 foreach (XElement child in node.Elements()) 2544 foreach (var child in node.Elements())
2549 { 2545 {
2550 if (CompilerCore.WixNamespace == child.Name.Namespace) 2546 if (CompilerCore.WixNamespace == child.Name.Namespace)
2551 { 2547 {
2552 switch (child.Name.LocalName) 2548 switch (child.Name.LocalName)
2553 { 2549 {
2554 case "ComponentGroupRef": 2550 case "ComponentGroupRef":
2555 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.ComponentGroup, id.Id, null); 2551 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.ComponentGroup, id.Id, null);
2556 break; 2552 break;
2557 case "ComponentRef": 2553 case "ComponentRef":
2558 this.ParseComponentRefElement(child, ComplexReferenceParentType.ComponentGroup, id.Id, null); 2554 this.ParseComponentRefElement(child, ComplexReferenceParentType.ComponentGroup, id.Id, null);
2559 break; 2555 break;
2560 case "Component": 2556 case "Component":
2561 this.ParseComponentElement(child, ComplexReferenceParentType.ComponentGroup, id.Id, null, CompilerConstants.IntegerNotSet, directoryId, source); 2557 this.ParseComponentElement(child, ComplexReferenceParentType.ComponentGroup, id.Id, null, CompilerConstants.IntegerNotSet, directoryId, source);
2562 break; 2558 break;
2563 default: 2559 default:
2564 this.Core.UnexpectedElement(node, child); 2560 this.Core.UnexpectedElement(node, child);
2565 break; 2561 break;
2566 } 2562 }
2567 } 2563 }
2568 else 2564 else
@@ -2591,26 +2587,26 @@ namespace WixToolset.Core
2591 { 2587 {
2592 Debug.Assert(ComplexReferenceParentType.ComponentGroup == parentType || ComplexReferenceParentType.FeatureGroup == parentType || ComplexReferenceParentType.Feature == parentType || ComplexReferenceParentType.Module == parentType); 2588 Debug.Assert(ComplexReferenceParentType.ComponentGroup == parentType || ComplexReferenceParentType.FeatureGroup == parentType || ComplexReferenceParentType.Feature == parentType || ComplexReferenceParentType.Module == parentType);
2593 2589
2594 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 2590 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
2595 string id = null; 2591 string id = null;
2596 YesNoType primary = YesNoType.NotSet; 2592 var primary = YesNoType.NotSet;
2597 2593
2598 foreach (XAttribute attrib in node.Attributes()) 2594 foreach (var attrib in node.Attributes())
2599 { 2595 {
2600 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 2596 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
2601 { 2597 {
2602 switch (attrib.Name.LocalName) 2598 switch (attrib.Name.LocalName)
2603 { 2599 {
2604 case "Id": 2600 case "Id":
2605 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2601 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2606 this.Core.CreateSimpleReference(sourceLineNumbers, "WixComponentGroup", id); 2602 this.Core.CreateSimpleReference(sourceLineNumbers, "WixComponentGroup", id);
2607 break; 2603 break;
2608 case "Primary": 2604 case "Primary":
2609 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 2605 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
2610 break; 2606 break;
2611 default: 2607 default:
2612 this.Core.UnexpectedAttribute(node, attrib); 2608 this.Core.UnexpectedAttribute(node, attrib);
2613 break; 2609 break;
2614 } 2610 }
2615 } 2611 }
2616 else 2612 else
@@ -2640,26 +2636,26 @@ namespace WixToolset.Core
2640 { 2636 {
2641 Debug.Assert(ComplexReferenceParentType.FeatureGroup == parentType || ComplexReferenceParentType.ComponentGroup == parentType || ComplexReferenceParentType.Feature == parentType || ComplexReferenceParentType.Module == parentType); 2637 Debug.Assert(ComplexReferenceParentType.FeatureGroup == parentType || ComplexReferenceParentType.ComponentGroup == parentType || ComplexReferenceParentType.Feature == parentType || ComplexReferenceParentType.Module == parentType);
2642 2638
2643 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 2639 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
2644 string id = null; 2640 string id = null;
2645 YesNoType primary = YesNoType.NotSet; 2641 var primary = YesNoType.NotSet;
2646 2642
2647 foreach (XAttribute attrib in node.Attributes()) 2643 foreach (var attrib in node.Attributes())
2648 { 2644 {
2649 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 2645 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
2650 { 2646 {
2651 switch (attrib.Name.LocalName) 2647 switch (attrib.Name.LocalName)
2652 { 2648 {
2653 case "Id": 2649 case "Id":
2654 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2650 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2655 this.Core.CreateSimpleReference(sourceLineNumbers, "Component", id); 2651 this.Core.CreateSimpleReference(sourceLineNumbers, "Component", id);
2656 break; 2652 break;
2657 case "Primary": 2653 case "Primary":
2658 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 2654 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
2659 break; 2655 break;
2660 default: 2656 default:
2661 this.Core.UnexpectedAttribute(node, attrib); 2657 this.Core.UnexpectedAttribute(node, attrib);
2662 break; 2658 break;
2663 } 2659 }
2664 } 2660 }
2665 else 2661 else
@@ -2685,46 +2681,46 @@ namespace WixToolset.Core
2685 /// <returns>Signature for search element.</returns> 2681 /// <returns>Signature for search element.</returns>
2686 private string ParseComponentSearchElement(XElement node) 2682 private string ParseComponentSearchElement(XElement node)
2687 { 2683 {
2688 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 2684 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
2689 Identifier id = null; 2685 Identifier id = null;
2690 string componentId = null; 2686 string componentId = null;
2691 int type = MsiInterop.MsidbLocatorTypeFileName; 2687 var type = MsiInterop.MsidbLocatorTypeFileName;
2692 string signature = null; 2688 string signature = null;
2693 2689
2694 foreach (XAttribute attrib in node.Attributes()) 2690 foreach (var attrib in node.Attributes())
2695 { 2691 {
2696 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 2692 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
2697 { 2693 {
2698 switch (attrib.Name.LocalName) 2694 switch (attrib.Name.LocalName)
2699 { 2695 {
2700 case "Id": 2696 case "Id":
2701 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 2697 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
2702 break; 2698 break;
2703 case "Guid": 2699 case "Guid":
2704 componentId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 2700 componentId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
2705 break; 2701 break;
2706 case "Type": 2702 case "Type":
2707 string typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 2703 var typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
2708 if (0 < typeValue.Length) 2704 if (0 < typeValue.Length)
2705 {
2706 var typeType = Wix.ComponentSearch.ParseTypeType(typeValue);
2707 switch (typeType)
2709 { 2708 {
2710 Wix.ComponentSearch.TypeType typeType = Wix.ComponentSearch.ParseTypeType(typeValue); 2709 case Wix.ComponentSearch.TypeType.directory:
2711 switch (typeType) 2710 type = MsiInterop.MsidbLocatorTypeDirectory;
2712 { 2711 break;
2713 case Wix.ComponentSearch.TypeType.directory: 2712 case Wix.ComponentSearch.TypeType.file:
2714 type = MsiInterop.MsidbLocatorTypeDirectory; 2713 type = MsiInterop.MsidbLocatorTypeFileName;
2715 break; 2714 break;
2716 case Wix.ComponentSearch.TypeType.file: 2715 default:
2717 type = MsiInterop.MsidbLocatorTypeFileName; 2716 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typeValue, "directory", "file"));
2718 break; 2717 break;
2719 default:
2720 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typeValue, "directory", "file"));
2721 break;
2722 }
2723 } 2718 }
2724 break; 2719 }
2725 default: 2720 break;
2726 this.Core.UnexpectedAttribute(node, attrib); 2721 default:
2727 break; 2722 this.Core.UnexpectedAttribute(node, attrib);
2723 break;
2728 } 2724 }
2729 } 2725 }
2730 else 2726 else
@@ -2739,53 +2735,53 @@ namespace WixToolset.Core
2739 } 2735 }
2740 2736
2741 signature = id.Id; 2737 signature = id.Id;
2742 bool oneChild = false; 2738 var oneChild = false;
2743 foreach (XElement child in node.Elements()) 2739 foreach (var child in node.Elements())
2744 { 2740 {
2745 if (CompilerCore.WixNamespace == child.Name.Namespace) 2741 if (CompilerCore.WixNamespace == child.Name.Namespace)
2746 { 2742 {
2747 switch (child.Name.LocalName) 2743 switch (child.Name.LocalName)
2748 { 2744 {
2749 case "DirectorySearch": 2745 case "DirectorySearch":
2750 if (oneChild) 2746 if (oneChild)
2751 { 2747 {
2752 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 2748 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
2753 } 2749 }
2754 oneChild = true; 2750 oneChild = true;
2755 2751
2756 // directorysearch parentage should work like directory element, not the rest of the signature type because of the DrLocator.Parent column 2752 // directorysearch parentage should work like directory element, not the rest of the signature type because of the DrLocator.Parent column
2757 signature = this.ParseDirectorySearchElement(child, id.Id); 2753 signature = this.ParseDirectorySearchElement(child, id.Id);
2758 break; 2754 break;
2759 case "DirectorySearchRef": 2755 case "DirectorySearchRef":
2760 if (oneChild) 2756 if (oneChild)
2761 { 2757 {
2762 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 2758 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
2763 } 2759 }
2764 oneChild = true; 2760 oneChild = true;
2765 signature = this.ParseDirectorySearchRefElement(child, id.Id); 2761 signature = this.ParseDirectorySearchRefElement(child, id.Id);
2766 break; 2762 break;
2767 case "FileSearch": 2763 case "FileSearch":
2768 if (oneChild) 2764 if (oneChild)
2769 { 2765 {
2770 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 2766 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
2771 } 2767 }
2772 oneChild = true; 2768 oneChild = true;
2773 signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet); 2769 signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet);
2774 id = new Identifier(signature, AccessModifier.Private); // FileSearch signatures override parent signatures 2770 id = new Identifier(signature, AccessModifier.Private); // FileSearch signatures override parent signatures
2775 break; 2771 break;
2776 case "FileSearchRef": 2772 case "FileSearchRef":
2777 if (oneChild) 2773 if (oneChild)
2778 { 2774 {
2779 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 2775 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
2780 } 2776 }
2781 oneChild = true; 2777 oneChild = true;
2782 string newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures 2778 var newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures
2783 id = new Identifier(newId, AccessModifier.Private); 2779 id = new Identifier(newId, AccessModifier.Private);
2784 signature = null; 2780 signature = null;
2785 break; 2781 break;
2786 default: 2782 default:
2787 this.Core.UnexpectedElement(node, child); 2783 this.Core.UnexpectedElement(node, child);
2788 break; 2784 break;
2789 } 2785 }
2790 } 2786 }
2791 else 2787 else
@@ -2814,19 +2810,19 @@ namespace WixToolset.Core
2814 /// <returns>Identifier for the directory that will be created</returns> 2810 /// <returns>Identifier for the directory that will be created</returns>
2815 private string ParseCreateFolderElement(XElement node, string componentId, string directoryId, bool win64Component) 2811 private string ParseCreateFolderElement(XElement node, string componentId, string directoryId, bool win64Component)
2816 { 2812 {
2817 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 2813 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
2818 foreach (XAttribute attrib in node.Attributes()) 2814 foreach (var attrib in node.Attributes())
2819 { 2815 {
2820 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 2816 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
2821 { 2817 {
2822 switch (attrib.Name.LocalName) 2818 switch (attrib.Name.LocalName)
2823 { 2819 {
2824 case "Directory": 2820 case "Directory":
2825 directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId); 2821 directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId);
2826 break; 2822 break;
2827 default: 2823 default:
2828 this.Core.UnexpectedAttribute(node, attrib); 2824 this.Core.UnexpectedAttribute(node, attrib);
2829 break; 2825 break;
2830 } 2826 }
2831 } 2827 }
2832 else 2828 else
@@ -2835,29 +2831,29 @@ namespace WixToolset.Core
2835 } 2831 }
2836 } 2832 }
2837 2833
2838 foreach (XElement child in node.Elements()) 2834 foreach (var child in node.Elements())
2839 { 2835 {
2840 if (CompilerCore.WixNamespace == child.Name.Namespace) 2836 if (CompilerCore.WixNamespace == child.Name.Namespace)
2841 { 2837 {
2842 switch (child.Name.LocalName) 2838 switch (child.Name.LocalName)
2843 { 2839 {
2844 case "Shortcut": 2840 case "Shortcut":
2845 this.ParseShortcutElement(child, componentId, node.Name.LocalName, directoryId, YesNoType.No); 2841 this.ParseShortcutElement(child, componentId, node.Name.LocalName, directoryId, YesNoType.No);
2846 break; 2842 break;
2847 case "Permission": 2843 case "Permission":
2848 this.ParsePermissionElement(child, directoryId, "CreateFolder"); 2844 this.ParsePermissionElement(child, directoryId, "CreateFolder");
2849 break; 2845 break;
2850 case "PermissionEx": 2846 case "PermissionEx":
2851 this.ParsePermissionExElement(child, directoryId, "CreateFolder"); 2847 this.ParsePermissionExElement(child, directoryId, "CreateFolder");
2852 break; 2848 break;
2853 default: 2849 default:
2854 this.Core.UnexpectedElement(node, child); 2850 this.Core.UnexpectedElement(node, child);
2855 break; 2851 break;
2856 } 2852 }
2857 } 2853 }
2858 else 2854 else
2859 { 2855 {
2860 Dictionary<string, string> context = new Dictionary<string, string>() { { "DirectoryId", directoryId }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } }; 2856 var context = new Dictionary<string, string>() { { "DirectoryId", directoryId }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } };
2861 this.Core.ParseExtensionElement(node, child, context); 2857 this.Core.ParseExtensionElement(node, child, context);
2862 } 2858 }
2863 } 2859 }
@@ -2880,9 +2876,9 @@ namespace WixToolset.Core
2880 /// <param name="fileId">Identifier of file to copy (null if moving the file).</param> 2876 /// <param name="fileId">Identifier of file to copy (null if moving the file).</param>
2881 private void ParseCopyFileElement(XElement node, string componentId, string fileId) 2877 private void ParseCopyFileElement(XElement node, string componentId, string fileId)
2882 { 2878 {
2883 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 2879 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
2884 Identifier id = null; 2880 Identifier id = null;
2885 bool delete = false; 2881 var delete = false;
2886 string destinationDirectory = null; 2882 string destinationDirectory = null;
2887 string destinationName = null; 2883 string destinationName = null;
2888 string destinationShortName = null; 2884 string destinationShortName = null;
@@ -2892,50 +2888,50 @@ namespace WixToolset.Core
2892 string sourceName = null; 2888 string sourceName = null;
2893 string sourceProperty = null; 2889 string sourceProperty = null;
2894 2890
2895 foreach (XAttribute attrib in node.Attributes()) 2891 foreach (var attrib in node.Attributes())
2896 { 2892 {
2897 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 2893 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
2898 { 2894 {
2899 switch (attrib.Name.LocalName) 2895 switch (attrib.Name.LocalName)
2900 { 2896 {
2901 case "Id": 2897 case "Id":
2902 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 2898 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
2903 break; 2899 break;
2904 case "Delete": 2900 case "Delete":
2905 delete = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 2901 delete = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
2906 break; 2902 break;
2907 case "DestinationDirectory": 2903 case "DestinationDirectory":
2908 destinationDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); 2904 destinationDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null);
2909 break; 2905 break;
2910 case "DestinationName": 2906 case "DestinationName":
2911 destinationName = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); 2907 destinationName = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
2912 break; 2908 break;
2913 case "DestinationProperty": 2909 case "DestinationProperty":
2914 destinationProperty = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2910 destinationProperty = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2915 break; 2911 break;
2916 case "DestinationShortName": 2912 case "DestinationShortName":
2917 destinationShortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); 2913 destinationShortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
2918 break; 2914 break;
2919 case "FileId": 2915 case "FileId":
2920 if (null != fileId) 2916 if (null != fileId)
2921 { 2917 {
2922 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); 2918 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName));
2923 } 2919 }
2924 fileId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2920 fileId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2925 this.Core.CreateSimpleReference(sourceLineNumbers, "File", fileId); 2921 this.Core.CreateSimpleReference(sourceLineNumbers, "File", fileId);
2926 break; 2922 break;
2927 case "SourceDirectory": 2923 case "SourceDirectory":
2928 sourceDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); 2924 sourceDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null);
2929 break; 2925 break;
2930 case "SourceName": 2926 case "SourceName":
2931 sourceName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 2927 sourceName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
2932 break; 2928 break;
2933 case "SourceProperty": 2929 case "SourceProperty":
2934 sourceProperty = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 2930 sourceProperty = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
2935 break; 2931 break;
2936 default: 2932 default:
2937 this.Core.UnexpectedAttribute(node, attrib); 2933 this.Core.UnexpectedAttribute(node, attrib);
2938 break; 2934 break;
2939 } 2935 }
2940 } 2936 }
2941 else 2937 else
@@ -2990,7 +2986,7 @@ namespace WixToolset.Core
2990 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MoveFile, id); 2986 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.MoveFile, id);
2991 row.Set(1, componentId); 2987 row.Set(1, componentId);
2992 row.Set(2, sourceName); 2988 row.Set(2, sourceName);
2993 row.Set(3, String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : GetMsiFilenameValue(destinationShortName, destinationName)); 2989 row.Set(3, String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName));
2994 if (null != sourceDirectory) 2990 if (null != sourceDirectory)
2995 { 2991 {
2996 row.Set(4, sourceDirectory); 2992 row.Set(4, sourceDirectory);
@@ -3052,7 +3048,7 @@ namespace WixToolset.Core
3052 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.DuplicateFile, id); 3048 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.DuplicateFile, id);
3053 row.Set(1, componentId); 3049 row.Set(1, componentId);
3054 row.Set(2, fileId); 3050 row.Set(2, fileId);
3055 row.Set(3, String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : GetMsiFilenameValue(destinationShortName, destinationName)); 3051 row.Set(3, String.IsNullOrEmpty(destinationShortName) && String.IsNullOrEmpty(destinationName) ? null : this.GetMsiFilenameValue(destinationShortName, destinationName));
3056 if (null != destinationDirectory) 3052 if (null != destinationDirectory)
3057 { 3053 {
3058 row.Set(4, destinationDirectory); 3054 row.Set(4, destinationDirectory);
@@ -3071,264 +3067,264 @@ namespace WixToolset.Core
3071 /// <param name="node">Element to parse.</param> 3067 /// <param name="node">Element to parse.</param>
3072 private void ParseCustomActionElement(XElement node) 3068 private void ParseCustomActionElement(XElement node)
3073 { 3069 {
3074 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 3070 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3075 Identifier id = null; 3071 Identifier id = null;
3076 int bits = 0; 3072 var bits = 0;
3077 int extendedBits = 0; 3073 var extendedBits = 0;
3078 bool inlineScript = false; 3074 var inlineScript = false;
3079 string innerText = null; 3075 string innerText = null;
3080 string source = null; 3076 string source = null;
3081 int sourceBits = 0; 3077 var sourceBits = 0;
3082 YesNoType suppressModularization = YesNoType.NotSet; 3078 var suppressModularization = YesNoType.NotSet;
3083 string target = null; 3079 string target = null;
3084 int targetBits = 0; 3080 var targetBits = 0;
3085 bool explicitWin64 = false; 3081 var explicitWin64 = false;
3086 3082
3087 foreach (XAttribute attrib in node.Attributes()) 3083 foreach (var attrib in node.Attributes())
3088 { 3084 {
3089 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 3085 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
3090 { 3086 {
3091 switch (attrib.Name.LocalName) 3087 switch (attrib.Name.LocalName)
3092 { 3088 {
3093 case "Id": 3089 case "Id":
3094 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 3090 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
3095 break; 3091 break;
3096 case "BinaryKey": 3092 case "BinaryKey":
3097 if (null != source) 3093 if (null != source)
3098 { 3094 {
3099 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); 3095 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script"));
3100 } 3096 }
3101 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3097 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3102 sourceBits = MsiInterop.MsidbCustomActionTypeBinaryData; 3098 sourceBits = MsiInterop.MsidbCustomActionTypeBinaryData;
3103 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary 3099 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary
3104 break; 3100 break;
3105 case "Directory": 3101 case "Directory":
3106 if (null != source) 3102 if (null != source)
3107 { 3103 {
3108 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); 3104 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script"));
3109 } 3105 }
3110 source = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); 3106 source = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null);
3111 sourceBits = MsiInterop.MsidbCustomActionTypeDirectory; 3107 sourceBits = MsiInterop.MsidbCustomActionTypeDirectory;
3112 break; 3108 break;
3113 case "DllEntry": 3109 case "DllEntry":
3114 if (null != target) 3110 if (null != target)
3115 { 3111 {
3116 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); 3112 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3117 } 3113 }
3118 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 3114 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3119 targetBits = MsiInterop.MsidbCustomActionTypeDll; 3115 targetBits = MsiInterop.MsidbCustomActionTypeDll;
3120 break; 3116 break;
3121 case "Error": 3117 case "Error":
3122 if (null != target) 3118 if (null != target)
3123 { 3119 {
3124 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); 3120 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3125 } 3121 }
3126 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 3122 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3127 targetBits = MsiInterop.MsidbCustomActionTypeTextData | MsiInterop.MsidbCustomActionTypeSourceFile; 3123 targetBits = MsiInterop.MsidbCustomActionTypeTextData | MsiInterop.MsidbCustomActionTypeSourceFile;
3128 3124
3129 bool errorReference = true; 3125 var errorReference = true;
3130 3126
3131 try 3127 try
3132 { 3128 {
3133 // The target can be either a formatted error string or a literal 3129 // The target can be either a formatted error string or a literal
3134 // error number. Try to convert to error number to determine whether 3130 // error number. Try to convert to error number to determine whether
3135 // to add a reference. No need to look at the value. 3131 // to add a reference. No need to look at the value.
3136 Convert.ToInt32(target, CultureInfo.InvariantCulture.NumberFormat); 3132 Convert.ToInt32(target, CultureInfo.InvariantCulture.NumberFormat);
3137 } 3133 }
3138 catch (FormatException) 3134 catch (FormatException)
3139 { 3135 {
3140 errorReference = false; 3136 errorReference = false;
3141 } 3137 }
3142 catch (OverflowException) 3138 catch (OverflowException)
3143 { 3139 {
3144 errorReference = false; 3140 errorReference = false;
3145 } 3141 }
3146 3142
3147 if (errorReference) 3143 if (errorReference)
3148 { 3144 {
3149 this.Core.CreateSimpleReference(sourceLineNumbers, "Error", target); 3145 this.Core.CreateSimpleReference(sourceLineNumbers, "Error", target);
3150 } 3146 }
3151 break; 3147 break;
3152 case "ExeCommand": 3148 case "ExeCommand":
3153 if (null != target) 3149 if (null != target)
3154 { 3150 {
3155 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); 3151 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3156 } 3152 }
3157 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid 3153 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid
3158 targetBits = MsiInterop.MsidbCustomActionTypeExe; 3154 targetBits = MsiInterop.MsidbCustomActionTypeExe;
3159 break; 3155 break;
3160 case "Execute": 3156 case "Execute":
3161 string execute = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 3157 var execute = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3162 if (0 < execute.Length) 3158 if (0 < execute.Length)
3163 { 3159 {
3164 Wix.CustomAction.ExecuteType executeType = Wix.CustomAction.ParseExecuteType(execute); 3160 var executeType = Wix.CustomAction.ParseExecuteType(execute);
3165 switch (executeType) 3161 switch (executeType)
3166 {
3167 case Wix.CustomAction.ExecuteType.commit:
3168 bits |= MsiInterop.MsidbCustomActionTypeInScript | MsiInterop.MsidbCustomActionTypeCommit;
3169 break;
3170 case Wix.CustomAction.ExecuteType.deferred:
3171 bits |= MsiInterop.MsidbCustomActionTypeInScript;
3172 break;
3173 case Wix.CustomAction.ExecuteType.firstSequence:
3174 bits |= MsiInterop.MsidbCustomActionTypeFirstSequence;
3175 break;
3176 case Wix.CustomAction.ExecuteType.immediate:
3177 break;
3178 case Wix.CustomAction.ExecuteType.oncePerProcess:
3179 bits |= MsiInterop.MsidbCustomActionTypeOncePerProcess;
3180 break;
3181 case Wix.CustomAction.ExecuteType.rollback:
3182 bits |= MsiInterop.MsidbCustomActionTypeInScript | MsiInterop.MsidbCustomActionTypeRollback;
3183 break;
3184 case Wix.CustomAction.ExecuteType.secondSequence:
3185 bits |= MsiInterop.MsidbCustomActionTypeClientRepeat;
3186 break;
3187 default:
3188 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, execute, "commit", "deferred", "firstSequence", "immediate", "oncePerProcess", "rollback", "secondSequence"));
3189 break;
3190 }
3191 }
3192 break;
3193 case "FileKey":
3194 if (null != source)
3195 {
3196 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script"));
3197 }
3198 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3199 sourceBits = MsiInterop.MsidbCustomActionTypeSourceFile;
3200 this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File
3201 break;
3202 case "HideTarget":
3203 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3204 {
3205 bits |= MsiInterop.MsidbCustomActionTypeHideTarget;
3206 }
3207 break;
3208 case "Impersonate":
3209 if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3210 {
3211 bits |= MsiInterop.MsidbCustomActionTypeNoImpersonate;
3212 }
3213 break;
3214 case "JScriptCall":
3215 if (null != target)
3216 {
3217 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3218 }
3219 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid
3220 targetBits = MsiInterop.MsidbCustomActionTypeJScript;
3221 break;
3222 case "PatchUninstall":
3223 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3224 {
3225 extendedBits |= MsiInterop.MsidbCustomActionTypePatchUninstall;
3226 }
3227 break;
3228 case "Property":
3229 if (null != source)
3230 {
3231 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script"));
3232 }
3233 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3234 sourceBits = MsiInterop.MsidbCustomActionTypeProperty;
3235 break;
3236 case "Return":
3237 string returnValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3238 if (0 < returnValue.Length)
3239 { 3162 {
3240 Wix.CustomAction.ReturnType returnType = Wix.CustomAction.ParseReturnType(returnValue); 3163 case Wix.CustomAction.ExecuteType.commit:
3241 switch (returnType) 3164 bits |= MsiInterop.MsidbCustomActionTypeInScript | MsiInterop.MsidbCustomActionTypeCommit;
3242 { 3165 break;
3243 case Wix.CustomAction.ReturnType.asyncNoWait: 3166 case Wix.CustomAction.ExecuteType.deferred:
3244 bits |= MsiInterop.MsidbCustomActionTypeAsync | MsiInterop.MsidbCustomActionTypeContinue; 3167 bits |= MsiInterop.MsidbCustomActionTypeInScript;
3245 break; 3168 break;
3246 case Wix.CustomAction.ReturnType.asyncWait: 3169 case Wix.CustomAction.ExecuteType.firstSequence:
3247 bits |= MsiInterop.MsidbCustomActionTypeAsync; 3170 bits |= MsiInterop.MsidbCustomActionTypeFirstSequence;
3248 break; 3171 break;
3249 case Wix.CustomAction.ReturnType.check: 3172 case Wix.CustomAction.ExecuteType.immediate:
3250 break; 3173 break;
3251 case Wix.CustomAction.ReturnType.ignore: 3174 case Wix.CustomAction.ExecuteType.oncePerProcess:
3252 bits |= MsiInterop.MsidbCustomActionTypeContinue; 3175 bits |= MsiInterop.MsidbCustomActionTypeOncePerProcess;
3253 break; 3176 break;
3254 default: 3177 case Wix.CustomAction.ExecuteType.rollback:
3255 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, returnValue, "asyncNoWait", "asyncWait", "check", "ignore")); 3178 bits |= MsiInterop.MsidbCustomActionTypeInScript | MsiInterop.MsidbCustomActionTypeRollback;
3256 break; 3179 break;
3257 } 3180 case Wix.CustomAction.ExecuteType.secondSequence:
3181 bits |= MsiInterop.MsidbCustomActionTypeClientRepeat;
3182 break;
3183 default:
3184 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, execute, "commit", "deferred", "firstSequence", "immediate", "oncePerProcess", "rollback", "secondSequence"));
3185 break;
3258 } 3186 }
3259 break; 3187 }
3260 case "Script": 3188 break;
3261 if (null != source) 3189 case "FileKey":
3190 if (null != source)
3191 {
3192 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script"));
3193 }
3194 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3195 sourceBits = MsiInterop.MsidbCustomActionTypeSourceFile;
3196 this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File
3197 break;
3198 case "HideTarget":
3199 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3200 {
3201 bits |= MsiInterop.MsidbCustomActionTypeHideTarget;
3202 }
3203 break;
3204 case "Impersonate":
3205 if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3206 {
3207 bits |= MsiInterop.MsidbCustomActionTypeNoImpersonate;
3208 }
3209 break;
3210 case "JScriptCall":
3211 if (null != target)
3212 {
3213 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3214 }
3215 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid
3216 targetBits = MsiInterop.MsidbCustomActionTypeJScript;
3217 break;
3218 case "PatchUninstall":
3219 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3220 {
3221 extendedBits |= MsiInterop.MsidbCustomActionTypePatchUninstall;
3222 }
3223 break;
3224 case "Property":
3225 if (null != source)
3226 {
3227 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script"));
3228 }
3229 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3230 sourceBits = MsiInterop.MsidbCustomActionTypeProperty;
3231 break;
3232 case "Return":
3233 var returnValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3234 if (0 < returnValue.Length)
3235 {
3236 var returnType = Wix.CustomAction.ParseReturnType(returnValue);
3237 switch (returnType)
3262 { 3238 {
3263 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script")); 3239 case Wix.CustomAction.ReturnType.asyncNoWait:
3240 bits |= MsiInterop.MsidbCustomActionTypeAsync | MsiInterop.MsidbCustomActionTypeContinue;
3241 break;
3242 case Wix.CustomAction.ReturnType.asyncWait:
3243 bits |= MsiInterop.MsidbCustomActionTypeAsync;
3244 break;
3245 case Wix.CustomAction.ReturnType.check:
3246 break;
3247 case Wix.CustomAction.ReturnType.ignore:
3248 bits |= MsiInterop.MsidbCustomActionTypeContinue;
3249 break;
3250 default:
3251 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, returnValue, "asyncNoWait", "asyncWait", "check", "ignore"));
3252 break;
3264 } 3253 }
3254 }
3255 break;
3256 case "Script":
3257 if (null != source)
3258 {
3259 this.Core.Write(ErrorMessages.CustomActionMultipleSources(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinaryKey", "Directory", "FileKey", "Property", "Script"));
3260 }
3265 3261
3266 if (null != target) 3262 if (null != target)
3267 { 3263 {
3268 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall")); 3264 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3269 } 3265 }
3270 3266
3271 // set the source and target to empty string for error messages when the user sets multiple sources or targets 3267 // set the source and target to empty string for error messages when the user sets multiple sources or targets
3272 source = string.Empty; 3268 source = String.Empty;
3273 target = string.Empty; 3269 target = String.Empty;
3274 3270
3275 inlineScript = true; 3271 inlineScript = true;
3276 3272
3277 string script = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 3273 var script = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
3278 if (0 < script.Length) 3274 if (0 < script.Length)
3279 { 3275 {
3280 Wix.CustomAction.ScriptType scriptType = Wix.CustomAction.ParseScriptType(script); 3276 var scriptType = Wix.CustomAction.ParseScriptType(script);
3281 switch (scriptType) 3277 switch (scriptType)
3282 {
3283 case Wix.CustomAction.ScriptType.jscript:
3284 sourceBits = MsiInterop.MsidbCustomActionTypeDirectory;
3285 targetBits = MsiInterop.MsidbCustomActionTypeJScript;
3286 break;
3287 case Wix.CustomAction.ScriptType.vbscript:
3288 sourceBits = MsiInterop.MsidbCustomActionTypeDirectory;
3289 targetBits = MsiInterop.MsidbCustomActionTypeVBScript;
3290 break;
3291 default:
3292 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, script, "jscript", "vbscript"));
3293 break;
3294 }
3295 }
3296 break;
3297 case "SuppressModularization":
3298 suppressModularization = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
3299 break;
3300 case "TerminalServerAware":
3301 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3302 {
3303 bits |= MsiInterop.MsidbCustomActionTypeTSAware;
3304 }
3305 break;
3306 case "Value":
3307 if (null != target)
3308 {
3309 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3310 }
3311 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid
3312 targetBits = MsiInterop.MsidbCustomActionTypeTextData;
3313 break;
3314 case "VBScriptCall":
3315 if (null != target)
3316 {
3317 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3318 }
3319 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid
3320 targetBits = MsiInterop.MsidbCustomActionTypeVBScript;
3321 break;
3322 case "Win64":
3323 explicitWin64 = true;
3324 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3325 { 3278 {
3326 bits |= MsiInterop.MsidbCustomActionType64BitScript; 3279 case Wix.CustomAction.ScriptType.jscript:
3280 sourceBits = MsiInterop.MsidbCustomActionTypeDirectory;
3281 targetBits = MsiInterop.MsidbCustomActionTypeJScript;
3282 break;
3283 case Wix.CustomAction.ScriptType.vbscript:
3284 sourceBits = MsiInterop.MsidbCustomActionTypeDirectory;
3285 targetBits = MsiInterop.MsidbCustomActionTypeVBScript;
3286 break;
3287 default:
3288 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, script, "jscript", "vbscript"));
3289 break;
3327 } 3290 }
3328 break; 3291 }
3329 default: 3292 break;
3330 this.Core.UnexpectedAttribute(node, attrib); 3293 case "SuppressModularization":
3331 break; 3294 suppressModularization = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
3295 break;
3296 case "TerminalServerAware":
3297 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3298 {
3299 bits |= MsiInterop.MsidbCustomActionTypeTSAware;
3300 }
3301 break;
3302 case "Value":
3303 if (null != target)
3304 {
3305 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3306 }
3307 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid
3308 targetBits = MsiInterop.MsidbCustomActionTypeTextData;
3309 break;
3310 case "VBScriptCall":
3311 if (null != target)
3312 {
3313 this.Core.Write(ErrorMessages.CustomActionMultipleTargets(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3314 }
3315 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); // one of the few cases where an empty string value is valid
3316 targetBits = MsiInterop.MsidbCustomActionTypeVBScript;
3317 break;
3318 case "Win64":
3319 explicitWin64 = true;
3320 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
3321 {
3322 bits |= MsiInterop.MsidbCustomActionType64BitScript;
3323 }
3324 break;
3325 default:
3326 this.Core.UnexpectedAttribute(node, attrib);
3327 break;
3332 } 3328 }
3333 } 3329 }
3334 else 3330 else
@@ -3461,22 +3457,22 @@ namespace WixToolset.Core
3461 /// <returns>Id of the referenced element.</returns> 3457 /// <returns>Id of the referenced element.</returns>
3462 private string ParseSimpleRefElement(XElement node, string table) 3458 private string ParseSimpleRefElement(XElement node, string table)
3463 { 3459 {
3464 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 3460 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3465 string id = null; 3461 string id = null;
3466 3462
3467 foreach (XAttribute attrib in node.Attributes()) 3463 foreach (var attrib in node.Attributes())
3468 { 3464 {
3469 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 3465 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
3470 { 3466 {
3471 switch (attrib.Name.LocalName) 3467 switch (attrib.Name.LocalName)
3472 { 3468 {
3473 case "Id": 3469 case "Id":
3474 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3470 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3475 this.Core.CreateSimpleReference(sourceLineNumbers, table, id); 3471 this.Core.CreateSimpleReference(sourceLineNumbers, table, id);
3476 break; 3472 break;
3477 default: 3473 default:
3478 this.Core.UnexpectedAttribute(node, attrib); 3474 this.Core.UnexpectedAttribute(node, attrib);
3479 break; 3475 break;
3480 } 3476 }
3481 } 3477 }
3482 else 3478 else
@@ -3504,24 +3500,24 @@ namespace WixToolset.Core
3504 /// <returns>Id of the referenced element.</returns> 3500 /// <returns>Id of the referenced element.</returns>
3505 private void ParsePatchFamilyRefElement(XElement node, ComplexReferenceParentType parentType, string parentId) 3501 private void ParsePatchFamilyRefElement(XElement node, ComplexReferenceParentType parentType, string parentId)
3506 { 3502 {
3507 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 3503 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3508 string[] primaryKeys = new string[2]; 3504 var primaryKeys = new string[2];
3509 3505
3510 foreach (XAttribute attrib in node.Attributes()) 3506 foreach (var attrib in node.Attributes())
3511 { 3507 {
3512 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 3508 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
3513 { 3509 {
3514 switch (attrib.Name.LocalName) 3510 switch (attrib.Name.LocalName)
3515 { 3511 {
3516 case "Id": 3512 case "Id":
3517 primaryKeys[0] = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3513 primaryKeys[0] = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3518 break; 3514 break;
3519 case "ProductCode": 3515 case "ProductCode":
3520 primaryKeys[1] = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3516 primaryKeys[1] = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3521 break; 3517 break;
3522 default: 3518 default:
3523 this.Core.UnexpectedAttribute(node, attrib); 3519 this.Core.UnexpectedAttribute(node, attrib);
3524 break; 3520 break;
3525 } 3521 }
3526 } 3522 }
3527 else 3523 else
@@ -3552,21 +3548,21 @@ namespace WixToolset.Core
3552 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 3548 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
3553 private void ParsePatchFamilyGroupElement(XElement node, ComplexReferenceParentType parentType, string parentId) 3549 private void ParsePatchFamilyGroupElement(XElement node, ComplexReferenceParentType parentType, string parentId)
3554 { 3550 {
3555 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 3551 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3556 Identifier id = null; 3552 Identifier id = null;
3557 3553
3558 foreach (XAttribute attrib in node.Attributes()) 3554 foreach (var attrib in node.Attributes())
3559 { 3555 {
3560 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 3556 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
3561 { 3557 {
3562 switch (attrib.Name.LocalName) 3558 switch (attrib.Name.LocalName)
3563 { 3559 {
3564 case "Id": 3560 case "Id":
3565 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 3561 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
3566 break; 3562 break;
3567 default: 3563 default:
3568 this.Core.UnexpectedAttribute(node, attrib); 3564 this.Core.UnexpectedAttribute(node, attrib);
3569 break; 3565 break;
3570 } 3566 }
3571 } 3567 }
3572 else 3568 else
@@ -3581,24 +3577,24 @@ namespace WixToolset.Core
3581 id = Identifier.Invalid; 3577 id = Identifier.Invalid;
3582 } 3578 }
3583 3579
3584 foreach (XElement child in node.Elements()) 3580 foreach (var child in node.Elements())
3585 { 3581 {
3586 if (CompilerCore.WixNamespace == child.Name.Namespace) 3582 if (CompilerCore.WixNamespace == child.Name.Namespace)
3587 { 3583 {
3588 switch (child.Name.LocalName) 3584 switch (child.Name.LocalName)
3589 { 3585 {
3590 case "PatchFamily": 3586 case "PatchFamily":
3591 this.ParsePatchFamilyElement(child, ComplexReferenceParentType.PatchFamilyGroup, id.Id); 3587 this.ParsePatchFamilyElement(child, ComplexReferenceParentType.PatchFamilyGroup, id.Id);
3592 break; 3588 break;
3593 case "PatchFamilyRef": 3589 case "PatchFamilyRef":
3594 this.ParsePatchFamilyRefElement(child, ComplexReferenceParentType.PatchFamilyGroup, id.Id); 3590 this.ParsePatchFamilyRefElement(child, ComplexReferenceParentType.PatchFamilyGroup, id.Id);
3595 break; 3591 break;
3596 case "PatchFamilyGroupRef": 3592 case "PatchFamilyGroupRef":
3597 this.ParsePatchFamilyGroupRefElement(child, ComplexReferenceParentType.PatchFamilyGroup, id.Id); 3593 this.ParsePatchFamilyGroupRefElement(child, ComplexReferenceParentType.PatchFamilyGroup, id.Id);
3598 break; 3594 break;
3599 default: 3595 default:
3600 this.Core.UnexpectedElement(node, child); 3596 this.Core.UnexpectedElement(node, child);
3601 break; 3597 break;
3602 } 3598 }
3603 } 3599 }
3604 else 3600 else
@@ -3626,22 +3622,22 @@ namespace WixToolset.Core
3626 { 3622 {
3627 Debug.Assert(ComplexReferenceParentType.PatchFamilyGroup == parentType || ComplexReferenceParentType.Patch == parentType); 3623 Debug.Assert(ComplexReferenceParentType.PatchFamilyGroup == parentType || ComplexReferenceParentType.Patch == parentType);
3628 3624
3629 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 3625 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3630 string id = null; 3626 string id = null;
3631 3627
3632 foreach (XAttribute attrib in node.Attributes()) 3628 foreach (var attrib in node.Attributes())
3633 { 3629 {
3634 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 3630 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
3635 { 3631 {
3636 switch (attrib.Name.LocalName) 3632 switch (attrib.Name.LocalName)
3637 { 3633 {
3638 case "Id": 3634 case "Id":
3639 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3635 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3640 this.Core.CreateSimpleReference(sourceLineNumbers, "WixPatchFamilyGroup", id); 3636 this.Core.CreateSimpleReference(sourceLineNumbers, "WixPatchFamilyGroup", id);
3641 break; 3637 break;
3642 default: 3638 default:
3643 this.Core.UnexpectedAttribute(node, attrib); 3639 this.Core.UnexpectedAttribute(node, attrib);
3644 break; 3640 break;
3645 } 3641 }
3646 } 3642 }
3647 else 3643 else
@@ -3669,21 +3665,21 @@ namespace WixToolset.Core
3669 /// <param name="node">Element to parse.</param> 3665 /// <param name="node">Element to parse.</param>
3670 private void ParseEnsureTableElement(XElement node) 3666 private void ParseEnsureTableElement(XElement node)
3671 { 3667 {
3672 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 3668 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3673 string id = null; 3669 string id = null;
3674 3670
3675 foreach (XAttribute attrib in node.Attributes()) 3671 foreach (var attrib in node.Attributes())
3676 { 3672 {
3677 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 3673 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
3678 { 3674 {
3679 switch (attrib.Name.LocalName) 3675 switch (attrib.Name.LocalName)
3680 { 3676 {
3681 case "Id": 3677 case "Id":
3682 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3678 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3683 break; 3679 break;
3684 default: 3680 default:
3685 this.Core.UnexpectedAttribute(node, attrib); 3681 this.Core.UnexpectedAttribute(node, attrib);
3686 break; 3682 break;
3687 } 3683 }
3688 } 3684 }
3689 else 3685 else
@@ -3713,11 +3709,11 @@ namespace WixToolset.Core
3713 /// <remarks>not cleaned</remarks> 3709 /// <remarks>not cleaned</remarks>
3714 private void ParseCustomTableElement(XElement node) 3710 private void ParseCustomTableElement(XElement node)
3715 { 3711 {
3716 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 3712 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
3717 string tableId = null; 3713 string tableId = null;
3718 3714
3719 string categories = null; 3715 string categories = null;
3720 int columnCount = 0; 3716 var columnCount = 0;
3721 string columnNames = null; 3717 string columnNames = null;
3722 string columnTypes = null; 3718 string columnTypes = null;
3723 string descriptions = null; 3719 string descriptions = null;
@@ -3728,23 +3724,23 @@ namespace WixToolset.Core
3728 string modularizations = null; 3724 string modularizations = null;
3729 string primaryKeys = null; 3725 string primaryKeys = null;
3730 string sets = null; 3726 string sets = null;
3731 bool bootstrapperApplicationData = false; 3727 var bootstrapperApplicationData = false;
3732 3728
3733 foreach (XAttribute attrib in node.Attributes()) 3729 foreach (var attrib in node.Attributes())
3734 { 3730 {
3735 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 3731 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
3736 { 3732 {
3737 switch (attrib.Name.LocalName) 3733 switch (attrib.Name.LocalName)
3738 { 3734 {
3739 case "Id": 3735 case "Id":
3740 tableId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 3736 tableId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
3741 break; 3737 break;
3742 case "BootstrapperApplicationData": 3738 case "BootstrapperApplicationData":
3743 bootstrapperApplicationData = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 3739 bootstrapperApplicationData = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
3744 break; 3740 break;
3745 default: 3741 default:
3746 this.Core.UnexpectedAttribute(node, attrib); 3742 this.Core.UnexpectedAttribute(node, attrib);
3747 break; 3743 break;
3748 } 3744 }
3749 } 3745 }
3750 else 3746 else
@@ -3762,203 +3758,203 @@ namespace WixToolset.Core
3762 this.Core.Write(ErrorMessages.CustomTableNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", tableId)); 3758 this.Core.Write(ErrorMessages.CustomTableNameTooLong(sourceLineNumbers, node.Name.LocalName, "Id", tableId));
3763 } 3759 }
3764 3760
3765 foreach (XElement child in node.Elements()) 3761 foreach (var child in node.Elements())
3766 { 3762 {
3767 if (CompilerCore.WixNamespace == child.Name.Namespace) 3763 if (CompilerCore.WixNamespace == child.Name.Namespace)
3768 { 3764 {
3769 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 3765 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
3770 switch (child.Name.LocalName) 3766 switch (child.Name.LocalName)
3771 { 3767 {
3772 case "Column": 3768 case "Column":
3773 ++columnCount; 3769 ++columnCount;
3774 3770
3775 string category = String.Empty; 3771 var category = String.Empty;
3776 string columnName = null; 3772 string columnName = null;
3777 string columnType = null; 3773 string columnType = null;
3778 string description = String.Empty; 3774 var description = String.Empty;
3779 int keyColumn = CompilerConstants.IntegerNotSet; 3775 var keyColumn = CompilerConstants.IntegerNotSet;
3780 string keyTable = String.Empty; 3776 var keyTable = String.Empty;
3781 bool localizable = false; 3777 var localizable = false;
3782 long maxValue = CompilerConstants.LongNotSet; 3778 var maxValue = CompilerConstants.LongNotSet;
3783 long minValue = CompilerConstants.LongNotSet; 3779 var minValue = CompilerConstants.LongNotSet;
3784 string modularization = "None"; 3780 var modularization = "None";
3785 bool nullable = false; 3781 var nullable = false;
3786 bool primaryKey = false; 3782 var primaryKey = false;
3787 string setValues = String.Empty; 3783 var setValues = String.Empty;
3788 string typeName = null; 3784 string typeName = null;
3789 int width = 0; 3785 var width = 0;
3790 3786
3791 foreach (XAttribute childAttrib in child.Attributes()) 3787 foreach (var childAttrib in child.Attributes())
3788 {
3789 switch (childAttrib.Name.LocalName)
3792 { 3790 {
3793 switch (childAttrib.Name.LocalName) 3791 case "Id":
3792 columnName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, childAttrib);
3793 break;
3794 case "Category":
3795 category = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3796 break;
3797 case "Description":
3798 description = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3799 break;
3800 case "KeyColumn":
3801 keyColumn = this.Core.GetAttributeIntegerValue(childSourceLineNumbers, childAttrib, 1, 32);
3802 break;
3803 case "KeyTable":
3804 keyTable = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3805 break;
3806 case "Localizable":
3807 localizable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib);
3808 break;
3809 case "MaxValue":
3810 maxValue = this.Core.GetAttributeLongValue(childSourceLineNumbers, childAttrib, Int32.MinValue + 1, Int32.MaxValue);
3811 break;
3812 case "MinValue":
3813 minValue = this.Core.GetAttributeLongValue(childSourceLineNumbers, childAttrib, Int32.MinValue + 1, Int32.MaxValue);
3814 break;
3815 case "Modularize":
3816 modularization = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3817 break;
3818 case "Nullable":
3819 nullable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib);
3820 break;
3821 case "PrimaryKey":
3822 primaryKey = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib);
3823 break;
3824 case "Set":
3825 setValues = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3826 break;
3827 case "Type":
3828 var typeValue = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3829 if (0 < typeValue.Length)
3794 { 3830 {
3795 case "Id": 3831 var typeType = Wix.Column.ParseTypeType(typeValue);
3796 columnName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, childAttrib); 3832 switch (typeType)
3797 break; 3833 {
3798 case "Category": 3834 case Wix.Column.TypeType.binary:
3799 category = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); 3835 typeName = "OBJECT";
3800 break;
3801 case "Description":
3802 description = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3803 break;
3804 case "KeyColumn":
3805 keyColumn = this.Core.GetAttributeIntegerValue(childSourceLineNumbers, childAttrib, 1, 32);
3806 break;
3807 case "KeyTable":
3808 keyTable = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3809 break;
3810 case "Localizable":
3811 localizable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib);
3812 break;
3813 case "MaxValue":
3814 maxValue = this.Core.GetAttributeLongValue(childSourceLineNumbers, childAttrib, int.MinValue + 1, int.MaxValue);
3815 break;
3816 case "MinValue":
3817 minValue = this.Core.GetAttributeLongValue(childSourceLineNumbers, childAttrib, int.MinValue + 1, int.MaxValue);
3818 break;
3819 case "Modularize":
3820 modularization = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3821 break;
3822 case "Nullable":
3823 nullable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib);
3824 break;
3825 case "PrimaryKey":
3826 primaryKey = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, childAttrib);
3827 break;
3828 case "Set":
3829 setValues = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
3830 break; 3836 break;
3831 case "Type": 3837 case Wix.Column.TypeType.@int:
3832 string typeValue = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); 3838 typeName = "SHORT";
3833 if (0 < typeValue.Length)
3834 {
3835 Wix.Column.TypeType typeType = Wix.Column.ParseTypeType(typeValue);
3836 switch (typeType)
3837 {
3838 case Wix.Column.TypeType.binary:
3839 typeName = "OBJECT";
3840 break;
3841 case Wix.Column.TypeType.@int:
3842 typeName = "SHORT";
3843 break;
3844 case Wix.Column.TypeType.@string:
3845 typeName = "CHAR";
3846 break;
3847 default:
3848 this.Core.Write(ErrorMessages.IllegalAttributeValue(childSourceLineNumbers, child.Name.LocalName, "Type", typeValue, "binary", "int", "string"));
3849 break;
3850 }
3851 }
3852 break; 3839 break;
3853 case "Width": 3840 case Wix.Column.TypeType.@string:
3854 width = this.Core.GetAttributeIntegerValue(childSourceLineNumbers, childAttrib, 0, int.MaxValue); 3841 typeName = "CHAR";
3855 break; 3842 break;
3856 default: 3843 default:
3857 this.Core.UnexpectedAttribute(child, childAttrib); 3844 this.Core.Write(ErrorMessages.IllegalAttributeValue(childSourceLineNumbers, child.Name.LocalName, "Type", typeValue, "binary", "int", "string"));
3858 break; 3845 break;
3846 }
3859 } 3847 }
3848 break;
3849 case "Width":
3850 width = this.Core.GetAttributeIntegerValue(childSourceLineNumbers, childAttrib, 0, Int32.MaxValue);
3851 break;
3852 default:
3853 this.Core.UnexpectedAttribute(child, childAttrib);
3854 break;
3860 } 3855 }
3856 }
3861 3857
3862 if (null == columnName) 3858 if (null == columnName)
3863 { 3859 {
3864 this.Core.Write(ErrorMessages.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Id")); 3860 this.Core.Write(ErrorMessages.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Id"));
3865 } 3861 }
3866 3862
3867 if (null == typeName) 3863 if (null == typeName)
3868 { 3864 {
3869 this.Core.Write(ErrorMessages.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Type")); 3865 this.Core.Write(ErrorMessages.ExpectedAttribute(childSourceLineNumbers, child.Name.LocalName, "Type"));
3870 } 3866 }
3871 else if ("SHORT" == typeName) 3867 else if ("SHORT" == typeName)
3872 { 3868 {
3873 if (2 != width && 4 != width) 3869 if (2 != width && 4 != width)
3874 {
3875 this.Core.Write(ErrorMessages.CustomTableIllegalColumnWidth(childSourceLineNumbers, child.Name.LocalName, "Width", width));
3876 }
3877 columnType = String.Concat(nullable ? "I" : "i", width);
3878 }
3879 else if ("CHAR" == typeName)
3880 { 3870 {
3881 string typeChar = localizable ? "l" : "s"; 3871 this.Core.Write(ErrorMessages.CustomTableIllegalColumnWidth(childSourceLineNumbers, child.Name.LocalName, "Width", width));
3882 columnType = String.Concat(nullable ? typeChar.ToUpper(CultureInfo.InvariantCulture) : typeChar.ToLower(CultureInfo.InvariantCulture), width);
3883 } 3872 }
3884 else if ("OBJECT" == typeName) 3873 columnType = String.Concat(nullable ? "I" : "i", width);
3874 }
3875 else if ("CHAR" == typeName)
3876 {
3877 var typeChar = localizable ? "l" : "s";
3878 columnType = String.Concat(nullable ? typeChar.ToUpper(CultureInfo.InvariantCulture) : typeChar.ToLower(CultureInfo.InvariantCulture), width);
3879 }
3880 else if ("OBJECT" == typeName)
3881 {
3882 if ("Binary" != category)
3885 { 3883 {
3886 if ("Binary" != category) 3884 this.Core.Write(ErrorMessages.ExpectedBinaryCategory(childSourceLineNumbers));
3887 {
3888 this.Core.Write(ErrorMessages.ExpectedBinaryCategory(childSourceLineNumbers));
3889 }
3890 columnType = String.Concat(nullable ? "V" : "v", width);
3891 } 3885 }
3886 columnType = String.Concat(nullable ? "V" : "v", width);
3887 }
3892 3888
3893 this.Core.ParseForExtensionElements(child); 3889 this.Core.ParseForExtensionElements(child);
3894 3890
3895 columnNames = String.Concat(columnNames, null == columnNames ? String.Empty : "\t", columnName); 3891 columnNames = String.Concat(columnNames, null == columnNames ? String.Empty : "\t", columnName);
3896 columnTypes = String.Concat(columnTypes, null == columnTypes ? String.Empty : "\t", columnType); 3892 columnTypes = String.Concat(columnTypes, null == columnTypes ? String.Empty : "\t", columnType);
3897 if (primaryKey) 3893 if (primaryKey)
3898 { 3894 {
3899 primaryKeys = String.Concat(primaryKeys, null == primaryKeys ? String.Empty : "\t", columnName); 3895 primaryKeys = String.Concat(primaryKeys, null == primaryKeys ? String.Empty : "\t", columnName);
3900 } 3896 }
3901 3897
3902 minValues = String.Concat(minValues, null == minValues ? String.Empty : "\t", CompilerConstants.LongNotSet != minValue ? minValue.ToString(CultureInfo.InvariantCulture) : String.Empty); 3898 minValues = String.Concat(minValues, null == minValues ? String.Empty : "\t", CompilerConstants.LongNotSet != minValue ? minValue.ToString(CultureInfo.InvariantCulture) : String.Empty);
3903 maxValues = String.Concat(maxValues, null == maxValues ? String.Empty : "\t", CompilerConstants.LongNotSet != maxValue ? maxValue.ToString(CultureInfo.InvariantCulture) : String.Empty); 3899 maxValues = String.Concat(maxValues, null == maxValues ? String.Empty : "\t", CompilerConstants.LongNotSet != maxValue ? maxValue.ToString(CultureInfo.InvariantCulture) : String.Empty);
3904 keyTables = String.Concat(keyTables, null == keyTables ? String.Empty : "\t", keyTable); 3900 keyTables = String.Concat(keyTables, null == keyTables ? String.Empty : "\t", keyTable);
3905 keyColumns = String.Concat(keyColumns, null == keyColumns ? String.Empty : "\t", CompilerConstants.IntegerNotSet != keyColumn ? keyColumn.ToString(CultureInfo.InvariantCulture) : String.Empty); 3901 keyColumns = String.Concat(keyColumns, null == keyColumns ? String.Empty : "\t", CompilerConstants.IntegerNotSet != keyColumn ? keyColumn.ToString(CultureInfo.InvariantCulture) : String.Empty);
3906 categories = String.Concat(categories, null == categories ? String.Empty : "\t", category); 3902 categories = String.Concat(categories, null == categories ? String.Empty : "\t", category);
3907 sets = String.Concat(sets, null == sets ? String.Empty : "\t", setValues); 3903 sets = String.Concat(sets, null == sets ? String.Empty : "\t", setValues);
3908 descriptions = String.Concat(descriptions, null == descriptions ? String.Empty : "\t", description); 3904 descriptions = String.Concat(descriptions, null == descriptions ? String.Empty : "\t", description);
3909 modularizations = String.Concat(modularizations, null == modularizations ? String.Empty : "\t", modularization); 3905 modularizations = String.Concat(modularizations, null == modularizations ? String.Empty : "\t", modularization);
3910 3906
3911 break; 3907 break;
3912 case "Row": 3908 case "Row":
3913 string dataValue = null; 3909 string dataValue = null;
3914 3910
3915 foreach (XAttribute childAttrib in child.Attributes()) 3911 foreach (var childAttrib in child.Attributes())
3916 { 3912 {
3917 this.Core.ParseExtensionAttribute(child, childAttrib); 3913 this.Core.ParseExtensionAttribute(child, childAttrib);
3918 } 3914 }
3919 3915
3920 foreach (XElement data in child.Elements()) 3916 foreach (var data in child.Elements())
3917 {
3918 var dataSourceLineNumbers = Preprocessor.GetSourceLineNumbers(data);
3919 switch (data.Name.LocalName)
3921 { 3920 {
3922 SourceLineNumber dataSourceLineNumbers = Preprocessor.GetSourceLineNumbers(data); 3921 case "Data":
3923 switch (data.Name.LocalName) 3922 columnName = null;
3923 foreach (var dataAttrib in data.Attributes())
3924 { 3924 {
3925 case "Data": 3925 switch (dataAttrib.Name.LocalName)
3926 columnName = null; 3926 {
3927 foreach (XAttribute dataAttrib in data.Attributes()) 3927 case "Column":
3928 { 3928 columnName = this.Core.GetAttributeValue(dataSourceLineNumbers, dataAttrib);
3929 switch (dataAttrib.Name.LocalName)
3930 {
3931 case "Column":
3932 columnName = this.Core.GetAttributeValue(dataSourceLineNumbers, dataAttrib);
3933 break;
3934 default:
3935 this.Core.UnexpectedAttribute(data, dataAttrib);
3936 break;
3937 }
3938 }
3939
3940 if (null == columnName)
3941 {
3942 this.Core.Write(ErrorMessages.ExpectedAttribute(dataSourceLineNumbers, data.Name.LocalName, "Column"));
3943 }
3944
3945 dataValue = String.Concat(dataValue, null == dataValue ? String.Empty : Common.CustomRowFieldSeparator.ToString(), columnName, ":", Common.GetInnerText(data));
3946 break; 3929 break;
3930 default:
3931 this.Core.UnexpectedAttribute(data, dataAttrib);
3932 break;
3933 }
3947 } 3934 }
3948 }
3949 3935
3950 this.Core.CreateSimpleReference(sourceLineNumbers, "WixCustomTable", tableId); 3936 if (null == columnName)
3937 {
3938 this.Core.Write(ErrorMessages.ExpectedAttribute(dataSourceLineNumbers, data.Name.LocalName, "Column"));
3939 }
3951 3940
3952 if (!this.Core.EncounteredError) 3941 dataValue = String.Concat(dataValue, null == dataValue ? String.Empty : Common.CustomRowFieldSeparator.ToString(), columnName, ":", Common.GetInnerText(data));
3953 { 3942 break;
3954 var rowRow = this.Core.CreateRow(childSourceLineNumbers, TupleDefinitionType.WixCustomRow);
3955 rowRow.Set(0, tableId);
3956 rowRow.Set(1, dataValue);
3957 } 3943 }
3958 break; 3944 }
3959 default: 3945
3960 this.Core.UnexpectedElement(node, child); 3946 this.Core.CreateSimpleReference(sourceLineNumbers, "WixCustomTable", tableId);
3961 break; 3947
3948 if (!this.Core.EncounteredError)
3949 {
3950 var rowRow = this.Core.CreateRow(childSourceLineNumbers, TupleDefinitionType.WixCustomRow);
3951 rowRow.Set(0, tableId);
3952 rowRow.Set(1, dataValue);
3953 }
3954 break;
3955 default:
3956 this.Core.UnexpectedElement(node, child);
3957 break;
3962 } 3958 }
3963 } 3959 }
3964 else 3960 else
@@ -4005,12 +4001,12 @@ namespace WixToolset.Core
4005 [SuppressMessage("Microsoft.Performance", "CA1820:TestForEmptyStringsUsingStringLength")] 4001 [SuppressMessage("Microsoft.Performance", "CA1820:TestForEmptyStringsUsingStringLength")]
4006 private void ParseDirectoryElement(XElement node, string parentId, int diskId, string fileSource) 4002 private void ParseDirectoryElement(XElement node, string parentId, int diskId, string fileSource)
4007 { 4003 {
4008 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 4004 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
4009 Identifier id = null; 4005 Identifier id = null;
4010 string componentGuidGenerationSeed = null; 4006 string componentGuidGenerationSeed = null;
4011 bool fileSourceAttribSet = false; 4007 var fileSourceAttribSet = false;
4012 bool nameHasValue = false; 4008 var nameHasValue = false;
4013 string name = "."; // default to parent directory. 4009 var name = "."; // default to parent directory.
4014 string[] inlineSyntax = null; 4010 string[] inlineSyntax = null;
4015 string shortName = null; 4011 string shortName = null;
4016 string sourceName = null; 4012 string sourceName = null;
@@ -4018,55 +4014,55 @@ namespace WixToolset.Core
4018 string defaultDir = null; 4014 string defaultDir = null;
4019 string symbols = null; 4015 string symbols = null;
4020 4016
4021 foreach (XAttribute attrib in node.Attributes()) 4017 foreach (var attrib in node.Attributes())
4022 { 4018 {
4023 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 4019 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
4024 { 4020 {
4025 switch (attrib.Name.LocalName) 4021 switch (attrib.Name.LocalName)
4026 { 4022 {
4027 case "Id": 4023 case "Id":
4028 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 4024 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
4029 break; 4025 break;
4030 case "ComponentGuidGenerationSeed": 4026 case "ComponentGuidGenerationSeed":
4031 componentGuidGenerationSeed = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 4027 componentGuidGenerationSeed = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
4032 break; 4028 break;
4033 case "DiskId": 4029 case "DiskId":
4034 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); 4030 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
4035 break; 4031 break;
4036 case "FileSource": 4032 case "FileSource":
4037 fileSource = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4033 fileSource = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4038 fileSourceAttribSet = true; 4034 fileSourceAttribSet = true;
4039 break; 4035 break;
4040 case "Name": 4036 case "Name":
4041 nameHasValue = true; 4037 nameHasValue = true;
4042 if (attrib.Value.Equals(".")) 4038 if (attrib.Value.Equals("."))
4043 { 4039 {
4044 name = attrib.Value; 4040 name = attrib.Value;
4045 } 4041 }
4046 else 4042 else
4047 { 4043 {
4048 inlineSyntax = this.Core.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attrib); 4044 inlineSyntax = this.Core.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attrib);
4049 } 4045 }
4050 break; 4046 break;
4051 case "ShortName": 4047 case "ShortName":
4052 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); 4048 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
4053 break; 4049 break;
4054 case "ShortSourceName": 4050 case "ShortSourceName":
4055 shortSourceName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); 4051 shortSourceName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
4056 break; 4052 break;
4057 case "SourceName": 4053 case "SourceName":
4058 if ("." == attrib.Value) 4054 if ("." == attrib.Value)
4059 { 4055 {
4060 sourceName = attrib.Value; 4056 sourceName = attrib.Value;
4061 } 4057 }
4062 else 4058 else
4063 { 4059 {
4064 sourceName = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); 4060 sourceName = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
4065 } 4061 }
4066 break; 4062 break;
4067 default: 4063 default:
4068 this.Core.UnexpectedAttribute(node, attrib); 4064 this.Core.UnexpectedAttribute(node, attrib);
4069 break; 4065 break;
4070 } 4066 }
4071 } 4067 }
4072 else 4068 else
@@ -4086,7 +4082,7 @@ namespace WixToolset.Core
4086 } 4082 }
4087 else 4083 else
4088 { 4084 {
4089 int pathStartsAt = 0; 4085 var pathStartsAt = 0;
4090 if (inlineSyntax[0].EndsWith(":")) 4086 if (inlineSyntax[0].EndsWith(":"))
4091 { 4087 {
4092 parentId = inlineSyntax[0].TrimEnd(':'); 4088 parentId = inlineSyntax[0].TrimEnd(':');
@@ -4095,9 +4091,9 @@ namespace WixToolset.Core
4095 pathStartsAt = 1; 4091 pathStartsAt = 1;
4096 } 4092 }
4097 4093
4098 for (int i = pathStartsAt; i < inlineSyntax.Length - 1; ++i) 4094 for (var i = pathStartsAt; i < inlineSyntax.Length - 1; ++i)
4099 { 4095 {
4100 Identifier inlineId = this.Core.CreateDirectoryRow(sourceLineNumbers, null, parentId, inlineSyntax[i]); 4096 var inlineId = this.Core.CreateDirectoryRow(sourceLineNumbers, null, parentId, inlineSyntax[i]);
4101 parentId = inlineId.Id; 4097 parentId = inlineId.Id;
4102 } 4098 }
4103 4099
@@ -4206,34 +4202,34 @@ namespace WixToolset.Core
4206 this.Core.Write(ErrorMessages.IllegalTargetDirDefaultDir(sourceLineNumbers, defaultDir)); 4202 this.Core.Write(ErrorMessages.IllegalTargetDirDefaultDir(sourceLineNumbers, defaultDir));
4207 } 4203 }
4208 4204
4209 foreach (XElement child in node.Elements()) 4205 foreach (var child in node.Elements())
4210 { 4206 {
4211 if (CompilerCore.WixNamespace == child.Name.Namespace) 4207 if (CompilerCore.WixNamespace == child.Name.Namespace)
4212 { 4208 {
4213 switch (child.Name.LocalName) 4209 switch (child.Name.LocalName)
4214 { 4210 {
4215 case "Component": 4211 case "Component":
4216 this.ParseComponentElement(child, ComplexReferenceParentType.Unknown, null, null, diskId, id.Id, fileSource); 4212 this.ParseComponentElement(child, ComplexReferenceParentType.Unknown, null, null, diskId, id.Id, fileSource);
4217 break; 4213 break;
4218 case "Directory": 4214 case "Directory":
4219 this.ParseDirectoryElement(child, id.Id, diskId, fileSource); 4215 this.ParseDirectoryElement(child, id.Id, diskId, fileSource);
4220 break; 4216 break;
4221 case "Merge": 4217 case "Merge":
4222 this.ParseMergeElement(child, id.Id, diskId); 4218 this.ParseMergeElement(child, id.Id, diskId);
4223 break; 4219 break;
4224 case "SymbolPath": 4220 case "SymbolPath":
4225 if (null != symbols) 4221 if (null != symbols)
4226 { 4222 {
4227 symbols += ";" + this.ParseSymbolPathElement(child); 4223 symbols += ";" + this.ParseSymbolPathElement(child);
4228 } 4224 }
4229 else 4225 else
4230 { 4226 {
4231 symbols = this.ParseSymbolPathElement(child); 4227 symbols = this.ParseSymbolPathElement(child);
4232 } 4228 }
4233 break; 4229 break;
4234 default: 4230 default:
4235 this.Core.UnexpectedElement(node, child); 4231 this.Core.UnexpectedElement(node, child);
4236 break; 4232 break;
4237 } 4233 }
4238 } 4234 }
4239 else 4235 else
@@ -4271,30 +4267,30 @@ namespace WixToolset.Core
4271 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 4267 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
4272 private void ParseDirectoryRefElement(XElement node) 4268 private void ParseDirectoryRefElement(XElement node)
4273 { 4269 {
4274 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 4270 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
4275 string id = null; 4271 string id = null;
4276 int diskId = CompilerConstants.IntegerNotSet; 4272 var diskId = CompilerConstants.IntegerNotSet;
4277 string fileSource = String.Empty; 4273 var fileSource = String.Empty;
4278 4274
4279 foreach (XAttribute attrib in node.Attributes()) 4275 foreach (var attrib in node.Attributes())
4280 { 4276 {
4281 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 4277 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
4282 { 4278 {
4283 switch (attrib.Name.LocalName) 4279 switch (attrib.Name.LocalName)
4284 { 4280 {
4285 case "Id": 4281 case "Id":
4286 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 4282 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
4287 this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id); 4283 this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id);
4288 break; 4284 break;
4289 case "DiskId": 4285 case "DiskId":
4290 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); 4286 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
4291 break; 4287 break;
4292 case "FileSource": 4288 case "FileSource":
4293 fileSource = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4289 fileSource = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4294 break; 4290 break;
4295 default: 4291 default:
4296 this.Core.UnexpectedAttribute(node, attrib); 4292 this.Core.UnexpectedAttribute(node, attrib);
4297 break; 4293 break;
4298 } 4294 }
4299 } 4295 }
4300 else 4296 else
@@ -4313,24 +4309,24 @@ namespace WixToolset.Core
4313 fileSource = String.Concat(fileSource, Path.DirectorySeparatorChar); 4309 fileSource = String.Concat(fileSource, Path.DirectorySeparatorChar);
4314 } 4310 }
4315 4311
4316 foreach (XElement child in node.Elements()) 4312 foreach (var child in node.Elements())
4317 { 4313 {
4318 if (CompilerCore.WixNamespace == child.Name.Namespace) 4314 if (CompilerCore.WixNamespace == child.Name.Namespace)
4319 { 4315 {
4320 switch (child.Name.LocalName) 4316 switch (child.Name.LocalName)
4321 { 4317 {
4322 case "Component": 4318 case "Component":
4323 this.ParseComponentElement(child, ComplexReferenceParentType.Unknown, null, null, diskId, id, fileSource); 4319 this.ParseComponentElement(child, ComplexReferenceParentType.Unknown, null, null, diskId, id, fileSource);
4324 break; 4320 break;
4325 case "Directory": 4321 case "Directory":
4326 this.ParseDirectoryElement(child, id, diskId, fileSource); 4322 this.ParseDirectoryElement(child, id, diskId, fileSource);
4327 break; 4323 break;
4328 case "Merge": 4324 case "Merge":
4329 this.ParseMergeElement(child, id, diskId); 4325 this.ParseMergeElement(child, id, diskId);
4330 break; 4326 break;
4331 default: 4327 default:
4332 this.Core.UnexpectedElement(node, child); 4328 this.Core.UnexpectedElement(node, child);
4333 break; 4329 break;
4334 } 4330 }
4335 } 4331 }
4336 else 4332 else
@@ -4348,34 +4344,34 @@ namespace WixToolset.Core
4348 /// <returns>Signature of search element.</returns> 4344 /// <returns>Signature of search element.</returns>
4349 private string ParseDirectorySearchElement(XElement node, string parentSignature) 4345 private string ParseDirectorySearchElement(XElement node, string parentSignature)
4350 { 4346 {
4351 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 4347 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
4352 Identifier id = null; 4348 Identifier id = null;
4353 int depth = CompilerConstants.IntegerNotSet; 4349 var depth = CompilerConstants.IntegerNotSet;
4354 string path = null; 4350 string path = null;
4355 bool assignToProperty = false; 4351 var assignToProperty = false;
4356 string signature = null; 4352 string signature = null;
4357 4353
4358 foreach (XAttribute attrib in node.Attributes()) 4354 foreach (var attrib in node.Attributes())
4359 { 4355 {
4360 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 4356 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
4361 { 4357 {
4362 switch (attrib.Name.LocalName) 4358 switch (attrib.Name.LocalName)
4363 { 4359 {
4364 case "Id": 4360 case "Id":
4365 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 4361 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
4366 break; 4362 break;
4367 case "Depth": 4363 case "Depth":
4368 depth = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 4364 depth = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
4369 break; 4365 break;
4370 case "Path": 4366 case "Path":
4371 path = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4367 path = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4372 break; 4368 break;
4373 case "AssignToProperty": 4369 case "AssignToProperty":
4374 assignToProperty = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 4370 assignToProperty = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
4375 break; 4371 break;
4376 default: 4372 default:
4377 this.Core.UnexpectedAttribute(node, attrib); 4373 this.Core.UnexpectedAttribute(node, attrib);
4378 break; 4374 break;
4379 } 4375 }
4380 } 4376 }
4381 else 4377 else
@@ -4391,51 +4387,51 @@ namespace WixToolset.Core
4391 4387
4392 signature = id.Id; 4388 signature = id.Id;
4393 4389
4394 bool oneChild = false; 4390 var oneChild = false;
4395 bool hasFileSearch = false; 4391 var hasFileSearch = false;
4396 foreach (XElement child in node.Elements()) 4392 foreach (var child in node.Elements())
4397 { 4393 {
4398 if (CompilerCore.WixNamespace == child.Name.Namespace) 4394 if (CompilerCore.WixNamespace == child.Name.Namespace)
4399 { 4395 {
4400 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 4396 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
4401 switch (child.Name.LocalName) 4397 switch (child.Name.LocalName)
4402 { 4398 {
4403 case "DirectorySearch": 4399 case "DirectorySearch":
4404 if (oneChild) 4400 if (oneChild)
4405 { 4401 {
4406 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); 4402 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName));
4407 } 4403 }
4408 oneChild = true; 4404 oneChild = true;
4409 signature = this.ParseDirectorySearchElement(child, id.Id); 4405 signature = this.ParseDirectorySearchElement(child, id.Id);
4410 break; 4406 break;
4411 case "DirectorySearchRef": 4407 case "DirectorySearchRef":
4412 if (oneChild) 4408 if (oneChild)
4413 { 4409 {
4414 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); 4410 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName));
4415 } 4411 }
4416 oneChild = true; 4412 oneChild = true;
4417 signature = this.ParseDirectorySearchRefElement(child, id.Id); 4413 signature = this.ParseDirectorySearchRefElement(child, id.Id);
4418 break; 4414 break;
4419 case "FileSearch": 4415 case "FileSearch":
4420 if (oneChild) 4416 if (oneChild)
4421 { 4417 {
4422 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 4418 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
4423 } 4419 }
4424 oneChild = true; 4420 oneChild = true;
4425 hasFileSearch = true; 4421 hasFileSearch = true;
4426 signature = this.ParseFileSearchElement(child, id.Id, assignToProperty, depth); 4422 signature = this.ParseFileSearchElement(child, id.Id, assignToProperty, depth);
4427 break; 4423 break;
4428 case "FileSearchRef": 4424 case "FileSearchRef":
4429 if (oneChild) 4425 if (oneChild)
4430 { 4426 {
4431 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 4427 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
4432 } 4428 }
4433 oneChild = true; 4429 oneChild = true;
4434 signature = this.ParseSimpleRefElement(child, "Signature"); 4430 signature = this.ParseSimpleRefElement(child, "Signature");
4435 break; 4431 break;
4436 default: 4432 default:
4437 this.Core.UnexpectedElement(node, child); 4433 this.Core.UnexpectedElement(node, child);
4438 break; 4434 break;
4439 } 4435 }
4440 4436
4441 // If AssignToProperty is set, only a FileSearch 4437 // If AssignToProperty is set, only a FileSearch
@@ -4497,30 +4493,30 @@ namespace WixToolset.Core
4497 /// <returns>Signature of search element.</returns> 4493 /// <returns>Signature of search element.</returns>
4498 private string ParseDirectorySearchRefElement(XElement node, string parentSignature) 4494 private string ParseDirectorySearchRefElement(XElement node, string parentSignature)
4499 { 4495 {
4500 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 4496 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
4501 Identifier id = null; 4497 Identifier id = null;
4502 Identifier parent = null; 4498 Identifier parent = null;
4503 string path = null; 4499 string path = null;
4504 string signature = null; 4500 string signature = null;
4505 4501
4506 foreach (XAttribute attrib in node.Attributes()) 4502 foreach (var attrib in node.Attributes())
4507 { 4503 {
4508 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 4504 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
4509 { 4505 {
4510 switch (attrib.Name.LocalName) 4506 switch (attrib.Name.LocalName)
4511 { 4507 {
4512 case "Id": 4508 case "Id":
4513 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 4509 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
4514 break; 4510 break;
4515 case "Parent": 4511 case "Parent":
4516 parent = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 4512 parent = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
4517 break; 4513 break;
4518 case "Path": 4514 case "Path":
4519 path = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4515 path = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4520 break; 4516 break;
4521 default: 4517 default:
4522 this.Core.UnexpectedAttribute(node, attrib); 4518 this.Core.UnexpectedAttribute(node, attrib);
4523 break; 4519 break;
4524 } 4520 }
4525 } 4521 }
4526 else 4522 else
@@ -4548,49 +4544,49 @@ namespace WixToolset.Core
4548 4544
4549 signature = id.Id; 4545 signature = id.Id;
4550 4546
4551 bool oneChild = false; 4547 var oneChild = false;
4552 foreach (XElement child in node.Elements()) 4548 foreach (var child in node.Elements())
4553 { 4549 {
4554 if (CompilerCore.WixNamespace == child.Name.Namespace) 4550 if (CompilerCore.WixNamespace == child.Name.Namespace)
4555 { 4551 {
4556 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 4552 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
4557 switch (child.Name.LocalName) 4553 switch (child.Name.LocalName)
4558 { 4554 {
4559 case "DirectorySearch": 4555 case "DirectorySearch":
4560 if (oneChild) 4556 if (oneChild)
4561 { 4557 {
4562 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); 4558 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName));
4563 } 4559 }
4564 oneChild = true; 4560 oneChild = true;
4565 signature = this.ParseDirectorySearchElement(child, id.Id); 4561 signature = this.ParseDirectorySearchElement(child, id.Id);
4566 break; 4562 break;
4567 case "DirectorySearchRef": 4563 case "DirectorySearchRef":
4568 if (oneChild) 4564 if (oneChild)
4569 { 4565 {
4570 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); 4566 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName));
4571 } 4567 }
4572 oneChild = true; 4568 oneChild = true;
4573 signature = this.ParseDirectorySearchRefElement(child, id.Id); 4569 signature = this.ParseDirectorySearchRefElement(child, id.Id);
4574 break; 4570 break;
4575 case "FileSearch": 4571 case "FileSearch":
4576 if (oneChild) 4572 if (oneChild)
4577 { 4573 {
4578 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); 4574 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName));
4579 } 4575 }
4580 oneChild = true; 4576 oneChild = true;
4581 signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet); 4577 signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet);
4582 break; 4578 break;
4583 case "FileSearchRef": 4579 case "FileSearchRef":
4584 if (oneChild) 4580 if (oneChild)
4585 { 4581 {
4586 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 4582 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
4587 } 4583 }
4588 oneChild = true; 4584 oneChild = true;
4589 signature = this.ParseSimpleRefElement(child, "Signature"); 4585 signature = this.ParseSimpleRefElement(child, "Signature");
4590 break; 4586 break;
4591 default: 4587 default:
4592 this.Core.UnexpectedElement(node, child); 4588 this.Core.UnexpectedElement(node, child);
4593 break; 4589 break;
4594 } 4590 }
4595 } 4591 }
4596 else 4592 else
@@ -4616,132 +4612,132 @@ namespace WixToolset.Core
4616 [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 4612 [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
4617 private void ParseFeatureElement(XElement node, ComplexReferenceParentType parentType, string parentId, ref int lastDisplay) 4613 private void ParseFeatureElement(XElement node, ComplexReferenceParentType parentType, string parentId, ref int lastDisplay)
4618 { 4614 {
4619 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 4615 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
4620 Identifier id = null; 4616 Identifier id = null;
4621 string allowAdvertise = null; 4617 string allowAdvertise = null;
4622 int bits = 0; 4618 var bits = 0;
4623 string configurableDirectory = null; 4619 string configurableDirectory = null;
4624 string description = null; 4620 string description = null;
4625 string display = "collapse"; 4621 var display = "collapse";
4626 YesNoType followParent = YesNoType.NotSet; 4622 var followParent = YesNoType.NotSet;
4627 string installDefault = null; 4623 string installDefault = null;
4628 int level = 1; 4624 var level = 1;
4629 string title = null; 4625 string title = null;
4630 string typicalDefault = null; 4626 string typicalDefault = null;
4631 4627
4632 foreach (XAttribute attrib in node.Attributes()) 4628 foreach (var attrib in node.Attributes())
4633 { 4629 {
4634 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 4630 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
4635 { 4631 {
4636 switch (attrib.Name.LocalName) 4632 switch (attrib.Name.LocalName)
4637 { 4633 {
4638 case "Id": 4634 case "Id":
4639 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 4635 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
4640 break; 4636 break;
4641 case "Absent": 4637 case "Absent":
4642 string absent = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4638 var absent = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4643 if (0 < absent.Length) 4639 if (0 < absent.Length)
4640 {
4641 var absentType = Wix.Feature.ParseAbsentType(absent);
4642 switch (absentType)
4644 { 4643 {
4645 Wix.Feature.AbsentType absentType = Wix.Feature.ParseAbsentType(absent); 4644 case Wix.Feature.AbsentType.allow: // this is the default
4646 switch (absentType) 4645 break;
4647 { 4646 case Wix.Feature.AbsentType.disallow:
4648 case Wix.Feature.AbsentType.allow: // this is the default 4647 bits = bits | MsiInterop.MsidbFeatureAttributesUIDisallowAbsent;
4649 break; 4648 break;
4650 case Wix.Feature.AbsentType.disallow: 4649 default:
4651 bits = bits | MsiInterop.MsidbFeatureAttributesUIDisallowAbsent; 4650 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, absent, "allow", "disallow"));
4652 break; 4651 break;
4653 default:
4654 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, absent, "allow", "disallow"));
4655 break;
4656 }
4657 } 4652 }
4658 break; 4653 }
4659 case "AllowAdvertise": 4654 break;
4660 allowAdvertise = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4655 case "AllowAdvertise":
4661 if (0 < allowAdvertise.Length) 4656 allowAdvertise = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4657 if (0 < allowAdvertise.Length)
4658 {
4659 var allowAdvertiseType = Wix.Feature.ParseAllowAdvertiseType(allowAdvertise);
4660 switch (allowAdvertiseType)
4662 { 4661 {
4663 Wix.Feature.AllowAdvertiseType allowAdvertiseType = Wix.Feature.ParseAllowAdvertiseType(allowAdvertise); 4662 case Wix.Feature.AllowAdvertiseType.no:
4664 switch (allowAdvertiseType) 4663 bits |= MsiInterop.MsidbFeatureAttributesDisallowAdvertise;
4665 { 4664 break;
4666 case Wix.Feature.AllowAdvertiseType.no: 4665 case Wix.Feature.AllowAdvertiseType.system:
4667 bits |= MsiInterop.MsidbFeatureAttributesDisallowAdvertise; 4666 bits |= MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise;
4668 break; 4667 break;
4669 case Wix.Feature.AllowAdvertiseType.system: 4668 case Wix.Feature.AllowAdvertiseType.yes: // this is the default
4670 bits |= MsiInterop.MsidbFeatureAttributesNoUnsupportedAdvertise; 4669 break;
4671 break; 4670 default:
4672 case Wix.Feature.AllowAdvertiseType.yes: // this is the default 4671 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, allowAdvertise, "no", "system", "yes"));
4673 break; 4672 break;
4674 default:
4675 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, allowAdvertise, "no", "system", "yes"));
4676 break;
4677 }
4678 } 4673 }
4679 break; 4674 }
4680 case "ConfigurableDirectory": 4675 break;
4681 configurableDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); 4676 case "ConfigurableDirectory":
4682 break; 4677 configurableDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null);
4683 case "Description": 4678 break;
4684 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4679 case "Description":
4685 break; 4680 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4686 case "Display": 4681 break;
4687 display = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4682 case "Display":
4688 break; 4683 display = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4689 case "InstallDefault": 4684 break;
4690 installDefault = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4685 case "InstallDefault":
4691 if (0 < installDefault.Length) 4686 installDefault = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4687 if (0 < installDefault.Length)
4688 {
4689 var installDefaultType = Wix.Feature.ParseInstallDefaultType(installDefault);
4690 switch (installDefaultType)
4692 { 4691 {
4693 Wix.Feature.InstallDefaultType installDefaultType = Wix.Feature.ParseInstallDefaultType(installDefault); 4692 case Wix.Feature.InstallDefaultType.followParent:
4694 switch (installDefaultType) 4693 if (ComplexReferenceParentType.Product == parentType)
4695 { 4694 {
4696 case Wix.Feature.InstallDefaultType.followParent: 4695 this.Core.Write(ErrorMessages.RootFeatureCannotFollowParent(sourceLineNumbers));
4697 if (ComplexReferenceParentType.Product == parentType)
4698 {
4699 this.Core.Write(ErrorMessages.RootFeatureCannotFollowParent(sourceLineNumbers));
4700 }
4701 bits = bits | MsiInterop.MsidbFeatureAttributesFollowParent;
4702 break;
4703 case Wix.Feature.InstallDefaultType.local: // this is the default
4704 break;
4705 case Wix.Feature.InstallDefaultType.source:
4706 bits = bits | MsiInterop.MsidbFeatureAttributesFavorSource;
4707 break;
4708 default:
4709 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installDefault, "followParent", "local", "source"));
4710 break;
4711 } 4696 }
4697 bits = bits | MsiInterop.MsidbFeatureAttributesFollowParent;
4698 break;
4699 case Wix.Feature.InstallDefaultType.local: // this is the default
4700 break;
4701 case Wix.Feature.InstallDefaultType.source:
4702 bits = bits | MsiInterop.MsidbFeatureAttributesFavorSource;
4703 break;
4704 default:
4705 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installDefault, "followParent", "local", "source"));
4706 break;
4712 } 4707 }
4713 break; 4708 }
4714 case "Level": 4709 break;
4715 level = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 4710 case "Level":
4716 break; 4711 level = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
4717 case "Title": 4712 break;
4718 title = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4713 case "Title":
4719 if ("PUT-FEATURE-TITLE-HERE" == title) 4714 title = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4720 { 4715 if ("PUT-FEATURE-TITLE-HERE" == title)
4721 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, title)); 4716 {
4722 } 4717 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, title));
4723 break; 4718 }
4724 case "TypicalDefault": 4719 break;
4725 typicalDefault = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 4720 case "TypicalDefault":
4726 if (0 < typicalDefault.Length) 4721 typicalDefault = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
4722 if (0 < typicalDefault.Length)
4723 {
4724 var typicalDefaultType = Wix.Feature.ParseTypicalDefaultType(typicalDefault);
4725 switch (typicalDefaultType)
4727 { 4726 {
4728 Wix.Feature.TypicalDefaultType typicalDefaultType = Wix.Feature.ParseTypicalDefaultType(typicalDefault); 4727 case Wix.Feature.TypicalDefaultType.advertise:
4729 switch (typicalDefaultType) 4728 bits = bits | MsiInterop.MsidbFeatureAttributesFavorAdvertise;
4730 { 4729 break;
4731 case Wix.Feature.TypicalDefaultType.advertise: 4730 case Wix.Feature.TypicalDefaultType.install: // this is the default
4732 bits = bits | MsiInterop.MsidbFeatureAttributesFavorAdvertise; 4731 break;
4733 break; 4732 default:
4734 case Wix.Feature.TypicalDefaultType.install: // this is the default 4733 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typicalDefault, "advertise", "install"));
4735 break; 4734 break;
4736 default:
4737 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typicalDefault, "advertise", "install"));
4738 break;
4739 }
4740 } 4735 }
4741 break; 4736 }
4742 default: 4737 break;
4743 this.Core.UnexpectedAttribute(node, attrib); 4738 default:
4744 break; 4739 this.Core.UnexpectedAttribute(node, attrib);
4740 break;
4745 } 4741 }
4746 } 4742 }
4747 else 4743 else
@@ -4775,40 +4771,40 @@ namespace WixToolset.Core
4775 this.Core.Write(ErrorMessages.FeatureCannotFollowParentAndFavorLocalOrSource(sourceLineNumbers, node.Name.LocalName, "InstallDefault", "FollowParent", "yes")); 4771 this.Core.Write(ErrorMessages.FeatureCannotFollowParentAndFavorLocalOrSource(sourceLineNumbers, node.Name.LocalName, "InstallDefault", "FollowParent", "yes"));
4776 } 4772 }
4777 4773
4778 int childDisplay = 0; 4774 var childDisplay = 0;
4779 foreach (XElement child in node.Elements()) 4775 foreach (var child in node.Elements())
4780 { 4776 {
4781 if (CompilerCore.WixNamespace == child.Name.Namespace) 4777 if (CompilerCore.WixNamespace == child.Name.Namespace)
4782 { 4778 {
4783 switch (child.Name.LocalName) 4779 switch (child.Name.LocalName)
4784 { 4780 {
4785 case "ComponentGroupRef": 4781 case "ComponentGroupRef":
4786 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.Feature, id.Id, null); 4782 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.Feature, id.Id, null);
4787 break; 4783 break;
4788 case "ComponentRef": 4784 case "ComponentRef":
4789 this.ParseComponentRefElement(child, ComplexReferenceParentType.Feature, id.Id, null); 4785 this.ParseComponentRefElement(child, ComplexReferenceParentType.Feature, id.Id, null);
4790 break; 4786 break;
4791 case "Component": 4787 case "Component":
4792 this.ParseComponentElement(child, ComplexReferenceParentType.Feature, id.Id, null, CompilerConstants.IntegerNotSet, null, null); 4788 this.ParseComponentElement(child, ComplexReferenceParentType.Feature, id.Id, null, CompilerConstants.IntegerNotSet, null, null);
4793 break; 4789 break;
4794 case "Condition": 4790 case "Condition":
4795 this.ParseConditionElement(child, node.Name.LocalName, id.Id, null); 4791 this.ParseConditionElement(child, node.Name.LocalName, id.Id, null);
4796 break; 4792 break;
4797 case "Feature": 4793 case "Feature":
4798 this.ParseFeatureElement(child, ComplexReferenceParentType.Feature, id.Id, ref childDisplay); 4794 this.ParseFeatureElement(child, ComplexReferenceParentType.Feature, id.Id, ref childDisplay);
4799 break; 4795 break;
4800 case "FeatureGroupRef": 4796 case "FeatureGroupRef":
4801 this.ParseFeatureGroupRefElement(child, ComplexReferenceParentType.Feature, id.Id); 4797 this.ParseFeatureGroupRefElement(child, ComplexReferenceParentType.Feature, id.Id);
4802 break; 4798 break;
4803 case "FeatureRef": 4799 case "FeatureRef":
4804 this.ParseFeatureRefElement(child, ComplexReferenceParentType.Feature, id.Id); 4800 this.ParseFeatureRefElement(child, ComplexReferenceParentType.Feature, id.Id);
4805 break; 4801 break;
4806 case "MergeRef": 4802 case "MergeRef":
4807 this.ParseMergeRefElement(child, ComplexReferenceParentType.Feature, id.Id); 4803 this.ParseMergeRefElement(child, ComplexReferenceParentType.Feature, id.Id);
4808 break; 4804 break;
4809 default: 4805 default:
4810 this.Core.UnexpectedElement(node, child); 4806 this.Core.UnexpectedElement(node, child);
4811 break; 4807 break;
4812 } 4808 }
4813 } 4809 }
4814 else 4810 else
@@ -4827,33 +4823,33 @@ namespace WixToolset.Core
4827 { 4823 {
4828 switch (display) 4824 switch (display)
4829 { 4825 {
4830 case "collapse": 4826 case "collapse":
4831 lastDisplay = (lastDisplay | 1) + 1; 4827 lastDisplay = (lastDisplay | 1) + 1;
4832 row.Set(4, lastDisplay); 4828 row.Set(4, lastDisplay);
4833 break; 4829 break;
4834 case "expand": 4830 case "expand":
4835 lastDisplay = (lastDisplay + 1) | 1; 4831 lastDisplay = (lastDisplay + 1) | 1;
4836 row.Set(4, lastDisplay); 4832 row.Set(4, lastDisplay);
4837 break; 4833 break;
4838 case "hidden": 4834 case "hidden":
4839 row.Set(4, 0); 4835 row.Set(4, 0);
4840 break; 4836 break;
4841 default: 4837 default:
4842 int value; 4838 int value;
4843 if (!Int32.TryParse(display, NumberStyles.Integer, CultureInfo.InvariantCulture, out value)) 4839 if (!Int32.TryParse(display, NumberStyles.Integer, CultureInfo.InvariantCulture, out value))
4840 {
4841 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Display", display, "collapse", "expand", "hidden"));
4842 }
4843 else
4844 {
4845 row.Set(4, value);
4846 // save the display value of this row (if its not hidden) for subsequent rows
4847 if (0 != (int)row[4])
4844 { 4848 {
4845 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Display", display, "collapse", "expand", "hidden")); 4849 lastDisplay = (int)row[4];
4846 } 4850 }
4847 else 4851 }
4848 { 4852 break;
4849 row.Set(4, value);
4850 // save the display value of this row (if its not hidden) for subsequent rows
4851 if (0 != (int)row[4])
4852 {
4853 lastDisplay = (int)row[4];
4854 }
4855 }
4856 break;
4857 } 4853 }
4858 } 4854 }
4859 row.Set(5, level); 4855 row.Set(5, level);
@@ -4876,26 +4872,26 @@ namespace WixToolset.Core
4876 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 4872 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
4877 private void ParseFeatureRefElement(XElement node, ComplexReferenceParentType parentType, string parentId) 4873 private void ParseFeatureRefElement(XElement node, ComplexReferenceParentType parentType, string parentId)
4878 { 4874 {
4879 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 4875 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
4880 string id = null; 4876 string id = null;
4881 YesNoType ignoreParent = YesNoType.NotSet; 4877 var ignoreParent = YesNoType.NotSet;
4882 4878
4883 foreach (XAttribute attrib in node.Attributes()) 4879 foreach (var attrib in node.Attributes())
4884 { 4880 {
4885 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 4881 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
4886 { 4882 {
4887 switch (attrib.Name.LocalName) 4883 switch (attrib.Name.LocalName)
4888 { 4884 {
4889 case "Id": 4885 case "Id":
4890 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 4886 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
4891 this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", id); 4887 this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", id);
4892 break; 4888 break;
4893 case "IgnoreParent": 4889 case "IgnoreParent":
4894 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 4890 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
4895 break; 4891 break;
4896 default: 4892 default:
4897 this.Core.UnexpectedAttribute(node, attrib); 4893 this.Core.UnexpectedAttribute(node, attrib);
4898 break; 4894 break;
4899 } 4895 }
4900 } 4896 }
4901 else 4897 else
@@ -4910,40 +4906,40 @@ namespace WixToolset.Core
4910 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); 4906 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
4911 } 4907 }
4912 4908
4913 int lastDisplay = 0; 4909 var lastDisplay = 0;
4914 foreach (XElement child in node.Elements()) 4910 foreach (var child in node.Elements())
4915 { 4911 {
4916 if (CompilerCore.WixNamespace == child.Name.Namespace) 4912 if (CompilerCore.WixNamespace == child.Name.Namespace)
4917 { 4913 {
4918 switch (child.Name.LocalName) 4914 switch (child.Name.LocalName)
4919 { 4915 {
4920 case "ComponentGroupRef": 4916 case "ComponentGroupRef":
4921 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.Feature, id, null); 4917 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.Feature, id, null);
4922 break; 4918 break;
4923 case "ComponentRef": 4919 case "ComponentRef":
4924 this.ParseComponentRefElement(child, ComplexReferenceParentType.Feature, id, null); 4920 this.ParseComponentRefElement(child, ComplexReferenceParentType.Feature, id, null);
4925 break; 4921 break;
4926 case "Component": 4922 case "Component":
4927 this.ParseComponentElement(child, ComplexReferenceParentType.Feature, id, null, CompilerConstants.IntegerNotSet, null, null); 4923 this.ParseComponentElement(child, ComplexReferenceParentType.Feature, id, null, CompilerConstants.IntegerNotSet, null, null);
4928 break; 4924 break;
4929 case "Feature": 4925 case "Feature":
4930 this.ParseFeatureElement(child, ComplexReferenceParentType.Feature, id, ref lastDisplay); 4926 this.ParseFeatureElement(child, ComplexReferenceParentType.Feature, id, ref lastDisplay);
4931 break; 4927 break;
4932 case "FeatureGroup": 4928 case "FeatureGroup":
4933 this.ParseFeatureGroupElement(child, ComplexReferenceParentType.Feature, id); 4929 this.ParseFeatureGroupElement(child, ComplexReferenceParentType.Feature, id);
4934 break; 4930 break;
4935 case "FeatureGroupRef": 4931 case "FeatureGroupRef":
4936 this.ParseFeatureGroupRefElement(child, ComplexReferenceParentType.Feature, id); 4932 this.ParseFeatureGroupRefElement(child, ComplexReferenceParentType.Feature, id);
4937 break; 4933 break;
4938 case "FeatureRef": 4934 case "FeatureRef":
4939 this.ParseFeatureRefElement(child, ComplexReferenceParentType.Feature, id); 4935 this.ParseFeatureRefElement(child, ComplexReferenceParentType.Feature, id);
4940 break; 4936 break;
4941 case "MergeRef": 4937 case "MergeRef":
4942 this.ParseMergeRefElement(child, ComplexReferenceParentType.Feature, id); 4938 this.ParseMergeRefElement(child, ComplexReferenceParentType.Feature, id);
4943 break; 4939 break;
4944 default: 4940 default:
4945 this.Core.UnexpectedElement(node, child); 4941 this.Core.UnexpectedElement(node, child);
4946 break; 4942 break;
4947 } 4943 }
4948 } 4944 }
4949 else 4945 else
@@ -4968,21 +4964,21 @@ namespace WixToolset.Core
4968 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 4964 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
4969 private void ParseFeatureGroupElement(XElement node, ComplexReferenceParentType parentType, string parentId) 4965 private void ParseFeatureGroupElement(XElement node, ComplexReferenceParentType parentType, string parentId)
4970 { 4966 {
4971 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 4967 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
4972 Identifier id = null; 4968 Identifier id = null;
4973 4969
4974 foreach (XAttribute attrib in node.Attributes()) 4970 foreach (var attrib in node.Attributes())
4975 { 4971 {
4976 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 4972 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
4977 { 4973 {
4978 switch (attrib.Name.LocalName) 4974 switch (attrib.Name.LocalName)
4979 { 4975 {
4980 case "Id": 4976 case "Id":
4981 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 4977 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
4982 break; 4978 break;
4983 default: 4979 default:
4984 this.Core.UnexpectedAttribute(node, attrib); 4980 this.Core.UnexpectedAttribute(node, attrib);
4985 break; 4981 break;
4986 } 4982 }
4987 } 4983 }
4988 else 4984 else
@@ -4997,37 +4993,37 @@ namespace WixToolset.Core
4997 id = Identifier.Invalid; 4993 id = Identifier.Invalid;
4998 } 4994 }
4999 4995
5000 int lastDisplay = 0; 4996 var lastDisplay = 0;
5001 foreach (XElement child in node.Elements()) 4997 foreach (var child in node.Elements())
5002 { 4998 {
5003 if (CompilerCore.WixNamespace == child.Name.Namespace) 4999 if (CompilerCore.WixNamespace == child.Name.Namespace)
5004 { 5000 {
5005 switch (child.Name.LocalName) 5001 switch (child.Name.LocalName)
5006 { 5002 {
5007 case "ComponentGroupRef": 5003 case "ComponentGroupRef":
5008 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id, null); 5004 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id, null);
5009 break; 5005 break;
5010 case "ComponentRef": 5006 case "ComponentRef":
5011 this.ParseComponentRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id, null); 5007 this.ParseComponentRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id, null);
5012 break; 5008 break;
5013 case "Component": 5009 case "Component":
5014 this.ParseComponentElement(child, ComplexReferenceParentType.FeatureGroup, id.Id, null, CompilerConstants.IntegerNotSet, null, null); 5010 this.ParseComponentElement(child, ComplexReferenceParentType.FeatureGroup, id.Id, null, CompilerConstants.IntegerNotSet, null, null);
5015 break; 5011 break;
5016 case "Feature": 5012 case "Feature":
5017 this.ParseFeatureElement(child, ComplexReferenceParentType.FeatureGroup, id.Id, ref lastDisplay); 5013 this.ParseFeatureElement(child, ComplexReferenceParentType.FeatureGroup, id.Id, ref lastDisplay);
5018 break; 5014 break;
5019 case "FeatureGroupRef": 5015 case "FeatureGroupRef":
5020 this.ParseFeatureGroupRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id); 5016 this.ParseFeatureGroupRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id);
5021 break; 5017 break;
5022 case "FeatureRef": 5018 case "FeatureRef":
5023 this.ParseFeatureRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id); 5019 this.ParseFeatureRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id);
5024 break; 5020 break;
5025 case "MergeRef": 5021 case "MergeRef":
5026 this.ParseMergeRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id); 5022 this.ParseMergeRefElement(child, ComplexReferenceParentType.FeatureGroup, id.Id);
5027 break; 5023 break;
5028 default: 5024 default:
5029 this.Core.UnexpectedElement(node, child); 5025 this.Core.UnexpectedElement(node, child);
5030 break; 5026 break;
5031 } 5027 }
5032 } 5028 }
5033 else 5029 else
@@ -5055,30 +5051,30 @@ namespace WixToolset.Core
5055 { 5051 {
5056 Debug.Assert(ComplexReferenceParentType.Feature == parentType || ComplexReferenceParentType.FeatureGroup == parentType || ComplexReferenceParentType.ComponentGroup == parentType || ComplexReferenceParentType.Product == parentType); 5052 Debug.Assert(ComplexReferenceParentType.Feature == parentType || ComplexReferenceParentType.FeatureGroup == parentType || ComplexReferenceParentType.ComponentGroup == parentType || ComplexReferenceParentType.Product == parentType);
5057 5053
5058 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 5054 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
5059 string id = null; 5055 string id = null;
5060 YesNoType ignoreParent = YesNoType.NotSet; 5056 var ignoreParent = YesNoType.NotSet;
5061 YesNoType primary = YesNoType.NotSet; 5057 var primary = YesNoType.NotSet;
5062 5058
5063 foreach (XAttribute attrib in node.Attributes()) 5059 foreach (var attrib in node.Attributes())
5064 { 5060 {
5065 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 5061 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
5066 { 5062 {
5067 switch (attrib.Name.LocalName) 5063 switch (attrib.Name.LocalName)
5068 { 5064 {
5069 case "Id": 5065 case "Id":
5070 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5066 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5071 this.Core.CreateSimpleReference(sourceLineNumbers, "WixFeatureGroup", id); 5067 this.Core.CreateSimpleReference(sourceLineNumbers, "WixFeatureGroup", id);
5072 break; 5068 break;
5073 case "IgnoreParent": 5069 case "IgnoreParent":
5074 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 5070 ignoreParent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5075 break; 5071 break;
5076 case "Primary": 5072 case "Primary":
5077 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 5073 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5078 break; 5074 break;
5079 default: 5075 default:
5080 this.Core.UnexpectedAttribute(node, attrib); 5076 this.Core.UnexpectedAttribute(node, attrib);
5081 break; 5077 break;
5082 } 5078 }
5083 } 5079 }
5084 else 5080 else
@@ -5110,74 +5106,74 @@ namespace WixToolset.Core
5110 /// <param name="componentId">Identifier of parent component.</param> 5106 /// <param name="componentId">Identifier of parent component.</param>
5111 private void ParseEnvironmentElement(XElement node, string componentId) 5107 private void ParseEnvironmentElement(XElement node, string componentId)
5112 { 5108 {
5113 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 5109 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
5114 Identifier id = null; 5110 Identifier id = null;
5115 string action = null; 5111 string action = null;
5116 string name = null; 5112 string name = null;
5117 Wix.Environment.PartType partType = Wix.Environment.PartType.NotSet; 5113 var partType = Wix.Environment.PartType.NotSet;
5118 string part = null; 5114 string part = null;
5119 bool permanent = false; 5115 var permanent = false;
5120 string separator = ";"; // default to ';' 5116 var separator = ";"; // default to ';'
5121 bool system = false; 5117 var system = false;
5122 string text = null; 5118 string text = null;
5123 string uninstall = "-"; // default to remove at uninstall 5119 var uninstall = "-"; // default to remove at uninstall
5124 5120
5125 foreach (XAttribute attrib in node.Attributes()) 5121 foreach (var attrib in node.Attributes())
5126 { 5122 {
5127 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 5123 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
5128 { 5124 {
5129 switch (attrib.Name.LocalName) 5125 switch (attrib.Name.LocalName)
5130 { 5126 {
5131 case "Id": 5127 case "Id":
5132 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 5128 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
5133 break; 5129 break;
5134 case "Action": 5130 case "Action":
5135 string value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5131 var value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5136 if (0 < value.Length) 5132 if (0 < value.Length)
5137 { 5133 {
5138 Wix.Environment.ActionType actionType = Wix.Environment.ParseActionType(value); 5134 var actionType = Wix.Environment.ParseActionType(value);
5139 switch (actionType) 5135 switch (actionType)
5140 {
5141 case Wix.Environment.ActionType.create:
5142 action = "+";
5143 break;
5144 case Wix.Environment.ActionType.set:
5145 action = "=";
5146 break;
5147 case Wix.Environment.ActionType.remove:
5148 action = "!";
5149 break;
5150 default:
5151 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "create", "set", "remove"));
5152 break;
5153 }
5154 }
5155 break;
5156 case "Name":
5157 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5158 break;
5159 case "Part":
5160 part = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5161 if (!Wix.Environment.TryParsePartType(part, out partType))
5162 { 5136 {
5163 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Part", part, "all", "first", "last")); 5137 case Wix.Environment.ActionType.create:
5138 action = "+";
5139 break;
5140 case Wix.Environment.ActionType.set:
5141 action = "=";
5142 break;
5143 case Wix.Environment.ActionType.remove:
5144 action = "!";
5145 break;
5146 default:
5147 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "create", "set", "remove"));
5148 break;
5164 } 5149 }
5165 break; 5150 }
5166 case "Permanent": 5151 break;
5167 permanent = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 5152 case "Name":
5168 break; 5153 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5169 case "Separator": 5154 break;
5170 separator = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5155 case "Part":
5171 break; 5156 part = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5172 case "System": 5157 if (!Wix.Environment.TryParsePartType(part, out partType))
5173 system = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 5158 {
5174 break; 5159 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Part", part, "all", "first", "last"));
5175 case "Value": 5160 }
5176 text = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5161 break;
5177 break; 5162 case "Permanent":
5178 default: 5163 permanent = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5179 this.Core.UnexpectedAttribute(node, attrib); 5164 break;
5180 break; 5165 case "Separator":
5166 separator = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5167 break;
5168 case "System":
5169 system = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5170 break;
5171 case "Value":
5172 text = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5173 break;
5174 default:
5175 this.Core.UnexpectedAttribute(node, attrib);
5176 break;
5181 } 5177 }
5182 } 5178 }
5183 else 5179 else
@@ -5205,14 +5201,14 @@ namespace WixToolset.Core
5205 5201
5206 switch (partType) 5202 switch (partType)
5207 { 5203 {
5208 case Wix.Environment.PartType.all: 5204 case Wix.Environment.PartType.all:
5209 break; 5205 break;
5210 case Wix.Environment.PartType.first: 5206 case Wix.Environment.PartType.first:
5211 text = String.Concat(text, separator, "[~]"); 5207 text = String.Concat(text, separator, "[~]");
5212 break; 5208 break;
5213 case Wix.Environment.PartType.last: 5209 case Wix.Environment.PartType.last:
5214 text = String.Concat("[~]", separator, text); 5210 text = String.Concat("[~]", separator, text);
5215 break; 5211 break;
5216 } 5212 }
5217 } 5213 }
5218 5214
@@ -5238,21 +5234,21 @@ namespace WixToolset.Core
5238 /// <param name="node">Element to parse.</param> 5234 /// <param name="node">Element to parse.</param>
5239 private void ParseErrorElement(XElement node) 5235 private void ParseErrorElement(XElement node)
5240 { 5236 {
5241 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 5237 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
5242 int id = CompilerConstants.IntegerNotSet; 5238 var id = CompilerConstants.IntegerNotSet;
5243 5239
5244 foreach (XAttribute attrib in node.Attributes()) 5240 foreach (var attrib in node.Attributes())
5245 { 5241 {
5246 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 5242 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
5247 { 5243 {
5248 switch (attrib.Name.LocalName) 5244 switch (attrib.Name.LocalName)
5249 { 5245 {
5250 case "Id": 5246 case "Id":
5251 id = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 5247 id = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
5252 break; 5248 break;
5253 default: 5249 default:
5254 this.Core.UnexpectedAttribute(node, attrib); 5250 this.Core.UnexpectedAttribute(node, attrib);
5255 break; 5251 break;
5256 } 5252 }
5257 } 5253 }
5258 else 5254 else
@@ -5286,38 +5282,38 @@ namespace WixToolset.Core
5286 /// <param name="progId">ProgId for extension.</param> 5282 /// <param name="progId">ProgId for extension.</param>
5287 private void ParseExtensionElement(XElement node, string componentId, YesNoType advertise, string progId) 5283 private void ParseExtensionElement(XElement node, string componentId, YesNoType advertise, string progId)
5288 { 5284 {
5289 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 5285 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
5290 string extension = null; 5286 string extension = null;
5291 string mime = null; 5287 string mime = null;
5292 5288
5293 foreach (XAttribute attrib in node.Attributes()) 5289 foreach (var attrib in node.Attributes())
5294 { 5290 {
5295 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 5291 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
5296 { 5292 {
5297 switch (attrib.Name.LocalName) 5293 switch (attrib.Name.LocalName)
5298 { 5294 {
5299 case "Id": 5295 case "Id":
5300 extension = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5296 extension = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5301 break; 5297 break;
5302 case "Advertise": 5298 case "Advertise":
5303 YesNoType extensionAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 5299 var extensionAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5304 if ((YesNoType.No == advertise && YesNoType.Yes == extensionAdvertise) || (YesNoType.Yes == advertise && YesNoType.No == extensionAdvertise)) 5300 if ((YesNoType.No == advertise && YesNoType.Yes == extensionAdvertise) || (YesNoType.Yes == advertise && YesNoType.No == extensionAdvertise))
5305 { 5301 {
5306 this.Core.Write(ErrorMessages.AdvertiseStateMustMatch(sourceLineNumbers, extensionAdvertise.ToString(), advertise.ToString())); 5302 this.Core.Write(ErrorMessages.AdvertiseStateMustMatch(sourceLineNumbers, extensionAdvertise.ToString(), advertise.ToString()));
5307 } 5303 }
5308 advertise = extensionAdvertise; 5304 advertise = extensionAdvertise;
5309 break; 5305 break;
5310 case "ContentType": 5306 case "ContentType":
5311 mime = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5307 mime = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5312 break; 5308 break;
5313 default: 5309 default:
5314 this.Core.UnexpectedAttribute(node, attrib); 5310 this.Core.UnexpectedAttribute(node, attrib);
5315 break; 5311 break;
5316 } 5312 }
5317 } 5313 }
5318 else 5314 else
5319 { 5315 {
5320 Dictionary<string, string> context = new Dictionary<string, string>() { { "ProgId", progId }, { "ComponentId", componentId } }; 5316 var context = new Dictionary<string, string>() { { "ProgId", progId }, { "ComponentId", componentId } };
5321 this.Core.ParseExtensionAttribute(node, attrib, context); 5317 this.Core.ParseExtensionAttribute(node, attrib, context);
5322 } 5318 }
5323 } 5319 }
@@ -5327,25 +5323,25 @@ namespace WixToolset.Core
5327 advertise = YesNoType.No; 5323 advertise = YesNoType.No;
5328 } 5324 }
5329 5325
5330 foreach (XElement child in node.Elements()) 5326 foreach (var child in node.Elements())
5331 { 5327 {
5332 if (CompilerCore.WixNamespace == child.Name.Namespace) 5328 if (CompilerCore.WixNamespace == child.Name.Namespace)
5333 { 5329 {
5334 switch (child.Name.LocalName) 5330 switch (child.Name.LocalName)
5335 { 5331 {
5336 case "Verb": 5332 case "Verb":
5337 this.ParseVerbElement(child, extension, progId, componentId, advertise); 5333 this.ParseVerbElement(child, extension, progId, componentId, advertise);
5338 break; 5334 break;
5339 case "MIME": 5335 case "MIME":
5340 string newMime = this.ParseMIMEElement(child, extension, componentId, advertise); 5336 var newMime = this.ParseMIMEElement(child, extension, componentId, advertise);
5341 if (null != newMime && null == mime) 5337 if (null != newMime && null == mime)
5342 { 5338 {
5343 mime = newMime; 5339 mime = newMime;
5344 } 5340 }
5345 break; 5341 break;
5346 default: 5342 default:
5347 this.Core.UnexpectedElement(node, child); 5343 this.Core.UnexpectedElement(node, child);
5348 break; 5344 break;
5349 } 5345 }
5350 } 5346 }
5351 else 5347 else
@@ -5394,33 +5390,33 @@ namespace WixToolset.Core
5394 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 5390 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
5395 private YesNoType ParseFileElement(XElement node, string componentId, string directoryId, int diskId, string sourcePath, out string possibleKeyPath, bool win64Component, string componentGuid) 5391 private YesNoType ParseFileElement(XElement node, string componentId, string directoryId, int diskId, string sourcePath, out string possibleKeyPath, bool win64Component, string componentGuid)
5396 { 5392 {
5397 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 5393 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
5398 Identifier id = null; 5394 Identifier id = null;
5399 FileAssemblyType assemblyType = FileAssemblyType.NotAnAssembly; 5395 var assemblyType = FileAssemblyType.NotAnAssembly;
5400 string assemblyApplication = null; 5396 string assemblyApplication = null;
5401 string assemblyManifest = null; 5397 string assemblyManifest = null;
5402 string bindPath = null; 5398 string bindPath = null;
5403 5399
5404 //int bits = MsiInterop.MsidbFileAttributesVital; 5400 //int bits = MsiInterop.MsidbFileAttributesVital;
5405 bool readOnly = false; 5401 var readOnly = false;
5406 bool checksum = false; 5402 var checksum = false;
5407 bool? compressed = null; 5403 bool? compressed = null;
5408 bool hidden = false; 5404 var hidden = false;
5409 bool system = false; 5405 var system = false;
5410 bool vital = true; // assume all files are vital. 5406 var vital = true; // assume all files are vital.
5411 5407
5412 string companionFile = null; 5408 string companionFile = null;
5413 string defaultLanguage = null; 5409 string defaultLanguage = null;
5414 int defaultSize = 0; 5410 var defaultSize = 0;
5415 string defaultVersion = null; 5411 string defaultVersion = null;
5416 string fontTitle = null; 5412 string fontTitle = null;
5417 bool generatedShortFileName = false; 5413 var generatedShortFileName = false;
5418 YesNoType keyPath = YesNoType.NotSet; 5414 var keyPath = YesNoType.NotSet;
5419 string name = null; 5415 string name = null;
5420 int patchGroup = CompilerConstants.IntegerNotSet; 5416 var patchGroup = CompilerConstants.IntegerNotSet;
5421 bool patchIgnore = false; 5417 var patchIgnore = false;
5422 bool patchIncludeWholeFile = false; 5418 var patchIncludeWholeFile = false;
5423 bool patchAllowIgnoreOnError = false; 5419 var patchAllowIgnoreOnError = false;
5424 5420
5425 string ignoreLengths = null; 5421 string ignoreLengths = null;
5426 string ignoreOffsets = null; 5422 string ignoreOffsets = null;
@@ -5429,188 +5425,188 @@ namespace WixToolset.Core
5429 string symbols = null; 5425 string symbols = null;
5430 5426
5431 string procArch = null; 5427 string procArch = null;
5432 int selfRegCost = CompilerConstants.IntegerNotSet; 5428 var selfRegCost = CompilerConstants.IntegerNotSet;
5433 string shortName = null; 5429 string shortName = null;
5434 string source = sourcePath; // assume we'll use the parents as the source for this file 5430 var source = sourcePath; // assume we'll use the parents as the source for this file
5435 bool sourceSet = false; 5431 var sourceSet = false;
5436 5432
5437 foreach (XAttribute attrib in node.Attributes()) 5433 foreach (var attrib in node.Attributes())
5438 { 5434 {
5439 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 5435 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
5440 { 5436 {
5441 switch (attrib.Name.LocalName) 5437 switch (attrib.Name.LocalName)
5442 { 5438 {
5443 case "Id": 5439 case "Id":
5444 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 5440 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
5445 break; 5441 break;
5446 case "Assembly": 5442 case "Assembly":
5447 string assemblyValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5443 var assemblyValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5448 if (0 < assemblyValue.Length) 5444 if (0 < assemblyValue.Length)
5449 { 5445 {
5450 Wix.File.AssemblyType parsedAssemblyType = Wix.File.ParseAssemblyType(assemblyValue); 5446 var parsedAssemblyType = Wix.File.ParseAssemblyType(assemblyValue);
5451 switch (parsedAssemblyType) 5447 switch (parsedAssemblyType)
5452 {
5453 case Wix.File.AssemblyType.net:
5454 assemblyType = FileAssemblyType.DotNetAssembly;
5455 break;
5456 case Wix.File.AssemblyType.no:
5457 assemblyType = FileAssemblyType.NotAnAssembly;
5458 break;
5459 case Wix.File.AssemblyType.win32:
5460 assemblyType = FileAssemblyType.Win32Assembly;
5461 break;
5462 default:
5463 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, "File", "Assembly", assemblyValue, "no", "win32", ".net"));
5464 break;
5465 }
5466 }
5467 break;
5468 case "AssemblyApplication":
5469 assemblyApplication = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5470 this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyApplication);
5471 break;
5472 case "AssemblyManifest":
5473 assemblyManifest = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5474 this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyManifest);
5475 break;
5476 case "BindPath":
5477 bindPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
5478 break;
5479 case "Checksum":
5480 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5481 {
5482 checksum = true;
5483 //bits |= MsiInterop.MsidbFileAttributesChecksum;
5484 }
5485 break;
5486 case "CompanionFile":
5487 companionFile = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5488 this.Core.CreateSimpleReference(sourceLineNumbers, "File", companionFile);
5489 break;
5490 case "Compressed":
5491 YesNoDefaultType compressedValue = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
5492 if (YesNoDefaultType.Yes == compressedValue)
5493 {
5494 compressed = true;
5495 //bits |= MsiInterop.MsidbFileAttributesCompressed;
5496 }
5497 else if (YesNoDefaultType.No == compressedValue)
5498 {
5499 compressed = false;
5500 //bits |= MsiInterop.MsidbFileAttributesNoncompressed;
5501 }
5502 break;
5503 case "DefaultLanguage":
5504 defaultLanguage = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5505 break;
5506 case "DefaultSize":
5507 defaultSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue);
5508 break;
5509 case "DefaultVersion":
5510 defaultVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5511 break;
5512 case "DiskId":
5513 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue);
5514 break;
5515 case "FontTitle":
5516 fontTitle = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5517 break;
5518 case "Hidden":
5519 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5520 {
5521 hidden = true;
5522 //bits |= MsiInterop.MsidbFileAttributesHidden;
5523 }
5524 break;
5525 case "KeyPath":
5526 keyPath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5527 break;
5528 case "Name":
5529 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
5530 break;
5531 case "PatchGroup":
5532 patchGroup = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, int.MaxValue);
5533 break;
5534 case "PatchIgnore":
5535 patchIgnore = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5536 break;
5537 case "PatchWholeFile":
5538 patchIncludeWholeFile = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5539 break;
5540 case "PatchAllowIgnoreOnError":
5541 patchAllowIgnoreOnError = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5542 break;
5543 case "ProcessorArchitecture":
5544 string procArchValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5545 if (0 < procArchValue.Length)
5546 {
5547 Wix.File.ProcessorArchitectureType procArchType = Wix.File.ParseProcessorArchitectureType(procArchValue);
5548 switch (procArchType)
5549 {
5550 case Wix.File.ProcessorArchitectureType.msil:
5551 procArch = "MSIL";
5552 break;
5553 case Wix.File.ProcessorArchitectureType.x86:
5554 procArch = "x86";
5555 break;
5556 case Wix.File.ProcessorArchitectureType.x64:
5557 procArch = "amd64";
5558 break;
5559 case Wix.File.ProcessorArchitectureType.ia64:
5560 procArch = "ia64";
5561 break;
5562 default:
5563 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, "File", "ProcessorArchitecture", procArchValue, "msil", "x86", "x64", "ia64"));
5564 break;
5565 }
5566 }
5567 break;
5568 case "ReadOnly":
5569 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5570 {
5571 readOnly = true;
5572 //bits |= MsiInterop.MsidbFileAttributesReadOnly;
5573 }
5574 break;
5575 case "SelfRegCost":
5576 selfRegCost = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue);
5577 break;
5578 case "ShortName":
5579 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
5580 break;
5581 case "Source":
5582 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5583 sourceSet = true;
5584 break;
5585 case "System":
5586 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5587 {
5588 system = true;
5589 //bits |= MsiInterop.MsidbFileAttributesSystem;
5590 }
5591 break;
5592 case "TrueType":
5593 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5594 {
5595 fontTitle = String.Empty;
5596 }
5597 break;
5598 case "Vital":
5599 YesNoType isVital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5600 if (YesNoType.Yes == isVital)
5601 { 5448 {
5602 vital = true; 5449 case Wix.File.AssemblyType.net:
5603 //bits |= MsiInterop.MsidbFileAttributesVital; 5450 assemblyType = FileAssemblyType.DotNetAssembly;
5451 break;
5452 case Wix.File.AssemblyType.no:
5453 assemblyType = FileAssemblyType.NotAnAssembly;
5454 break;
5455 case Wix.File.AssemblyType.win32:
5456 assemblyType = FileAssemblyType.Win32Assembly;
5457 break;
5458 default:
5459 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, "File", "Assembly", assemblyValue, "no", "win32", ".net"));
5460 break;
5604 } 5461 }
5605 else if (YesNoType.No == isVital) 5462 }
5463 break;
5464 case "AssemblyApplication":
5465 assemblyApplication = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5466 this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyApplication);
5467 break;
5468 case "AssemblyManifest":
5469 assemblyManifest = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5470 this.Core.CreateSimpleReference(sourceLineNumbers, "File", assemblyManifest);
5471 break;
5472 case "BindPath":
5473 bindPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
5474 break;
5475 case "Checksum":
5476 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5477 {
5478 checksum = true;
5479 //bits |= MsiInterop.MsidbFileAttributesChecksum;
5480 }
5481 break;
5482 case "CompanionFile":
5483 companionFile = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
5484 this.Core.CreateSimpleReference(sourceLineNumbers, "File", companionFile);
5485 break;
5486 case "Compressed":
5487 var compressedValue = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
5488 if (YesNoDefaultType.Yes == compressedValue)
5489 {
5490 compressed = true;
5491 //bits |= MsiInterop.MsidbFileAttributesCompressed;
5492 }
5493 else if (YesNoDefaultType.No == compressedValue)
5494 {
5495 compressed = false;
5496 //bits |= MsiInterop.MsidbFileAttributesNoncompressed;
5497 }
5498 break;
5499 case "DefaultLanguage":
5500 defaultLanguage = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5501 break;
5502 case "DefaultSize":
5503 defaultSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
5504 break;
5505 case "DefaultVersion":
5506 defaultVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5507 break;
5508 case "DiskId":
5509 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
5510 break;
5511 case "FontTitle":
5512 fontTitle = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5513 break;
5514 case "Hidden":
5515 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5516 {
5517 hidden = true;
5518 //bits |= MsiInterop.MsidbFileAttributesHidden;
5519 }
5520 break;
5521 case "KeyPath":
5522 keyPath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5523 break;
5524 case "Name":
5525 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
5526 break;
5527 case "PatchGroup":
5528 patchGroup = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int32.MaxValue);
5529 break;
5530 case "PatchIgnore":
5531 patchIgnore = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5532 break;
5533 case "PatchWholeFile":
5534 patchIncludeWholeFile = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5535 break;
5536 case "PatchAllowIgnoreOnError":
5537 patchAllowIgnoreOnError = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5538 break;
5539 case "ProcessorArchitecture":
5540 var procArchValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5541 if (0 < procArchValue.Length)
5542 {
5543 var procArchType = Wix.File.ParseProcessorArchitectureType(procArchValue);
5544 switch (procArchType)
5606 { 5545 {
5607 vital = false; 5546 case Wix.File.ProcessorArchitectureType.msil:
5608 //bits &= ~MsiInterop.MsidbFileAttributesVital; 5547 procArch = "MSIL";
5548 break;
5549 case Wix.File.ProcessorArchitectureType.x86:
5550 procArch = "x86";
5551 break;
5552 case Wix.File.ProcessorArchitectureType.x64:
5553 procArch = "amd64";
5554 break;
5555 case Wix.File.ProcessorArchitectureType.ia64:
5556 procArch = "ia64";
5557 break;
5558 default:
5559 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, "File", "ProcessorArchitecture", procArchValue, "msil", "x86", "x64", "ia64"));
5560 break;
5609 } 5561 }
5610 break; 5562 }
5611 default: 5563 break;
5612 this.Core.UnexpectedAttribute(node, attrib); 5564 case "ReadOnly":
5613 break; 5565 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5566 {
5567 readOnly = true;
5568 //bits |= MsiInterop.MsidbFileAttributesReadOnly;
5569 }
5570 break;
5571 case "SelfRegCost":
5572 selfRegCost = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
5573 break;
5574 case "ShortName":
5575 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
5576 break;
5577 case "Source":
5578 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5579 sourceSet = true;
5580 break;
5581 case "System":
5582 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5583 {
5584 system = true;
5585 //bits |= MsiInterop.MsidbFileAttributesSystem;
5586 }
5587 break;
5588 case "TrueType":
5589 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
5590 {
5591 fontTitle = String.Empty;
5592 }
5593 break;
5594 case "Vital":
5595 var isVital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
5596 if (YesNoType.Yes == isVital)
5597 {
5598 vital = true;
5599 //bits |= MsiInterop.MsidbFileAttributesVital;
5600 }
5601 else if (YesNoType.No == isVital)
5602 {
5603 vital = false;
5604 //bits &= ~MsiInterop.MsidbFileAttributesVital;
5605 }
5606 break;
5607 default:
5608 this.Core.UnexpectedAttribute(node, attrib);
5609 break;
5614 } 5610 }
5615 } 5611 }
5616 else 5612 else
@@ -5685,66 +5681,66 @@ namespace WixToolset.Core
5685 } 5681 }
5686 } 5682 }
5687 5683
5688 foreach (XElement child in node.Elements()) 5684 foreach (var child in node.Elements())
5689 { 5685 {
5690 if (CompilerCore.WixNamespace == child.Name.Namespace) 5686 if (CompilerCore.WixNamespace == child.Name.Namespace)
5691 { 5687 {
5692 switch (child.Name.LocalName) 5688 switch (child.Name.LocalName)
5693 { 5689 {
5694 case "AppId": 5690 case "AppId":
5695 this.ParseAppIdElement(child, componentId, YesNoType.NotSet, id.Id, null, null); 5691 this.ParseAppIdElement(child, componentId, YesNoType.NotSet, id.Id, null, null);
5696 break; 5692 break;
5697 case "AssemblyName": 5693 case "AssemblyName":
5698 this.ParseAssemblyName(child, componentId); 5694 this.ParseAssemblyName(child, componentId);
5699 break; 5695 break;
5700 case "Class": 5696 case "Class":
5701 this.ParseClassElement(child, componentId, YesNoType.NotSet, id.Id, null, null, null); 5697 this.ParseClassElement(child, componentId, YesNoType.NotSet, id.Id, null, null, null);
5702 break; 5698 break;
5703 case "CopyFile": 5699 case "CopyFile":
5704 this.ParseCopyFileElement(child, componentId, id.Id); 5700 this.ParseCopyFileElement(child, componentId, id.Id);
5705 break; 5701 break;
5706 case "IgnoreRange": 5702 case "IgnoreRange":
5707 this.ParseRangeElement(child, ref ignoreOffsets, ref ignoreLengths); 5703 this.ParseRangeElement(child, ref ignoreOffsets, ref ignoreLengths);
5708 break; 5704 break;
5709 case "ODBCDriver": 5705 case "ODBCDriver":
5710 this.ParseODBCDriverOrTranslator(child, componentId, id.Id, TupleDefinitionType.ODBCDriver); 5706 this.ParseODBCDriverOrTranslator(child, componentId, id.Id, TupleDefinitionType.ODBCDriver);
5711 break; 5707 break;
5712 case "ODBCTranslator": 5708 case "ODBCTranslator":
5713 this.ParseODBCDriverOrTranslator(child, componentId, id.Id, TupleDefinitionType.ODBCTranslator); 5709 this.ParseODBCDriverOrTranslator(child, componentId, id.Id, TupleDefinitionType.ODBCTranslator);
5714 break; 5710 break;
5715 case "Permission": 5711 case "Permission":
5716 this.ParsePermissionElement(child, id.Id, "File"); 5712 this.ParsePermissionElement(child, id.Id, "File");
5717 break; 5713 break;
5718 case "PermissionEx": 5714 case "PermissionEx":
5719 this.ParsePermissionExElement(child, id.Id, "File"); 5715 this.ParsePermissionExElement(child, id.Id, "File");
5720 break; 5716 break;
5721 case "ProtectRange": 5717 case "ProtectRange":
5722 this.ParseRangeElement(child, ref protectOffsets, ref protectLengths); 5718 this.ParseRangeElement(child, ref protectOffsets, ref protectLengths);
5723 break; 5719 break;
5724 case "Shortcut": 5720 case "Shortcut":
5725 this.ParseShortcutElement(child, componentId, node.Name.LocalName, id.Id, keyPath); 5721 this.ParseShortcutElement(child, componentId, node.Name.LocalName, id.Id, keyPath);
5726 break; 5722 break;
5727 case "SymbolPath": 5723 case "SymbolPath":
5728 if (null != symbols) 5724 if (null != symbols)
5729 { 5725 {
5730 symbols += ";" + this.ParseSymbolPathElement(child); 5726 symbols += ";" + this.ParseSymbolPathElement(child);
5731 } 5727 }
5732 else 5728 else
5733 { 5729 {
5734 symbols = this.ParseSymbolPathElement(child); 5730 symbols = this.ParseSymbolPathElement(child);
5735 } 5731 }
5736 break; 5732 break;
5737 case "TypeLib": 5733 case "TypeLib":
5738 this.ParseTypeLibElement(child, componentId, id.Id, win64Component); 5734 this.ParseTypeLibElement(child, componentId, id.Id, win64Component);
5739 break; 5735 break;
5740 default: 5736 default:
5741 this.Core.UnexpectedElement(node, child); 5737 this.Core.UnexpectedElement(node, child);
5742 break; 5738 break;
5743 } 5739 }
5744 } 5740 }
5745 else 5741 else
5746 { 5742 {
5747 Dictionary<string, string> context = new Dictionary<string, string>() { { "FileId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } }; 5743 var context = new Dictionary<string, string>() { { "FileId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } };
5748 this.Core.ParseExtensionElement(node, child, context); 5744 this.Core.ParseExtensionElement(node, child, context);
5749 } 5745 }
5750 } 5746 }
@@ -5752,7 +5748,7 @@ namespace WixToolset.Core
5752 5748
5753 if (!this.Core.EncounteredError) 5749 if (!this.Core.EncounteredError)
5754 { 5750 {
5755 PatchAttributeType patchAttributes = PatchAttributeType.None; 5751 var patchAttributes = PatchAttributeType.None;
5756 if (patchIgnore) 5752 if (patchIgnore)
5757 { 5753 {
5758 patchAttributes |= PatchAttributeType.Ignore; 5754 patchAttributes |= PatchAttributeType.Ignore;
@@ -5895,57 +5891,57 @@ namespace WixToolset.Core
5895 /// <returns>Signature of search element.</returns> 5891 /// <returns>Signature of search element.</returns>
5896 private string ParseFileSearchElement(XElement node, string parentSignature, bool parentDirectorySearch, int parentDepth) 5892 private string ParseFileSearchElement(XElement node, string parentSignature, bool parentDirectorySearch, int parentDepth)
5897 { 5893 {
5898 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 5894 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
5899 Identifier id = null; 5895 Identifier id = null;
5900 string languages = null; 5896 string languages = null;
5901 int minDate = CompilerConstants.IntegerNotSet; 5897 var minDate = CompilerConstants.IntegerNotSet;
5902 int maxDate = CompilerConstants.IntegerNotSet; 5898 var maxDate = CompilerConstants.IntegerNotSet;
5903 int maxSize = CompilerConstants.IntegerNotSet; 5899 var maxSize = CompilerConstants.IntegerNotSet;
5904 int minSize = CompilerConstants.IntegerNotSet; 5900 var minSize = CompilerConstants.IntegerNotSet;
5905 string maxVersion = null; 5901 string maxVersion = null;
5906 string minVersion = null; 5902 string minVersion = null;
5907 string name = null; 5903 string name = null;
5908 string shortName = null; 5904 string shortName = null;
5909 5905
5910 foreach (XAttribute attrib in node.Attributes()) 5906 foreach (var attrib in node.Attributes())
5911 { 5907 {
5912 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 5908 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
5913 { 5909 {
5914 switch (attrib.Name.LocalName) 5910 switch (attrib.Name.LocalName)
5915 { 5911 {
5916 case "Id": 5912 case "Id":
5917 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 5913 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
5918 break; 5914 break;
5919 case "Name": 5915 case "Name":
5920 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); 5916 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
5921 break; 5917 break;
5922 case "MinVersion": 5918 case "MinVersion":
5923 minVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5919 minVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5924 break; 5920 break;
5925 case "MaxVersion": 5921 case "MaxVersion":
5926 maxVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5922 maxVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5927 break; 5923 break;
5928 case "MinSize": 5924 case "MinSize":
5929 minSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 5925 minSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
5930 break; 5926 break;
5931 case "MaxSize": 5927 case "MaxSize":
5932 maxSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 5928 maxSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
5933 break; 5929 break;
5934 case "MinDate": 5930 case "MinDate":
5935 minDate = this.Core.GetAttributeDateTimeValue(sourceLineNumbers, attrib); 5931 minDate = this.Core.GetAttributeDateTimeValue(sourceLineNumbers, attrib);
5936 break; 5932 break;
5937 case "MaxDate": 5933 case "MaxDate":
5938 maxDate = this.Core.GetAttributeDateTimeValue(sourceLineNumbers, attrib); 5934 maxDate = this.Core.GetAttributeDateTimeValue(sourceLineNumbers, attrib);
5939 break; 5935 break;
5940 case "Languages": 5936 case "Languages":
5941 languages = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 5937 languages = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
5942 break; 5938 break;
5943 case "ShortName": 5939 case "ShortName":
5944 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); 5940 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
5945 break; 5941 break;
5946 default: 5942 default:
5947 this.Core.UnexpectedAttribute(node, attrib); 5943 this.Core.UnexpectedAttribute(node, attrib);
5948 break; 5944 break;
5949 } 5945 }
5950 } 5946 }
5951 else 5947 else
@@ -5989,7 +5985,7 @@ namespace WixToolset.Core
5989 } 5985 }
5990 } 5986 }
5991 5987
5992 bool isSameId = String.Equals(id.Id, parentSignature, StringComparison.Ordinal); 5988 var isSameId = String.Equals(id.Id, parentSignature, StringComparison.Ordinal);
5993 if (parentDirectorySearch) 5989 if (parentDirectorySearch)
5994 { 5990 {
5995 // If searching for the parent directory, the Id attribute 5991 // If searching for the parent directory, the Id attribute
@@ -6067,24 +6063,24 @@ namespace WixToolset.Core
6067 /// <param name="node">Element to parse.</param> 6063 /// <param name="node">Element to parse.</param>
6068 private void ParseFragmentElement(XElement node) 6064 private void ParseFragmentElement(XElement node)
6069 { 6065 {
6070 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 6066 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6071 string id = null; 6067 string id = null;
6072 6068
6073 this.activeName = null; 6069 this.activeName = null;
6074 this.activeLanguage = null; 6070 this.activeLanguage = null;
6075 6071
6076 foreach (XAttribute attrib in node.Attributes()) 6072 foreach (var attrib in node.Attributes())
6077 { 6073 {
6078 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 6074 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
6079 { 6075 {
6080 switch (attrib.Name.LocalName) 6076 switch (attrib.Name.LocalName)
6081 { 6077 {
6082 case "Id": 6078 case "Id":
6083 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 6079 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
6084 break; 6080 break;
6085 default: 6081 default:
6086 this.Core.UnexpectedAttribute(node, attrib); 6082 this.Core.UnexpectedAttribute(node, attrib);
6087 break; 6083 break;
6088 } 6084 }
6089 } 6085 }
6090 else 6086 else
@@ -6097,158 +6093,158 @@ namespace WixToolset.Core
6097 6093
6098 this.Core.CreateActiveSection(id, SectionType.Fragment, 0, this.Context.CompilationId); 6094 this.Core.CreateActiveSection(id, SectionType.Fragment, 0, this.Context.CompilationId);
6099 6095
6100 int featureDisplay = 0; 6096 var featureDisplay = 0;
6101 foreach (XElement child in node.Elements()) 6097 foreach (var child in node.Elements())
6102 { 6098 {
6103 if (CompilerCore.WixNamespace == child.Name.Namespace) 6099 if (CompilerCore.WixNamespace == child.Name.Namespace)
6104 { 6100 {
6105 switch (child.Name.LocalName) 6101 switch (child.Name.LocalName)
6106 { 6102 {
6107 case "_locDefinition": 6103 case "_locDefinition":
6108 break; 6104 break;
6109 case "AdminExecuteSequence": 6105 case "AdminExecuteSequence":
6110 this.ParseSequenceElement(child, child.Name.LocalName); 6106 this.ParseSequenceElement(child, child.Name.LocalName);
6111 break; 6107 break;
6112 case "AdminUISequence": 6108 case "AdminUISequence":
6113 this.ParseSequenceElement(child, child.Name.LocalName); 6109 this.ParseSequenceElement(child, child.Name.LocalName);
6114 break; 6110 break;
6115 case "AdvertiseExecuteSequence": 6111 case "AdvertiseExecuteSequence":
6116 this.ParseSequenceElement(child, child.Name.LocalName); 6112 this.ParseSequenceElement(child, child.Name.LocalName);
6117 break; 6113 break;
6118 case "InstallExecuteSequence": 6114 case "InstallExecuteSequence":
6119 this.ParseSequenceElement(child, child.Name.LocalName); 6115 this.ParseSequenceElement(child, child.Name.LocalName);
6120 break; 6116 break;
6121 case "InstallUISequence": 6117 case "InstallUISequence":
6122 this.ParseSequenceElement(child, child.Name.LocalName); 6118 this.ParseSequenceElement(child, child.Name.LocalName);
6123 break; 6119 break;
6124 case "AppId": 6120 case "AppId":
6125 this.ParseAppIdElement(child, null, YesNoType.Yes, null, null, null); 6121 this.ParseAppIdElement(child, null, YesNoType.Yes, null, null, null);
6126 break; 6122 break;
6127 case "Binary": 6123 case "Binary":
6128 this.ParseBinaryElement(child); 6124 this.ParseBinaryElement(child);
6129 break; 6125 break;
6130 case "BootstrapperApplication": 6126 case "BootstrapperApplication":
6131 this.ParseBootstrapperApplicationElement(child); 6127 this.ParseBootstrapperApplicationElement(child);
6132 break; 6128 break;
6133 case "BootstrapperApplicationRef": 6129 case "BootstrapperApplicationRef":
6134 this.ParseBootstrapperApplicationRefElement(child); 6130 this.ParseBootstrapperApplicationRefElement(child);
6135 break; 6131 break;
6136 case "ComplianceCheck": 6132 case "ComplianceCheck":
6137 this.ParseComplianceCheckElement(child); 6133 this.ParseComplianceCheckElement(child);
6138 break; 6134 break;
6139 case "Component": 6135 case "Component":
6140 this.ParseComponentElement(child, ComplexReferenceParentType.Unknown, null, null, CompilerConstants.IntegerNotSet, null, null); 6136 this.ParseComponentElement(child, ComplexReferenceParentType.Unknown, null, null, CompilerConstants.IntegerNotSet, null, null);
6141 break; 6137 break;
6142 case "ComponentGroup": 6138 case "ComponentGroup":
6143 this.ParseComponentGroupElement(child, ComplexReferenceParentType.Unknown, id); 6139 this.ParseComponentGroupElement(child, ComplexReferenceParentType.Unknown, id);
6144 break; 6140 break;
6145 case "Condition": 6141 case "Condition":
6146 this.ParseConditionElement(child, node.Name.LocalName, null, null); 6142 this.ParseConditionElement(child, node.Name.LocalName, null, null);
6147 break; 6143 break;
6148 case "Container": 6144 case "Container":
6149 this.ParseContainerElement(child); 6145 this.ParseContainerElement(child);
6150 break; 6146 break;
6151 case "CustomAction": 6147 case "CustomAction":
6152 this.ParseCustomActionElement(child); 6148 this.ParseCustomActionElement(child);
6153 break; 6149 break;
6154 case "CustomActionRef": 6150 case "CustomActionRef":
6155 this.ParseSimpleRefElement(child, "CustomAction"); 6151 this.ParseSimpleRefElement(child, "CustomAction");
6156 break; 6152 break;
6157 case "CustomTable": 6153 case "CustomTable":
6158 this.ParseCustomTableElement(child); 6154 this.ParseCustomTableElement(child);
6159 break; 6155 break;
6160 case "Directory": 6156 case "Directory":
6161 this.ParseDirectoryElement(child, null, CompilerConstants.IntegerNotSet, String.Empty); 6157 this.ParseDirectoryElement(child, null, CompilerConstants.IntegerNotSet, String.Empty);
6162 break; 6158 break;
6163 case "DirectoryRef": 6159 case "DirectoryRef":
6164 this.ParseDirectoryRefElement(child); 6160 this.ParseDirectoryRefElement(child);
6165 break; 6161 break;
6166 case "EmbeddedChainer": 6162 case "EmbeddedChainer":
6167 this.ParseEmbeddedChainerElement(child); 6163 this.ParseEmbeddedChainerElement(child);
6168 break; 6164 break;
6169 case "EmbeddedChainerRef": 6165 case "EmbeddedChainerRef":
6170 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer"); 6166 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer");
6171 break; 6167 break;
6172 case "EnsureTable": 6168 case "EnsureTable":
6173 this.ParseEnsureTableElement(child); 6169 this.ParseEnsureTableElement(child);
6174 break; 6170 break;
6175 case "Feature": 6171 case "Feature":
6176 this.ParseFeatureElement(child, ComplexReferenceParentType.Unknown, null, ref featureDisplay); 6172 this.ParseFeatureElement(child, ComplexReferenceParentType.Unknown, null, ref featureDisplay);
6177 break; 6173 break;
6178 case "FeatureGroup": 6174 case "FeatureGroup":
6179 this.ParseFeatureGroupElement(child, ComplexReferenceParentType.Unknown, id); 6175 this.ParseFeatureGroupElement(child, ComplexReferenceParentType.Unknown, id);
6180 break; 6176 break;
6181 case "FeatureRef": 6177 case "FeatureRef":
6182 this.ParseFeatureRefElement(child, ComplexReferenceParentType.Unknown, null); 6178 this.ParseFeatureRefElement(child, ComplexReferenceParentType.Unknown, null);
6183 break; 6179 break;
6184 case "Icon": 6180 case "Icon":
6185 this.ParseIconElement(child); 6181 this.ParseIconElement(child);
6186 break; 6182 break;
6187 case "IgnoreModularization": 6183 case "IgnoreModularization":
6188 this.ParseIgnoreModularizationElement(child); 6184 this.ParseIgnoreModularizationElement(child);
6189 break; 6185 break;
6190 case "Media": 6186 case "Media":
6191 this.ParseMediaElement(child, null); 6187 this.ParseMediaElement(child, null);
6192 break; 6188 break;
6193 case "MediaTemplate": 6189 case "MediaTemplate":
6194 this.ParseMediaTemplateElement(child, null); 6190 this.ParseMediaTemplateElement(child, null);
6195 break; 6191 break;
6196 case "PackageGroup": 6192 case "PackageGroup":
6197 this.ParsePackageGroupElement(child); 6193 this.ParsePackageGroupElement(child);
6198 break; 6194 break;
6199 case "PackageCertificates": 6195 case "PackageCertificates":
6200 case "PatchCertificates": 6196 case "PatchCertificates":
6201 this.ParseCertificatesElement(child); 6197 this.ParseCertificatesElement(child);
6202 break; 6198 break;
6203 case "PatchFamily": 6199 case "PatchFamily":
6204 this.ParsePatchFamilyElement(child, ComplexReferenceParentType.Unknown, id); 6200 this.ParsePatchFamilyElement(child, ComplexReferenceParentType.Unknown, id);
6205 break; 6201 break;
6206 case "PatchFamilyGroup": 6202 case "PatchFamilyGroup":
6207 this.ParsePatchFamilyGroupElement(child, ComplexReferenceParentType.Unknown, id); 6203 this.ParsePatchFamilyGroupElement(child, ComplexReferenceParentType.Unknown, id);
6208 break; 6204 break;
6209 case "PatchFamilyGroupRef": 6205 case "PatchFamilyGroupRef":
6210 this.ParsePatchFamilyGroupRefElement(child, ComplexReferenceParentType.Unknown, id); 6206 this.ParsePatchFamilyGroupRefElement(child, ComplexReferenceParentType.Unknown, id);
6211 break; 6207 break;
6212 case "PayloadGroup": 6208 case "PayloadGroup":
6213 this.ParsePayloadGroupElement(child, ComplexReferenceParentType.Unknown, null); 6209 this.ParsePayloadGroupElement(child, ComplexReferenceParentType.Unknown, null);
6214 break; 6210 break;
6215 case "Property": 6211 case "Property":
6216 this.ParsePropertyElement(child); 6212 this.ParsePropertyElement(child);
6217 break; 6213 break;
6218 case "PropertyRef": 6214 case "PropertyRef":
6219 this.ParseSimpleRefElement(child, "Property"); 6215 this.ParseSimpleRefElement(child, "Property");
6220 break; 6216 break;
6221 case "RelatedBundle": 6217 case "RelatedBundle":
6222 this.ParseRelatedBundleElement(child); 6218 this.ParseRelatedBundleElement(child);
6223 break; 6219 break;
6224 case "SetDirectory": 6220 case "SetDirectory":
6225 this.ParseSetDirectoryElement(child); 6221 this.ParseSetDirectoryElement(child);
6226 break; 6222 break;
6227 case "SetProperty": 6223 case "SetProperty":
6228 this.ParseSetPropertyElement(child); 6224 this.ParseSetPropertyElement(child);
6229 break; 6225 break;
6230 case "SFPCatalog": 6226 case "SFPCatalog":
6231 string parentName = null; 6227 string parentName = null;
6232 this.ParseSFPCatalogElement(child, ref parentName); 6228 this.ParseSFPCatalogElement(child, ref parentName);
6233 break; 6229 break;
6234 case "UI": 6230 case "UI":
6235 this.ParseUIElement(child); 6231 this.ParseUIElement(child);
6236 break; 6232 break;
6237 case "UIRef": 6233 case "UIRef":
6238 this.ParseSimpleRefElement(child, "WixUI"); 6234 this.ParseSimpleRefElement(child, "WixUI");
6239 break; 6235 break;
6240 case "Upgrade": 6236 case "Upgrade":
6241 this.ParseUpgradeElement(child); 6237 this.ParseUpgradeElement(child);
6242 break; 6238 break;
6243 case "Variable": 6239 case "Variable":
6244 this.ParseVariableElement(child); 6240 this.ParseVariableElement(child);
6245 break; 6241 break;
6246 case "WixVariable": 6242 case "WixVariable":
6247 this.ParseWixVariableElement(child); 6243 this.ParseWixVariableElement(child);
6248 break; 6244 break;
6249 default: 6245 default:
6250 this.Core.UnexpectedElement(node, child); 6246 this.Core.UnexpectedElement(node, child);
6251 break; 6247 break;
6252 } 6248 }
6253 } 6249 }
6254 else 6250 else
@@ -6275,63 +6271,62 @@ namespace WixToolset.Core
6275 /// <returns>The condition if one was found.</returns> 6271 /// <returns>The condition if one was found.</returns>
6276 private string ParseConditionElement(XElement node, string parentElementLocalName, string id, string dialog) 6272 private string ParseConditionElement(XElement node, string parentElementLocalName, string id, string dialog)
6277 { 6273 {
6278 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 6274 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6279 string action = null; 6275 string action = null;
6280 string condition = null; 6276 string condition = null;
6281 int level = CompilerConstants.IntegerNotSet; 6277 var level = CompilerConstants.IntegerNotSet;
6282 string message = null; 6278 string message = null;
6283 6279
6284 foreach (XAttribute attrib in node.Attributes()) 6280 foreach (var attrib in node.Attributes())
6285 { 6281 {
6286 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 6282 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
6287 { 6283 {
6288 switch (attrib.Name.LocalName) 6284 switch (attrib.Name.LocalName)
6289 { 6285 {
6290 case "Action": 6286 case "Action":
6291 if ("Control" == parentElementLocalName) 6287 if ("Control" == parentElementLocalName)
6288 {
6289 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6290 if (0 < action.Length)
6292 { 6291 {
6293 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6292 if (Wix.Condition.TryParseActionType(action, out var actionType))
6294 if (0 < action.Length)
6295 { 6293 {
6296 Wix.Condition.ActionType actionType; 6294 action = Compiler.UppercaseFirstChar(action);
6297 if (Wix.Condition.TryParseActionType(action, out actionType)) 6295 }
6298 { 6296 else
6299 action = Compiler.UppercaseFirstChar(action); 6297 {
6300 } 6298 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "default", "disable", "enable", "hide", "show"));
6301 else
6302 {
6303 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "default", "disable", "enable", "hide", "show"));
6304 }
6305 } 6299 }
6306 } 6300 }
6307 else 6301 }
6308 { 6302 else
6309 this.Core.UnexpectedAttribute(node, attrib); 6303 {
6310 }
6311 break;
6312 case "Level":
6313 if ("Feature" == parentElementLocalName)
6314 {
6315 level = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue);
6316 }
6317 else
6318 {
6319 this.Core.UnexpectedAttribute(node, attrib);
6320 }
6321 break;
6322 case "Message":
6323 if ("Fragment" == parentElementLocalName || "Product" == parentElementLocalName)
6324 {
6325 message = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6326 }
6327 else
6328 {
6329 this.Core.UnexpectedAttribute(node, attrib);
6330 }
6331 break;
6332 default:
6333 this.Core.UnexpectedAttribute(node, attrib); 6304 this.Core.UnexpectedAttribute(node, attrib);
6334 break; 6305 }
6306 break;
6307 case "Level":
6308 if ("Feature" == parentElementLocalName)
6309 {
6310 level = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
6311 }
6312 else
6313 {
6314 this.Core.UnexpectedAttribute(node, attrib);
6315 }
6316 break;
6317 case "Message":
6318 if ("Fragment" == parentElementLocalName || "Product" == parentElementLocalName)
6319 {
6320 message = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6321 }
6322 else
6323 {
6324 this.Core.UnexpectedAttribute(node, attrib);
6325 }
6326 break;
6327 default:
6328 this.Core.UnexpectedAttribute(node, attrib);
6329 break;
6335 } 6330 }
6336 } 6331 }
6337 else 6332 else
@@ -6354,50 +6349,50 @@ namespace WixToolset.Core
6354 6349
6355 switch (parentElementLocalName) 6350 switch (parentElementLocalName)
6356 { 6351 {
6357 case "Control": 6352 case "Control":
6358 if (null == action) 6353 if (null == action)
6359 { 6354 {
6360 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action")); 6355 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Action"));
6361 } 6356 }
6362 6357
6363 if (!this.Core.EncounteredError) 6358 if (!this.Core.EncounteredError)
6364 { 6359 {
6365 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ControlCondition); 6360 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.ControlCondition);
6366 row.Set(0, dialog); 6361 row.Set(0, dialog);
6367 row.Set(1, id); 6362 row.Set(1, id);
6368 row.Set(2, action); 6363 row.Set(2, action);
6369 row.Set(3, condition); 6364 row.Set(3, condition);
6370 } 6365 }
6371 break; 6366 break;
6372 case "Feature": 6367 case "Feature":
6373 if (CompilerConstants.IntegerNotSet == level) 6368 if (CompilerConstants.IntegerNotSet == level)
6374 { 6369 {
6375 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Level")); 6370 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Level"));
6376 level = CompilerConstants.IllegalInteger; 6371 level = CompilerConstants.IllegalInteger;
6377 } 6372 }
6378 6373
6379 if (!this.Core.EncounteredError) 6374 if (!this.Core.EncounteredError)
6380 { 6375 {
6381 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Condition); 6376 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Condition);
6382 row.Set(0, id); 6377 row.Set(0, id);
6383 row.Set(1, level); 6378 row.Set(1, level);
6384 row.Set(2, condition); 6379 row.Set(2, condition);
6385 } 6380 }
6386 break; 6381 break;
6387 case "Fragment": 6382 case "Fragment":
6388 case "Product": 6383 case "Product":
6389 if (null == message) 6384 if (null == message)
6390 { 6385 {
6391 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Message")); 6386 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Message"));
6392 } 6387 }
6393 6388
6394 if (!this.Core.EncounteredError) 6389 if (!this.Core.EncounteredError)
6395 { 6390 {
6396 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LaunchCondition); 6391 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LaunchCondition);
6397 row.Set(0, condition); 6392 row.Set(0, condition);
6398 row.Set(1, message); 6393 row.Set(1, message);
6399 } 6394 }
6400 break; 6395 break;
6401 } 6396 }
6402 6397
6403 return condition; 6398 return condition;
@@ -6410,9 +6405,9 @@ namespace WixToolset.Core
6410 /// <param name="componentId">Identifier of the parent component.</param> 6405 /// <param name="componentId">Identifier of the parent component.</param>
6411 private void ParseIniFileElement(XElement node, string componentId) 6406 private void ParseIniFileElement(XElement node, string componentId)
6412 { 6407 {
6413 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 6408 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6414 Identifier id = null; 6409 Identifier id = null;
6415 int action = CompilerConstants.IntegerNotSet; 6410 var action = CompilerConstants.IntegerNotSet;
6416 string directory = null; 6411 string directory = null;
6417 string key = null; 6412 string key = null;
6418 string name = null; 6413 string name = null;
@@ -6421,64 +6416,64 @@ namespace WixToolset.Core
6421 TupleDefinitionType tableName; 6416 TupleDefinitionType tableName;
6422 string value = null; 6417 string value = null;
6423 6418
6424 foreach (XAttribute attrib in node.Attributes()) 6419 foreach (var attrib in node.Attributes())
6425 { 6420 {
6426 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 6421 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
6427 { 6422 {
6428 switch (attrib.Name.LocalName) 6423 switch (attrib.Name.LocalName)
6429 { 6424 {
6430 case "Id": 6425 case "Id":
6431 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 6426 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
6432 break; 6427 break;
6433 case "Action": 6428 case "Action":
6434 string actionValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6429 var actionValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6435 if (0 < actionValue.Length) 6430 if (0 < actionValue.Length)
6431 {
6432 var actionType = Wix.IniFile.ParseActionType(actionValue);
6433 switch (actionType)
6436 { 6434 {
6437 Wix.IniFile.ActionType actionType = Wix.IniFile.ParseActionType(actionValue); 6435 case Wix.IniFile.ActionType.addLine:
6438 switch (actionType) 6436 action = MsiInterop.MsidbIniFileActionAddLine;
6439 { 6437 break;
6440 case Wix.IniFile.ActionType.addLine: 6438 case Wix.IniFile.ActionType.addTag:
6441 action = MsiInterop.MsidbIniFileActionAddLine; 6439 action = MsiInterop.MsidbIniFileActionAddTag;
6442 break; 6440 break;
6443 case Wix.IniFile.ActionType.addTag: 6441 case Wix.IniFile.ActionType.createLine:
6444 action = MsiInterop.MsidbIniFileActionAddTag; 6442 action = MsiInterop.MsidbIniFileActionCreateLine;
6445 break; 6443 break;
6446 case Wix.IniFile.ActionType.createLine: 6444 case Wix.IniFile.ActionType.removeLine:
6447 action = MsiInterop.MsidbIniFileActionCreateLine; 6445 action = MsiInterop.MsidbIniFileActionRemoveLine;
6448 break; 6446 break;
6449 case Wix.IniFile.ActionType.removeLine: 6447 case Wix.IniFile.ActionType.removeTag:
6450 action = MsiInterop.MsidbIniFileActionRemoveLine; 6448 action = MsiInterop.MsidbIniFileActionRemoveTag;
6451 break; 6449 break;
6452 case Wix.IniFile.ActionType.removeTag: 6450 default:
6453 action = MsiInterop.MsidbIniFileActionRemoveTag; 6451 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", actionValue, "addLine", "addTag", "createLine", "removeLine", "removeTag"));
6454 break; 6452 break;
6455 default:
6456 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", actionValue, "addLine", "addTag", "createLine", "removeLine", "removeTag"));
6457 break;
6458 }
6459 } 6453 }
6460 break; 6454 }
6461 case "Directory": 6455 break;
6462 directory = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 6456 case "Directory":
6463 break; 6457 directory = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
6464 case "Key": 6458 break;
6465 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6459 case "Key":
6466 break; 6460 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6467 case "Name": 6461 break;
6468 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); 6462 case "Name":
6469 break; 6463 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
6470 case "Section": 6464 break;
6471 section = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6465 case "Section":
6472 break; 6466 section = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6473 case "ShortName": 6467 break;
6474 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); 6468 case "ShortName":
6475 break; 6469 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
6476 case "Value": 6470 break;
6477 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6471 case "Value":
6478 break; 6472 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6479 default: 6473 break;
6480 this.Core.UnexpectedAttribute(node, attrib); 6474 default:
6481 break; 6475 this.Core.UnexpectedAttribute(node, attrib);
6476 break;
6482 } 6477 }
6483 } 6478 }
6484 else 6479 else
@@ -6554,7 +6549,7 @@ namespace WixToolset.Core
6554 if (!this.Core.EncounteredError) 6549 if (!this.Core.EncounteredError)
6555 { 6550 {
6556 var row = this.Core.CreateRow(sourceLineNumbers, tableName, id); 6551 var row = this.Core.CreateRow(sourceLineNumbers, tableName, id);
6557 row.Set(1, GetMsiFilenameValue(shortName, name)); 6552 row.Set(1, this.GetMsiFilenameValue(shortName, name));
6558 row.Set(2, directory); 6553 row.Set(2, directory);
6559 row.Set(3, section); 6554 row.Set(3, section);
6560 row.Set(4, key); 6555 row.Set(4, key);
@@ -6571,65 +6566,65 @@ namespace WixToolset.Core
6571 /// <returns>Signature for search element.</returns> 6566 /// <returns>Signature for search element.</returns>
6572 private string ParseIniFileSearchElement(XElement node) 6567 private string ParseIniFileSearchElement(XElement node)
6573 { 6568 {
6574 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 6569 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6575 Identifier id = null; 6570 Identifier id = null;
6576 int field = CompilerConstants.IntegerNotSet; 6571 var field = CompilerConstants.IntegerNotSet;
6577 string key = null; 6572 string key = null;
6578 string name = null; 6573 string name = null;
6579 string section = null; 6574 string section = null;
6580 string shortName = null; 6575 string shortName = null;
6581 string signature = null; 6576 string signature = null;
6582 int type = 1; // default is file 6577 var type = 1; // default is file
6583 6578
6584 foreach (XAttribute attrib in node.Attributes()) 6579 foreach (var attrib in node.Attributes())
6585 { 6580 {
6586 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 6581 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
6587 { 6582 {
6588 switch (attrib.Name.LocalName) 6583 switch (attrib.Name.LocalName)
6589 { 6584 {
6590 case "Id": 6585 case "Id":
6591 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 6586 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
6592 break; 6587 break;
6593 case "Field": 6588 case "Field":
6594 field = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 6589 field = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
6595 break; 6590 break;
6596 case "Key": 6591 case "Key":
6597 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6592 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6598 break; 6593 break;
6599 case "Name": 6594 case "Name":
6600 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); 6595 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
6601 break; 6596 break;
6602 case "Section": 6597 case "Section":
6603 section = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6598 section = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6604 break; 6599 break;
6605 case "ShortName": 6600 case "ShortName":
6606 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); 6601 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
6607 break; 6602 break;
6608 case "Type": 6603 case "Type":
6609 string typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6604 var typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6610 if (0 < typeValue.Length) 6605 if (0 < typeValue.Length)
6606 {
6607 var typeType = Wix.IniFileSearch.ParseTypeType(typeValue);
6608 switch (typeType)
6611 { 6609 {
6612 Wix.IniFileSearch.TypeType typeType = Wix.IniFileSearch.ParseTypeType(typeValue); 6610 case Wix.IniFileSearch.TypeType.directory:
6613 switch (typeType) 6611 type = 0;
6614 { 6612 break;
6615 case Wix.IniFileSearch.TypeType.directory: 6613 case Wix.IniFileSearch.TypeType.file:
6616 type = 0; 6614 type = 1;
6617 break; 6615 break;
6618 case Wix.IniFileSearch.TypeType.file: 6616 case Wix.IniFileSearch.TypeType.raw:
6619 type = 1; 6617 type = 2;
6620 break; 6618 break;
6621 case Wix.IniFileSearch.TypeType.raw: 6619 default:
6622 type = 2; 6620 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Type", typeValue, "directory", "file", "registry"));
6623 break; 6621 break;
6624 default:
6625 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Type", typeValue, "directory", "file", "registry"));
6626 break;
6627 }
6628 } 6622 }
6629 break; 6623 }
6630 default: 6624 break;
6631 this.Core.UnexpectedAttribute(node, attrib); 6625 default:
6632 break; 6626 this.Core.UnexpectedAttribute(node, attrib);
6627 break;
6633 } 6628 }
6634 } 6629 }
6635 else 6630 else
@@ -6679,54 +6674,54 @@ namespace WixToolset.Core
6679 6674
6680 signature = id.Id; 6675 signature = id.Id;
6681 6676
6682 bool oneChild = false; 6677 var oneChild = false;
6683 foreach (XElement child in node.Elements()) 6678 foreach (var child in node.Elements())
6684 { 6679 {
6685 if (CompilerCore.WixNamespace == child.Name.Namespace) 6680 if (CompilerCore.WixNamespace == child.Name.Namespace)
6686 { 6681 {
6687 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 6682 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
6688 switch (child.Name.LocalName) 6683 switch (child.Name.LocalName)
6689 { 6684 {
6690 case "DirectorySearch": 6685 case "DirectorySearch":
6691 if (oneChild) 6686 if (oneChild)
6692 { 6687 {
6693 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); 6688 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName));
6694 } 6689 }
6695 oneChild = true; 6690 oneChild = true;
6696 6691
6697 // directorysearch parentage should work like directory element, not the rest of the signature type because of the DrLocator.Parent column 6692 // directorysearch parentage should work like directory element, not the rest of the signature type because of the DrLocator.Parent column
6698 signature = this.ParseDirectorySearchElement(child, id.Id); 6693 signature = this.ParseDirectorySearchElement(child, id.Id);
6699 break; 6694 break;
6700 case "DirectorySearchRef": 6695 case "DirectorySearchRef":
6701 if (oneChild) 6696 if (oneChild)
6702 { 6697 {
6703 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName)); 6698 this.Core.Write(ErrorMessages.TooManySearchElements(childSourceLineNumbers, node.Name.LocalName));
6704 } 6699 }
6705 oneChild = true; 6700 oneChild = true;
6706 signature = this.ParseDirectorySearchRefElement(child, id.Id); 6701 signature = this.ParseDirectorySearchRefElement(child, id.Id);
6707 break; 6702 break;
6708 case "FileSearch": 6703 case "FileSearch":
6709 if (oneChild) 6704 if (oneChild)
6710 { 6705 {
6711 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 6706 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
6712 } 6707 }
6713 oneChild = true; 6708 oneChild = true;
6714 signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet); 6709 signature = this.ParseFileSearchElement(child, id.Id, false, CompilerConstants.IntegerNotSet);
6715 id = new Identifier(signature, AccessModifier.Private); // FileSearch signatures override parent signatures 6710 id = new Identifier(signature, AccessModifier.Private); // FileSearch signatures override parent signatures
6716 break; 6711 break;
6717 case "FileSearchRef": 6712 case "FileSearchRef":
6718 if (oneChild) 6713 if (oneChild)
6719 { 6714 {
6720 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName)); 6715 this.Core.Write(ErrorMessages.TooManySearchElements(sourceLineNumbers, node.Name.LocalName));
6721 } 6716 }
6722 oneChild = true; 6717 oneChild = true;
6723 string newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures 6718 var newId = this.ParseSimpleRefElement(child, "Signature"); // FileSearch signatures override parent signatures
6724 id = new Identifier(newId, AccessModifier.Private); 6719 id = new Identifier(newId, AccessModifier.Private);
6725 signature = null; 6720 signature = null;
6726 break; 6721 break;
6727 default: 6722 default:
6728 this.Core.UnexpectedElement(node, child); 6723 this.Core.UnexpectedElement(node, child);
6729 break; 6724 break;
6730 } 6725 }
6731 } 6726 }
6732 else 6727 else
@@ -6738,7 +6733,7 @@ namespace WixToolset.Core
6738 if (!this.Core.EncounteredError) 6733 if (!this.Core.EncounteredError)
6739 { 6734 {
6740 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.IniLocator, id); 6735 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.IniLocator, id);
6741 row.Set(1, GetMsiFilenameValue(shortName, name)); 6736 row.Set(1, this.GetMsiFilenameValue(shortName, name));
6742 row.Set(2, section); 6737 row.Set(2, section);
6743 row.Set(3, key); 6738 row.Set(3, key);
6744 if (CompilerConstants.IntegerNotSet != field) 6739 if (CompilerConstants.IntegerNotSet != field)
@@ -6758,22 +6753,22 @@ namespace WixToolset.Core
6758 /// <param name="componentId">Identifier of parent component.</param> 6753 /// <param name="componentId">Identifier of parent component.</param>
6759 private void ParseIsolateComponentElement(XElement node, string componentId) 6754 private void ParseIsolateComponentElement(XElement node, string componentId)
6760 { 6755 {
6761 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 6756 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6762 string shared = null; 6757 string shared = null;
6763 6758
6764 foreach (XAttribute attrib in node.Attributes()) 6759 foreach (var attrib in node.Attributes())
6765 { 6760 {
6766 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 6761 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
6767 { 6762 {
6768 switch (attrib.Name.LocalName) 6763 switch (attrib.Name.LocalName)
6769 { 6764 {
6770 case "Shared": 6765 case "Shared":
6771 shared = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 6766 shared = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
6772 this.Core.CreateSimpleReference(sourceLineNumbers, "Component", shared); 6767 this.Core.CreateSimpleReference(sourceLineNumbers, "Component", shared);
6773 break; 6768 break;
6774 default: 6769 default:
6775 this.Core.UnexpectedAttribute(node, attrib); 6770 this.Core.UnexpectedAttribute(node, attrib);
6776 break; 6771 break;
6777 } 6772 }
6778 } 6773 }
6779 else 6774 else
@@ -6803,10 +6798,10 @@ namespace WixToolset.Core
6803 /// <param name="node">The element to parse.</param> 6798 /// <param name="node">The element to parse.</param>
6804 private void ParseCertificatesElement(XElement node) 6799 private void ParseCertificatesElement(XElement node)
6805 { 6800 {
6806 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 6801 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6807 6802
6808 // no attributes are supported for this element 6803 // no attributes are supported for this element
6809 foreach (XAttribute attrib in node.Attributes()) 6804 foreach (var attrib in node.Attributes())
6810 { 6805 {
6811 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 6806 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
6812 { 6807 {
@@ -6818,25 +6813,25 @@ namespace WixToolset.Core
6818 } 6813 }
6819 } 6814 }
6820 6815
6821 foreach (XElement child in node.Elements()) 6816 foreach (var child in node.Elements())
6822 { 6817 {
6823 if (CompilerCore.WixNamespace == child.Name.Namespace) 6818 if (CompilerCore.WixNamespace == child.Name.Namespace)
6824 { 6819 {
6825 switch (child.Name.LocalName) 6820 switch (child.Name.LocalName)
6826 { 6821 {
6827 case "DigitalCertificate": 6822 case "DigitalCertificate":
6828 string name = this.ParseDigitalCertificateElement(child); 6823 var name = this.ParseDigitalCertificateElement(child);
6829 6824
6830 if (!this.Core.EncounteredError) 6825 if (!this.Core.EncounteredError)
6831 { 6826 {
6832 var row = this.Core.CreateRow(sourceLineNumbers, "PatchCertificates" == node.Name.LocalName ? TupleDefinitionType.MsiPatchCertificate : TupleDefinitionType.MsiPackageCertificate); 6827 var row = this.Core.CreateRow(sourceLineNumbers, "PatchCertificates" == node.Name.LocalName ? TupleDefinitionType.MsiPatchCertificate : TupleDefinitionType.MsiPackageCertificate);
6833 row.Set(0, name); 6828 row.Set(0, name);
6834 row.Set(1, name); 6829 row.Set(1, name);
6835 } 6830 }
6836 break; 6831 break;
6837 default: 6832 default:
6838 this.Core.UnexpectedElement(node, child); 6833 this.Core.UnexpectedElement(node, child);
6839 break; 6834 break;
6840 } 6835 }
6841 } 6836 }
6842 else 6837 else
@@ -6853,25 +6848,25 @@ namespace WixToolset.Core
6853 /// <returns>The identifier of the certificate.</returns> 6848 /// <returns>The identifier of the certificate.</returns>
6854 private string ParseDigitalCertificateElement(XElement node) 6849 private string ParseDigitalCertificateElement(XElement node)
6855 { 6850 {
6856 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 6851 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6857 Identifier id = null; 6852 Identifier id = null;
6858 string sourceFile = null; 6853 string sourceFile = null;
6859 6854
6860 foreach (XAttribute attrib in node.Attributes()) 6855 foreach (var attrib in node.Attributes())
6861 { 6856 {
6862 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 6857 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
6863 { 6858 {
6864 switch (attrib.Name.LocalName) 6859 switch (attrib.Name.LocalName)
6865 { 6860 {
6866 case "Id": 6861 case "Id":
6867 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 6862 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
6868 break; 6863 break;
6869 case "SourceFile": 6864 case "SourceFile":
6870 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6865 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6871 break; 6866 break;
6872 default: 6867 default:
6873 this.Core.UnexpectedAttribute(node, attrib); 6868 this.Core.UnexpectedAttribute(node, attrib);
6874 break; 6869 break;
6875 } 6870 }
6876 } 6871 }
6877 else 6872 else
@@ -6916,22 +6911,22 @@ namespace WixToolset.Core
6916 /// <param name="diskId">Disk id inherited from parent media.</param> 6911 /// <param name="diskId">Disk id inherited from parent media.</param>
6917 private void ParseDigitalSignatureElement(XElement node, string diskId) 6912 private void ParseDigitalSignatureElement(XElement node, string diskId)
6918 { 6913 {
6919 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 6914 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6920 string certificateId = null; 6915 string certificateId = null;
6921 string sourceFile = null; 6916 string sourceFile = null;
6922 6917
6923 foreach (XAttribute attrib in node.Attributes()) 6918 foreach (var attrib in node.Attributes())
6924 { 6919 {
6925 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 6920 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
6926 { 6921 {
6927 switch (attrib.Name.LocalName) 6922 switch (attrib.Name.LocalName)
6928 { 6923 {
6929 case "SourceFile": 6924 case "SourceFile":
6930 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 6925 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
6931 break; 6926 break;
6932 default: 6927 default:
6933 this.Core.UnexpectedAttribute(node, attrib); 6928 this.Core.UnexpectedAttribute(node, attrib);
6934 break; 6929 break;
6935 } 6930 }
6936 } 6931 }
6937 else 6932 else
@@ -6946,18 +6941,18 @@ namespace WixToolset.Core
6946 Debug.Assert(62 >= "MsiDigitalSignature.Media.".Length + diskId.Length); 6941 Debug.Assert(62 >= "MsiDigitalSignature.Media.".Length + diskId.Length);
6947 } 6942 }
6948 6943
6949 foreach (XElement child in node.Elements()) 6944 foreach (var child in node.Elements())
6950 { 6945 {
6951 if (CompilerCore.WixNamespace == child.Name.Namespace) 6946 if (CompilerCore.WixNamespace == child.Name.Namespace)
6952 { 6947 {
6953 switch (child.Name.LocalName) 6948 switch (child.Name.LocalName)
6954 { 6949 {
6955 case "DigitalCertificate": 6950 case "DigitalCertificate":
6956 certificateId = this.ParseDigitalCertificateElement(child); 6951 certificateId = this.ParseDigitalCertificateElement(child);
6957 break; 6952 break;
6958 default: 6953 default:
6959 this.Core.UnexpectedElement(node, child); 6954 this.Core.UnexpectedElement(node, child);
6960 break; 6955 break;
6961 } 6956 }
6962 } 6957 }
6963 else 6958 else
@@ -6988,78 +6983,78 @@ namespace WixToolset.Core
6988 /// <param name="parentElement">The parent element.</param> 6983 /// <param name="parentElement">The parent element.</param>
6989 private void ParseMajorUpgradeElement(XElement node, IDictionary<string, string> contextValues) 6984 private void ParseMajorUpgradeElement(XElement node, IDictionary<string, string> contextValues)
6990 { 6985 {
6991 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 6986 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
6992 int options = MsiInterop.MsidbUpgradeAttributesMigrateFeatures; 6987 var options = MsiInterop.MsidbUpgradeAttributesMigrateFeatures;
6993 bool allowDowngrades = false; 6988 var allowDowngrades = false;
6994 bool allowSameVersionUpgrades = false; 6989 var allowSameVersionUpgrades = false;
6995 bool blockUpgrades = false; 6990 var blockUpgrades = false;
6996 string downgradeErrorMessage = null; 6991 string downgradeErrorMessage = null;
6997 string disallowUpgradeErrorMessage = null; 6992 string disallowUpgradeErrorMessage = null;
6998 string removeFeatures = null; 6993 string removeFeatures = null;
6999 string schedule = null; 6994 string schedule = null;
7000 6995
7001 string upgradeCode = contextValues["UpgradeCode"]; 6996 var upgradeCode = contextValues["UpgradeCode"];
7002 if (String.IsNullOrEmpty(upgradeCode)) 6997 if (String.IsNullOrEmpty(upgradeCode))
7003 { 6998 {
7004 this.Core.Write(ErrorMessages.ParentElementAttributeRequired(sourceLineNumbers, "Product", "UpgradeCode", node.Name.LocalName)); 6999 this.Core.Write(ErrorMessages.ParentElementAttributeRequired(sourceLineNumbers, "Product", "UpgradeCode", node.Name.LocalName));
7005 } 7000 }
7006 7001
7007 string productVersion = contextValues["ProductVersion"]; 7002 var productVersion = contextValues["ProductVersion"];
7008 if (String.IsNullOrEmpty(productVersion)) 7003 if (String.IsNullOrEmpty(productVersion))
7009 { 7004 {
7010 this.Core.Write(ErrorMessages.ParentElementAttributeRequired(sourceLineNumbers, "Product", "Version", node.Name.LocalName)); 7005 this.Core.Write(ErrorMessages.ParentElementAttributeRequired(sourceLineNumbers, "Product", "Version", node.Name.LocalName));
7011 } 7006 }
7012 7007
7013 string productLanguage = contextValues["ProductLanguage"]; 7008 var productLanguage = contextValues["ProductLanguage"];
7014 7009
7015 foreach (XAttribute attrib in node.Attributes()) 7010 foreach (var attrib in node.Attributes())
7016 { 7011 {
7017 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 7012 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
7018 { 7013 {
7019 switch (attrib.Name.LocalName) 7014 switch (attrib.Name.LocalName)
7020 { 7015 {
7021 case "AllowDowngrades": 7016 case "AllowDowngrades":
7022 allowDowngrades = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7017 allowDowngrades = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7023 break; 7018 break;
7024 case "AllowSameVersionUpgrades": 7019 case "AllowSameVersionUpgrades":
7025 allowSameVersionUpgrades = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7020 allowSameVersionUpgrades = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7026 break; 7021 break;
7027 case "Disallow": 7022 case "Disallow":
7028 blockUpgrades = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7023 blockUpgrades = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7029 break; 7024 break;
7030 case "DowngradeErrorMessage": 7025 case "DowngradeErrorMessage":
7031 downgradeErrorMessage = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7026 downgradeErrorMessage = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7032 break; 7027 break;
7033 case "DisallowUpgradeErrorMessage": 7028 case "DisallowUpgradeErrorMessage":
7034 disallowUpgradeErrorMessage = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7029 disallowUpgradeErrorMessage = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7035 break; 7030 break;
7036 case "MigrateFeatures": 7031 case "MigrateFeatures":
7037 if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 7032 if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
7038 { 7033 {
7039 options &= ~MsiInterop.MsidbUpgradeAttributesMigrateFeatures; 7034 options &= ~MsiInterop.MsidbUpgradeAttributesMigrateFeatures;
7040 } 7035 }
7041 break; 7036 break;
7042 case "IgnoreLanguage": 7037 case "IgnoreLanguage":
7043 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 7038 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
7044 { 7039 {
7045 productLanguage = null; 7040 productLanguage = null;
7046 } 7041 }
7047 break; 7042 break;
7048 case "IgnoreRemoveFailure": 7043 case "IgnoreRemoveFailure":
7049 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 7044 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
7050 { 7045 {
7051 options |= MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure; 7046 options |= MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure;
7052 } 7047 }
7053 break; 7048 break;
7054 case "RemoveFeatures": 7049 case "RemoveFeatures":
7055 removeFeatures = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7050 removeFeatures = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7056 break; 7051 break;
7057 case "Schedule": 7052 case "Schedule":
7058 schedule = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7053 schedule = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7059 break; 7054 break;
7060 default: 7055 default:
7061 this.Core.UnexpectedAttribute(node, attrib); 7056 this.Core.UnexpectedAttribute(node, attrib);
7062 break; 7057 break;
7063 } 7058 }
7064 } 7059 }
7065 else 7060 else
@@ -7116,16 +7111,16 @@ namespace WixToolset.Core
7116 } 7111 }
7117 7112
7118 row.Set(5, removeFeatures); 7113 row.Set(5, removeFeatures);
7119 row.Set(6, Compiler.UpgradeDetectedProperty); 7114 row.Set(6, Common.UpgradeDetectedProperty);
7120 7115
7121 // Ensure the action property is secure. 7116 // Ensure the action property is secure.
7122 this.AddWixPropertyRow(sourceLineNumbers, new Identifier(Compiler.UpgradeDetectedProperty, AccessModifier.Public), false, true, false); 7117 this.AddWixPropertyRow(sourceLineNumbers, new Identifier(Common.UpgradeDetectedProperty, AccessModifier.Public), false, true, false);
7123 7118
7124 // Add launch condition that blocks upgrades 7119 // Add launch condition that blocks upgrades
7125 if (blockUpgrades) 7120 if (blockUpgrades)
7126 { 7121 {
7127 row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LaunchCondition); 7122 row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LaunchCondition);
7128 row.Set(0, Compiler.UpgradePreventedCondition); 7123 row.Set(0, Common.UpgradePreventedCondition);
7129 row.Set(1, disallowUpgradeErrorMessage); 7124 row.Set(1, disallowUpgradeErrorMessage);
7130 } 7125 }
7131 7126
@@ -7139,13 +7134,13 @@ namespace WixToolset.Core
7139 row.Set(3, productLanguage); 7134 row.Set(3, productLanguage);
7140 row.Set(4, MsiInterop.MsidbUpgradeAttributesOnlyDetect); 7135 row.Set(4, MsiInterop.MsidbUpgradeAttributesOnlyDetect);
7141 // row.Set(5, removeFeatures); 7136 // row.Set(5, removeFeatures);
7142 row.Set(6, Compiler.DowngradeDetectedProperty); 7137 row.Set(6, Common.DowngradeDetectedProperty);
7143 7138
7144 // Ensure the action property is secure. 7139 // Ensure the action property is secure.
7145 this.AddWixPropertyRow(sourceLineNumbers, new Identifier(Compiler.DowngradeDetectedProperty, AccessModifier.Public), false, true, false); 7140 this.AddWixPropertyRow(sourceLineNumbers, new Identifier(Common.DowngradeDetectedProperty, AccessModifier.Public), false, true, false);
7146 7141
7147 row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LaunchCondition); 7142 row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.LaunchCondition);
7148 row.Set(0, Compiler.DowngradePreventedCondition); 7143 row.Set(0, Common.DowngradePreventedCondition);
7149 row.Set(1, downgradeErrorMessage); 7144 row.Set(1, downgradeErrorMessage);
7150 } 7145 }
7151 7146
@@ -7159,27 +7154,27 @@ namespace WixToolset.Core
7159 7154
7160 switch (schedule) 7155 switch (schedule)
7161 { 7156 {
7162 case null: 7157 case null:
7163 case "afterInstallValidate": 7158 case "afterInstallValidate":
7164 // row.Set(4, beforeAction; 7159 // row.Set(4, beforeAction;
7165 row.Set(5, "InstallValidate"); 7160 row.Set(5, "InstallValidate");
7166 break; 7161 break;
7167 case "afterInstallInitialize": 7162 case "afterInstallInitialize":
7168 // row.Set(4, beforeAction; 7163 // row.Set(4, beforeAction;
7169 row.Set(5, "InstallInitialize"); 7164 row.Set(5, "InstallInitialize");
7170 break; 7165 break;
7171 case "afterInstallExecute": 7166 case "afterInstallExecute":
7172 // row.Set(4, beforeAction; 7167 // row.Set(4, beforeAction;
7173 row.Set(5, "InstallExecute"); 7168 row.Set(5, "InstallExecute");
7174 break; 7169 break;
7175 case "afterInstallExecuteAgain": 7170 case "afterInstallExecuteAgain":
7176 // row.Set(4, beforeAction; 7171 // row.Set(4, beforeAction;
7177 row.Set(5, "InstallExecuteAgain"); 7172 row.Set(5, "InstallExecuteAgain");
7178 break; 7173 break;
7179 case "afterInstallFinalize": 7174 case "afterInstallFinalize":
7180 // row.Set(4, beforeAction; 7175 // row.Set(4, beforeAction;
7181 row.Set(5, "InstallFinalize"); 7176 row.Set(5, "InstallFinalize");
7182 break; 7177 break;
7183 } 7178 }
7184 } 7179 }
7185 } 7180 }
@@ -7191,75 +7186,74 @@ namespace WixToolset.Core
7191 /// <param name="patchId">Set to the PatchId if parsing Patch/Media element otherwise null.</param> 7186 /// <param name="patchId">Set to the PatchId if parsing Patch/Media element otherwise null.</param>
7192 private void ParseMediaElement(XElement node, string patchId) 7187 private void ParseMediaElement(XElement node, string patchId)
7193 { 7188 {
7194 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 7189 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
7195 int id = CompilerConstants.IntegerNotSet; 7190 var id = CompilerConstants.IntegerNotSet;
7196 string cabinet = null; 7191 string cabinet = null;
7197 CompressionLevel? compressionLevel = null; 7192 CompressionLevel? compressionLevel = null;
7198 string diskPrompt = null; 7193 string diskPrompt = null;
7199 string layout = null; 7194 string layout = null;
7200 bool patch = null != patchId; 7195 var patch = null != patchId;
7201 string volumeLabel = null; 7196 string volumeLabel = null;
7202 string source = null; 7197 string source = null;
7203 string symbols = null; 7198 string symbols = null;
7204 7199
7205 YesNoType embedCab = patch ? YesNoType.Yes : YesNoType.NotSet; 7200 var embedCab = patch ? YesNoType.Yes : YesNoType.NotSet;
7206 7201
7207 foreach (XAttribute attrib in node.Attributes()) 7202 foreach (var attrib in node.Attributes())
7208 { 7203 {
7209 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 7204 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
7210 { 7205 {
7211 switch (attrib.Name.LocalName) 7206 switch (attrib.Name.LocalName)
7212 { 7207 {
7213 case "Id": 7208 case "Id":
7214 id = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); 7209 id = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
7215 break; 7210 break;
7216 case "Cabinet": 7211 case "Cabinet":
7217 cabinet = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7212 cabinet = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7218 break; 7213 break;
7219 case "CompressionLevel": 7214 case "CompressionLevel":
7220 string compressionLevelString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7215 var compressionLevelString = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7221 if (0 < compressionLevelString.Length) 7216 if (0 < compressionLevelString.Length)
7217 {
7218 if (!Wix.Enums.TryParseCompressionLevelType(compressionLevelString, out var compressionLevelType))
7222 { 7219 {
7223 Wix.CompressionLevelType compressionLevelType; 7220 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, compressionLevelString, "high", "low", "medium", "mszip", "none"));
7224 if (!Wix.Enums.TryParseCompressionLevelType(compressionLevelString, out compressionLevelType))
7225 {
7226 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, compressionLevelString, "high", "low", "medium", "mszip", "none"));
7227 }
7228 else
7229 {
7230 compressionLevel = (CompressionLevel)Enum.Parse(typeof(CompressionLevel), compressionLevelString, true);
7231 }
7232 } 7221 }
7233 break; 7222 else
7234 case "DiskPrompt":
7235 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7236 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined
7237 break;
7238 case "EmbedCab":
7239 embedCab = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7240 break;
7241 case "Layout":
7242 case "src":
7243 if (null != layout)
7244 { 7223 {
7245 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Layout", "src")); 7224 compressionLevel = (CompressionLevel)Enum.Parse(typeof(CompressionLevel), compressionLevelString, true);
7246 } 7225 }
7226 }
7227 break;
7228 case "DiskPrompt":
7229 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7230 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined
7231 break;
7232 case "EmbedCab":
7233 embedCab = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7234 break;
7235 case "Layout":
7236 case "src":
7237 if (null != layout)
7238 {
7239 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Layout", "src"));
7240 }
7247 7241
7248 if ("src" == attrib.Name.LocalName) 7242 if ("src" == attrib.Name.LocalName)
7249 { 7243 {
7250 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Layout")); 7244 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Layout"));
7251 } 7245 }
7252 layout = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7246 layout = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7253 break; 7247 break;
7254 case "VolumeLabel": 7248 case "VolumeLabel":
7255 volumeLabel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7249 volumeLabel = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7256 break; 7250 break;
7257 case "Source": 7251 case "Source":
7258 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7252 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7259 break; 7253 break;
7260 default: 7254 default:
7261 this.Core.UnexpectedAttribute(node, attrib); 7255 this.Core.UnexpectedAttribute(node, attrib);
7262 break; 7256 break;
7263 } 7257 }
7264 } 7258 }
7265 else 7259 else
@@ -7320,50 +7314,50 @@ namespace WixToolset.Core
7320 } 7314 }
7321 } 7315 }
7322 7316
7323 foreach (XElement child in node.Elements()) 7317 foreach (var child in node.Elements())
7324 { 7318 {
7325 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 7319 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
7326 if (CompilerCore.WixNamespace == child.Name.Namespace) 7320 if (CompilerCore.WixNamespace == child.Name.Namespace)
7327 { 7321 {
7328 switch (child.Name.LocalName) 7322 switch (child.Name.LocalName)
7329 { 7323 {
7330 case "DigitalSignature": 7324 case "DigitalSignature":
7331 if (YesNoType.Yes == embedCab) 7325 if (YesNoType.Yes == embedCab)
7332 { 7326 {
7333 this.Core.Write(ErrorMessages.SignedEmbeddedCabinet(childSourceLineNumbers)); 7327 this.Core.Write(ErrorMessages.SignedEmbeddedCabinet(childSourceLineNumbers));
7334 } 7328 }
7335 else if (null == cabinet) 7329 else if (null == cabinet)
7336 { 7330 {
7337 this.Core.Write(ErrorMessages.ExpectedSignedCabinetName(childSourceLineNumbers)); 7331 this.Core.Write(ErrorMessages.ExpectedSignedCabinetName(childSourceLineNumbers));
7338 } 7332 }
7339 else 7333 else
7340 { 7334 {
7341 this.ParseDigitalSignatureElement(child, id.ToString(CultureInfo.InvariantCulture.NumberFormat)); 7335 this.ParseDigitalSignatureElement(child, id.ToString(CultureInfo.InvariantCulture.NumberFormat));
7342 } 7336 }
7343 break; 7337 break;
7344 case "PatchBaseline": 7338 case "PatchBaseline":
7345 if (patch) 7339 if (patch)
7346 { 7340 {
7347 this.ParsePatchBaselineElement(child, id); 7341 this.ParsePatchBaselineElement(child, id);
7348 } 7342 }
7349 else 7343 else
7350 { 7344 {
7351 this.Core.UnexpectedElement(node, child);
7352 }
7353 break;
7354 case "SymbolPath":
7355 if (null != symbols)
7356 {
7357 symbols += "" + this.ParseSymbolPathElement(child);
7358 }
7359 else
7360 {
7361 symbols = this.ParseSymbolPathElement(child);
7362 }
7363 break;
7364 default:
7365 this.Core.UnexpectedElement(node, child); 7345 this.Core.UnexpectedElement(node, child);
7366 break; 7346 }
7347 break;
7348 case "SymbolPath":
7349 if (null != symbols)
7350 {
7351 symbols += "" + this.ParseSymbolPathElement(child);
7352 }
7353 else
7354 {
7355 symbols = this.ParseSymbolPathElement(child);
7356 }
7357 break;
7358 default:
7359 this.Core.UnexpectedElement(node, child);
7360 break;
7367 } 7361 }
7368 } 7362 }
7369 else 7363 else
@@ -7411,78 +7405,78 @@ namespace WixToolset.Core
7411 /// <param name="patchId">Set to the PatchId if parsing Patch/Media element otherwise null.</param> 7405 /// <param name="patchId">Set to the PatchId if parsing Patch/Media element otherwise null.</param>
7412 private void ParseMediaTemplateElement(XElement node, string patchId) 7406 private void ParseMediaTemplateElement(XElement node, string patchId)
7413 { 7407 {
7414 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 7408 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
7415 string cabinetTemplate = "cab{0}.cab"; 7409 var cabinetTemplate = "cab{0}.cab";
7416 string compressionLevel = null; // this defaults to mszip in Binder 7410 string compressionLevel = null; // this defaults to mszip in Binder
7417 string diskPrompt = null; 7411 string diskPrompt = null;
7418 bool patch = null != patchId; 7412 var patch = null != patchId;
7419 string volumeLabel = null; 7413 string volumeLabel = null;
7420 int maximumUncompressedMediaSize = CompilerConstants.IntegerNotSet; 7414 var maximumUncompressedMediaSize = CompilerConstants.IntegerNotSet;
7421 int maximumCabinetSizeForLargeFileSplitting = CompilerConstants.IntegerNotSet; 7415 var maximumCabinetSizeForLargeFileSplitting = CompilerConstants.IntegerNotSet;
7422 Wix.CompressionLevelType compressionLevelType = Wix.CompressionLevelType.NotSet; 7416 var compressionLevelType = Wix.CompressionLevelType.NotSet;
7423 7417
7424 YesNoType embedCab = patch ? YesNoType.Yes : YesNoType.NotSet; 7418 var embedCab = patch ? YesNoType.Yes : YesNoType.NotSet;
7425 7419
7426 foreach (XAttribute attrib in node.Attributes()) 7420 foreach (var attrib in node.Attributes())
7427 { 7421 {
7428 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 7422 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
7429 { 7423 {
7430 switch (attrib.Name.LocalName) 7424 switch (attrib.Name.LocalName)
7431 { 7425 {
7432 case "CabinetTemplate": 7426 case "CabinetTemplate":
7433 string authoredCabinetTemplateValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 7427 var authoredCabinetTemplateValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
7434 if (!String.IsNullOrEmpty(authoredCabinetTemplateValue)) 7428 if (!String.IsNullOrEmpty(authoredCabinetTemplateValue))
7429 {
7430 cabinetTemplate = authoredCabinetTemplateValue;
7431 }
7432
7433 // Create an example cabinet name using the maximum number of cabinets supported, 999.
7434 var exampleCabinetName = String.Format(cabinetTemplate, "###");
7435 if (!this.Core.IsValidLocIdentifier(exampleCabinetName))
7436 {
7437 // The example name should not match the authored template since that would nullify the
7438 // reason for having multiple cabients. External cabinet files must also be valid file names.
7439 if (exampleCabinetName.Equals(authoredCabinetTemplateValue) || !this.Core.IsValidLongFilename(exampleCabinetName, false))
7435 { 7440 {
7436 cabinetTemplate = authoredCabinetTemplateValue; 7441 this.Core.Write(ErrorMessages.InvalidCabinetTemplate(sourceLineNumbers, cabinetTemplate));
7437 } 7442 }
7438 7443 else if (!this.Core.IsValidShortFilename(exampleCabinetName, false) && !Common.WixVariableRegex.Match(exampleCabinetName).Success) // ignore short names with wix variables because it rarely works out.
7439 // Create an example cabinet name using the maximum number of cabinets supported, 999.
7440 string exampleCabinetName = String.Format(cabinetTemplate, "###");
7441 if (!this.Core.IsValidLocIdentifier(exampleCabinetName))
7442 { 7444 {
7443 // The example name should not match the authored template since that would nullify the 7445 this.Core.Write(WarningMessages.MediaExternalCabinetFilenameIllegal(sourceLineNumbers, node.Name.LocalName, "CabinetTemplate", cabinetTemplate));
7444 // reason for having multiple cabients. External cabinet files must also be valid file names.
7445 if (exampleCabinetName.Equals(authoredCabinetTemplateValue) || !this.Core.IsValidLongFilename(exampleCabinetName, false))
7446 {
7447 this.Core.Write(ErrorMessages.InvalidCabinetTemplate(sourceLineNumbers, cabinetTemplate));
7448 }
7449 else if (!this.Core.IsValidShortFilename(exampleCabinetName, false) && !Common.WixVariableRegex.Match(exampleCabinetName).Success) // ignore short names with wix variables because it rarely works out.
7450 {
7451 this.Core.Write(WarningMessages.MediaExternalCabinetFilenameIllegal(sourceLineNumbers, node.Name.LocalName, "CabinetTemplate", cabinetTemplate));
7452 }
7453 } 7446 }
7454 break; 7447 }
7455 case "CompressionLevel": 7448 break;
7456 compressionLevel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7449 case "CompressionLevel":
7457 if (0 < compressionLevel.Length) 7450 compressionLevel = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7451 if (0 < compressionLevel.Length)
7452 {
7453 if (!Wix.Enums.TryParseCompressionLevelType(compressionLevel, out compressionLevelType))
7458 { 7454 {
7459 if (!Wix.Enums.TryParseCompressionLevelType(compressionLevel, out compressionLevelType)) 7455 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, compressionLevel, "high", "low", "medium", "mszip", "none"));
7460 {
7461 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, compressionLevel, "high", "low", "medium", "mszip", "none"));
7462 }
7463 } 7456 }
7464 break; 7457 }
7465 case "DiskPrompt": 7458 break;
7466 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7459 case "DiskPrompt":
7467 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined 7460 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7468 this.Core.Write(WarningMessages.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 7461 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "DiskPrompt"); // ensure the output has a DiskPrompt Property defined
7469 break; 7462 this.Core.Write(WarningMessages.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
7470 case "EmbedCab": 7463 break;
7471 embedCab = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7464 case "EmbedCab":
7472 break; 7465 embedCab = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7473 case "VolumeLabel": 7466 break;
7474 volumeLabel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7467 case "VolumeLabel":
7475 this.Core.Write(WarningMessages.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 7468 volumeLabel = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7476 break; 7469 this.Core.Write(WarningMessages.ReservedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
7477 case "MaximumUncompressedMediaSize": 7470 break;
7478 maximumUncompressedMediaSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, int.MaxValue); 7471 case "MaximumUncompressedMediaSize":
7479 break; 7472 maximumUncompressedMediaSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int32.MaxValue);
7480 case "MaximumCabinetSizeForLargeFileSplitting": 7473 break;
7481 maximumCabinetSizeForLargeFileSplitting = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, CompilerCore.MinValueOfMaxCabSizeForLargeFileSplitting, CompilerCore.MaxValueOfMaxCabSizeForLargeFileSplitting); 7474 case "MaximumCabinetSizeForLargeFileSplitting":
7482 break; 7475 maximumCabinetSizeForLargeFileSplitting = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, CompilerCore.MinValueOfMaxCabSizeForLargeFileSplitting, CompilerCore.MaxValueOfMaxCabSizeForLargeFileSplitting);
7483 default: 7476 break;
7484 this.Core.UnexpectedAttribute(node, attrib); 7477 default:
7485 break; 7478 this.Core.UnexpectedAttribute(node, attrib);
7479 break;
7486 } 7480 }
7487 } 7481 }
7488 else 7482 else
@@ -7529,21 +7523,21 @@ namespace WixToolset.Core
7529 7523
7530 switch (compressionLevelType) 7524 switch (compressionLevelType)
7531 { 7525 {
7532 case Wix.CompressionLevelType.high: 7526 case Wix.CompressionLevelType.high:
7533 mediaTemplateRow.CompressionLevel = CompressionLevel.High; 7527 mediaTemplateRow.CompressionLevel = CompressionLevel.High;
7534 break; 7528 break;
7535 case Wix.CompressionLevelType.low: 7529 case Wix.CompressionLevelType.low:
7536 mediaTemplateRow.CompressionLevel = CompressionLevel.Low; 7530 mediaTemplateRow.CompressionLevel = CompressionLevel.Low;
7537 break; 7531 break;
7538 case Wix.CompressionLevelType.medium: 7532 case Wix.CompressionLevelType.medium:
7539 mediaTemplateRow.CompressionLevel = CompressionLevel.Medium; 7533 mediaTemplateRow.CompressionLevel = CompressionLevel.Medium;
7540 break; 7534 break;
7541 case Wix.CompressionLevelType.none: 7535 case Wix.CompressionLevelType.none:
7542 mediaTemplateRow.CompressionLevel = CompressionLevel.None; 7536 mediaTemplateRow.CompressionLevel = CompressionLevel.None;
7543 break; 7537 break;
7544 case Wix.CompressionLevelType.mszip: 7538 case Wix.CompressionLevelType.mszip:
7545 mediaTemplateRow.CompressionLevel = CompressionLevel.Mszip; 7539 mediaTemplateRow.CompressionLevel = CompressionLevel.Mszip;
7546 break; 7540 break;
7547 } 7541 }
7548 } 7542 }
7549 } 7543 }
@@ -7556,38 +7550,38 @@ namespace WixToolset.Core
7556 /// <param name="diskId">Disk id inherited from parent directory.</param> 7550 /// <param name="diskId">Disk id inherited from parent directory.</param>
7557 private void ParseMergeElement(XElement node, string directoryId, int diskId) 7551 private void ParseMergeElement(XElement node, string directoryId, int diskId)
7558 { 7552 {
7559 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 7553 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
7560 Identifier id = null; 7554 Identifier id = null;
7561 string configData = String.Empty; 7555 var configData = String.Empty;
7562 YesNoType fileCompression = YesNoType.NotSet; 7556 var fileCompression = YesNoType.NotSet;
7563 string language = null; 7557 string language = null;
7564 string sourceFile = null; 7558 string sourceFile = null;
7565 7559
7566 foreach (XAttribute attrib in node.Attributes()) 7560 foreach (var attrib in node.Attributes())
7567 { 7561 {
7568 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 7562 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
7569 { 7563 {
7570 switch (attrib.Name.LocalName) 7564 switch (attrib.Name.LocalName)
7571 { 7565 {
7572 case "Id": 7566 case "Id":
7573 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 7567 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
7574 break; 7568 break;
7575 case "DiskId": 7569 case "DiskId":
7576 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); 7570 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
7577 this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat)); 7571 this.Core.CreateSimpleReference(sourceLineNumbers, "Media", diskId.ToString(CultureInfo.InvariantCulture.NumberFormat));
7578 break; 7572 break;
7579 case "FileCompression": 7573 case "FileCompression":
7580 fileCompression = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7574 fileCompression = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7581 break; 7575 break;
7582 case "Language": 7576 case "Language":
7583 language = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 7577 language = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
7584 break; 7578 break;
7585 case "SourceFile": 7579 case "SourceFile":
7586 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7580 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7587 break; 7581 break;
7588 default: 7582 default:
7589 this.Core.UnexpectedAttribute(node, attrib); 7583 this.Core.UnexpectedAttribute(node, attrib);
7590 break; 7584 break;
7591 } 7585 }
7592 } 7586 }
7593 else 7587 else
@@ -7617,25 +7611,25 @@ namespace WixToolset.Core
7617 diskId = CompilerConstants.IllegalInteger; 7611 diskId = CompilerConstants.IllegalInteger;
7618 } 7612 }
7619 7613
7620 foreach (XElement child in node.Elements()) 7614 foreach (var child in node.Elements())
7621 { 7615 {
7622 if (CompilerCore.WixNamespace == child.Name.Namespace) 7616 if (CompilerCore.WixNamespace == child.Name.Namespace)
7623 { 7617 {
7624 switch (child.Name.LocalName) 7618 switch (child.Name.LocalName)
7625 { 7619 {
7626 case "ConfigurationData": 7620 case "ConfigurationData":
7627 if (0 == configData.Length) 7621 if (0 == configData.Length)
7628 { 7622 {
7629 configData = this.ParseConfigurationDataElement(child); 7623 configData = this.ParseConfigurationDataElement(child);
7630 } 7624 }
7631 else 7625 else
7632 { 7626 {
7633 configData = String.Concat(configData, ",", this.ParseConfigurationDataElement(child)); 7627 configData = String.Concat(configData, ",", this.ParseConfigurationDataElement(child));
7634 } 7628 }
7635 break; 7629 break;
7636 default: 7630 default:
7637 this.Core.UnexpectedElement(node, child); 7631 this.Core.UnexpectedElement(node, child);
7638 break; 7632 break;
7639 } 7633 }
7640 } 7634 }
7641 else 7635 else
@@ -7675,25 +7669,25 @@ namespace WixToolset.Core
7675 /// <returns>String in format "name=value" with '%', ',' and '=' hex encoded.</returns> 7669 /// <returns>String in format "name=value" with '%', ',' and '=' hex encoded.</returns>
7676 private string ParseConfigurationDataElement(XElement node) 7670 private string ParseConfigurationDataElement(XElement node)
7677 { 7671 {
7678 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 7672 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
7679 string name = null; 7673 string name = null;
7680 string value = null; 7674 string value = null;
7681 7675
7682 foreach (XAttribute attrib in node.Attributes()) 7676 foreach (var attrib in node.Attributes())
7683 { 7677 {
7684 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 7678 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
7685 { 7679 {
7686 switch (attrib.Name.LocalName) 7680 switch (attrib.Name.LocalName)
7687 { 7681 {
7688 case "Name": 7682 case "Name":
7689 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7683 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7690 break; 7684 break;
7691 case "Value": 7685 case "Value":
7692 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7686 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7693 break; 7687 break;
7694 default: 7688 default:
7695 this.Core.UnexpectedAttribute(node, attrib); 7689 this.Core.UnexpectedAttribute(node, attrib);
7696 break; 7690 break;
7697 } 7691 }
7698 } 7692 }
7699 else 7693 else
@@ -7737,26 +7731,26 @@ namespace WixToolset.Core
7737 /// <param name="parentId">Identifier for parent feature or feature group.</param> 7731 /// <param name="parentId">Identifier for parent feature or feature group.</param>
7738 private void ParseMergeRefElement(XElement node, ComplexReferenceParentType parentType, string parentId) 7732 private void ParseMergeRefElement(XElement node, ComplexReferenceParentType parentType, string parentId)
7739 { 7733 {
7740 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 7734 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
7741 string id = null; 7735 string id = null;
7742 YesNoType primary = YesNoType.NotSet; 7736 var primary = YesNoType.NotSet;
7743 7737
7744 foreach (XAttribute attrib in node.Attributes()) 7738 foreach (var attrib in node.Attributes())
7745 { 7739 {
7746 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 7740 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
7747 { 7741 {
7748 switch (attrib.Name.LocalName) 7742 switch (attrib.Name.LocalName)
7749 { 7743 {
7750 case "Id": 7744 case "Id":
7751 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 7745 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
7752 this.Core.CreateSimpleReference(sourceLineNumbers, "WixMerge", id); 7746 this.Core.CreateSimpleReference(sourceLineNumbers, "WixMerge", id);
7753 break; 7747 break;
7754 case "Primary": 7748 case "Primary":
7755 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7749 primary = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7756 break; 7750 break;
7757 default: 7751 default:
7758 this.Core.UnexpectedAttribute(node, attrib); 7752 this.Core.UnexpectedAttribute(node, attrib);
7759 break; 7753 break;
7760 } 7754 }
7761 } 7755 }
7762 else 7756 else
@@ -7785,33 +7779,33 @@ namespace WixToolset.Core
7785 /// <returns>Content type if this is the default for the MIME type.</returns> 7779 /// <returns>Content type if this is the default for the MIME type.</returns>
7786 private string ParseMIMEElement(XElement node, string extension, string componentId, YesNoType parentAdvertised) 7780 private string ParseMIMEElement(XElement node, string extension, string componentId, YesNoType parentAdvertised)
7787 { 7781 {
7788 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 7782 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
7789 string classId = null; 7783 string classId = null;
7790 string contentType = null; 7784 string contentType = null;
7791 YesNoType advertise = parentAdvertised; 7785 var advertise = parentAdvertised;
7792 YesNoType returnContentType = YesNoType.NotSet; 7786 var returnContentType = YesNoType.NotSet;
7793 7787
7794 foreach (XAttribute attrib in node.Attributes()) 7788 foreach (var attrib in node.Attributes())
7795 { 7789 {
7796 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 7790 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
7797 { 7791 {
7798 switch (attrib.Name.LocalName) 7792 switch (attrib.Name.LocalName)
7799 { 7793 {
7800 case "Advertise": 7794 case "Advertise":
7801 advertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7795 advertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7802 break; 7796 break;
7803 case "Class": 7797 case "Class":
7804 classId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 7798 classId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
7805 break; 7799 break;
7806 case "ContentType": 7800 case "ContentType":
7807 contentType = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7801 contentType = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7808 break; 7802 break;
7809 case "Default": 7803 case "Default":
7810 returnContentType = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 7804 returnContentType = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
7811 break; 7805 break;
7812 default: 7806 default:
7813 this.Core.UnexpectedAttribute(node, attrib); 7807 this.Core.UnexpectedAttribute(node, attrib);
7814 break; 7808 break;
7815 } 7809 }
7816 } 7810 }
7817 else 7811 else
@@ -7871,47 +7865,47 @@ namespace WixToolset.Core
7871 /// <param name="node">Element to parse.</param> 7865 /// <param name="node">Element to parse.</param>
7872 private void ParseModuleElement(XElement node) 7866 private void ParseModuleElement(XElement node)
7873 { 7867 {
7874 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 7868 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
7875 int codepage = 0; 7869 var codepage = 0;
7876 string moduleId = null; 7870 string moduleId = null;
7877 string version = null; 7871 string version = null;
7878 7872
7879 this.activeName = null; 7873 this.activeName = null;
7880 this.activeLanguage = null; 7874 this.activeLanguage = null;
7881 7875
7882 foreach (XAttribute attrib in node.Attributes()) 7876 foreach (var attrib in node.Attributes())
7883 { 7877 {
7884 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 7878 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
7885 { 7879 {
7886 switch (attrib.Name.LocalName) 7880 switch (attrib.Name.LocalName)
7887 { 7881 {
7888 case "Id": 7882 case "Id":
7889 this.activeName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 7883 this.activeName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
7890 if ("PUT-MODULE-NAME-HERE" == this.activeName) 7884 if ("PUT-MODULE-NAME-HERE" == this.activeName)
7891 { 7885 {
7892 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName)); 7886 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName));
7893 } 7887 }
7894 else 7888 else
7895 { 7889 {
7896 this.activeName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 7890 this.activeName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
7897 } 7891 }
7898 break; 7892 break;
7899 case "Codepage": 7893 case "Codepage":
7900 codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); 7894 codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib);
7901 break; 7895 break;
7902 case "Guid": 7896 case "Guid":
7903 moduleId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 7897 moduleId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
7904 this.Core.Write(WarningMessages.DeprecatedModuleGuidAttribute(sourceLineNumbers)); 7898 this.Core.Write(WarningMessages.DeprecatedModuleGuidAttribute(sourceLineNumbers));
7905 break; 7899 break;
7906 case "Language": 7900 case "Language":
7907 this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 7901 this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
7908 break; 7902 break;
7909 case "Version": 7903 case "Version":
7910 version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); 7904 version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
7911 break; 7905 break;
7912 default: 7906 default:
7913 this.Core.UnexpectedAttribute(node, attrib); 7907 this.Core.UnexpectedAttribute(node, attrib);
7914 break; 7908 break;
7915 } 7909 }
7916 } 7910 }
7917 else 7911 else
@@ -7944,110 +7938,110 @@ namespace WixToolset.Core
7944 this.compilingModule = true; // notice that we are actually building a Merge Module here 7938 this.compilingModule = true; // notice that we are actually building a Merge Module here
7945 this.Core.CreateActiveSection(this.activeName, SectionType.Module, codepage, this.Context.CompilationId); 7939 this.Core.CreateActiveSection(this.activeName, SectionType.Module, codepage, this.Context.CompilationId);
7946 7940
7947 foreach (XElement child in node.Elements()) 7941 foreach (var child in node.Elements())
7948 { 7942 {
7949 if (CompilerCore.WixNamespace == child.Name.Namespace) 7943 if (CompilerCore.WixNamespace == child.Name.Namespace)
7950 { 7944 {
7951 switch (child.Name.LocalName) 7945 switch (child.Name.LocalName)
7952 { 7946 {
7953 case "AdminExecuteSequence": 7947 case "AdminExecuteSequence":
7954 case "AdminUISequence": 7948 case "AdminUISequence":
7955 case "AdvertiseExecuteSequence": 7949 case "AdvertiseExecuteSequence":
7956 case "InstallExecuteSequence": 7950 case "InstallExecuteSequence":
7957 case "InstallUISequence": 7951 case "InstallUISequence":
7958 this.ParseSequenceElement(child, child.Name.LocalName); 7952 this.ParseSequenceElement(child, child.Name.LocalName);
7959 break; 7953 break;
7960 case "AppId": 7954 case "AppId":
7961 this.ParseAppIdElement(child, null, YesNoType.Yes, null, null, null); 7955 this.ParseAppIdElement(child, null, YesNoType.Yes, null, null, null);
7962 break; 7956 break;
7963 case "Binary": 7957 case "Binary":
7964 this.ParseBinaryElement(child); 7958 this.ParseBinaryElement(child);
7965 break; 7959 break;
7966 case "Component": 7960 case "Component":
7967 this.ParseComponentElement(child, ComplexReferenceParentType.Module, this.activeName, this.activeLanguage, CompilerConstants.IntegerNotSet, null, null); 7961 this.ParseComponentElement(child, ComplexReferenceParentType.Module, this.activeName, this.activeLanguage, CompilerConstants.IntegerNotSet, null, null);
7968 break; 7962 break;
7969 case "ComponentGroupRef": 7963 case "ComponentGroupRef":
7970 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.Module, this.activeName, this.activeLanguage); 7964 this.ParseComponentGroupRefElement(child, ComplexReferenceParentType.Module, this.activeName, this.activeLanguage);
7971 break; 7965 break;
7972 case "ComponentRef": 7966 case "ComponentRef":
7973 this.ParseComponentRefElement(child, ComplexReferenceParentType.Module, this.activeName, this.activeLanguage); 7967 this.ParseComponentRefElement(child, ComplexReferenceParentType.Module, this.activeName, this.activeLanguage);
7974 break; 7968 break;
7975 case "Configuration": 7969 case "Configuration":
7976 this.ParseConfigurationElement(child); 7970 this.ParseConfigurationElement(child);
7977 break; 7971 break;
7978 case "CustomAction": 7972 case "CustomAction":
7979 this.ParseCustomActionElement(child); 7973 this.ParseCustomActionElement(child);
7980 break; 7974 break;
7981 case "CustomActionRef": 7975 case "CustomActionRef":
7982 this.ParseSimpleRefElement(child, "CustomAction"); 7976 this.ParseSimpleRefElement(child, "CustomAction");
7983 break; 7977 break;
7984 case "CustomTable": 7978 case "CustomTable":
7985 this.ParseCustomTableElement(child); 7979 this.ParseCustomTableElement(child);
7986 break; 7980 break;
7987 case "Dependency": 7981 case "Dependency":
7988 this.ParseDependencyElement(child); 7982 this.ParseDependencyElement(child);
7989 break; 7983 break;
7990 case "Directory": 7984 case "Directory":
7991 this.ParseDirectoryElement(child, null, CompilerConstants.IntegerNotSet, String.Empty); 7985 this.ParseDirectoryElement(child, null, CompilerConstants.IntegerNotSet, String.Empty);
7992 break; 7986 break;
7993 case "DirectoryRef": 7987 case "DirectoryRef":
7994 this.ParseDirectoryRefElement(child); 7988 this.ParseDirectoryRefElement(child);
7995 break; 7989 break;
7996 case "EmbeddedChainer": 7990 case "EmbeddedChainer":
7997 this.ParseEmbeddedChainerElement(child); 7991 this.ParseEmbeddedChainerElement(child);
7998 break; 7992 break;
7999 case "EmbeddedChainerRef": 7993 case "EmbeddedChainerRef":
8000 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer"); 7994 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer");
8001 break; 7995 break;
8002 case "EnsureTable": 7996 case "EnsureTable":
8003 this.ParseEnsureTableElement(child); 7997 this.ParseEnsureTableElement(child);
8004 break; 7998 break;
8005 case "Exclusion": 7999 case "Exclusion":
8006 this.ParseExclusionElement(child); 8000 this.ParseExclusionElement(child);
8007 break; 8001 break;
8008 case "Icon": 8002 case "Icon":
8009 this.ParseIconElement(child); 8003 this.ParseIconElement(child);
8010 break; 8004 break;
8011 case "IgnoreModularization": 8005 case "IgnoreModularization":
8012 this.ParseIgnoreModularizationElement(child); 8006 this.ParseIgnoreModularizationElement(child);
8013 break; 8007 break;
8014 case "IgnoreTable": 8008 case "IgnoreTable":
8015 this.ParseIgnoreTableElement(child); 8009 this.ParseIgnoreTableElement(child);
8016 break; 8010 break;
8017 case "Package": 8011 case "Package":
8018 this.ParsePackageElement(child, null, moduleId); 8012 this.ParsePackageElement(child, null, moduleId);
8019 break; 8013 break;
8020 case "Property": 8014 case "Property":
8021 this.ParsePropertyElement(child); 8015 this.ParsePropertyElement(child);
8022 break; 8016 break;
8023 case "PropertyRef": 8017 case "PropertyRef":
8024 this.ParseSimpleRefElement(child, "Property"); 8018 this.ParseSimpleRefElement(child, "Property");
8025 break; 8019 break;
8026 case "SetDirectory": 8020 case "SetDirectory":
8027 this.ParseSetDirectoryElement(child); 8021 this.ParseSetDirectoryElement(child);
8028 break; 8022 break;
8029 case "SetProperty": 8023 case "SetProperty":
8030 this.ParseSetPropertyElement(child); 8024 this.ParseSetPropertyElement(child);
8031 break; 8025 break;
8032 case "SFPCatalog": 8026 case "SFPCatalog":
8033 string parentName = null; 8027 string parentName = null;
8034 this.ParseSFPCatalogElement(child, ref parentName); 8028 this.ParseSFPCatalogElement(child, ref parentName);
8035 break; 8029 break;
8036 case "Substitution": 8030 case "Substitution":
8037 this.ParseSubstitutionElement(child); 8031 this.ParseSubstitutionElement(child);
8038 break; 8032 break;
8039 case "UI": 8033 case "UI":
8040 this.ParseUIElement(child); 8034 this.ParseUIElement(child);
8041 break; 8035 break;
8042 case "UIRef": 8036 case "UIRef":
8043 this.ParseSimpleRefElement(child, "WixUI"); 8037 this.ParseSimpleRefElement(child, "WixUI");
8044 break; 8038 break;
8045 case "WixVariable": 8039 case "WixVariable":
8046 this.ParseWixVariableElement(child); 8040 this.ParseWixVariableElement(child);
8047 break; 8041 break;
8048 default: 8042 default:
8049 this.Core.UnexpectedElement(node, child); 8043 this.Core.UnexpectedElement(node, child);
8050 break; 8044 break;
8051 } 8045 }
8052 } 8046 }
8053 else 8047 else
@@ -8077,54 +8071,54 @@ namespace WixToolset.Core
8077 /// <param name="node">The element to parse.</param> 8071 /// <param name="node">The element to parse.</param>
8078 private void ParsePatchCreationElement(XElement node) 8072 private void ParsePatchCreationElement(XElement node)
8079 { 8073 {
8080 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 8074 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
8081 bool clean = true; // Default is to clean 8075 var clean = true; // Default is to clean
8082 int codepage = 0; 8076 var codepage = 0;
8083 string outputPath = null; 8077 string outputPath = null;
8084 bool productMismatches = false; 8078 var productMismatches = false;
8085 string replaceGuids = String.Empty; 8079 var replaceGuids = String.Empty;
8086 string sourceList = null; 8080 string sourceList = null;
8087 string symbolFlags = null; 8081 string symbolFlags = null;
8088 string targetProducts = String.Empty; 8082 var targetProducts = String.Empty;
8089 bool versionMismatches = false; 8083 var versionMismatches = false;
8090 bool wholeFiles = false; 8084 var wholeFiles = false;
8091 8085
8092 foreach (XAttribute attrib in node.Attributes()) 8086 foreach (var attrib in node.Attributes())
8093 { 8087 {
8094 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 8088 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
8095 { 8089 {
8096 switch (attrib.Name.LocalName) 8090 switch (attrib.Name.LocalName)
8097 { 8091 {
8098 case "Id": 8092 case "Id":
8099 this.activeName = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 8093 this.activeName = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
8100 break; 8094 break;
8101 case "AllowMajorVersionMismatches": 8095 case "AllowMajorVersionMismatches":
8102 versionMismatches = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 8096 versionMismatches = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
8103 break; 8097 break;
8104 case "AllowProductCodeMismatches": 8098 case "AllowProductCodeMismatches":
8105 productMismatches = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 8099 productMismatches = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
8106 break; 8100 break;
8107 case "CleanWorkingFolder": 8101 case "CleanWorkingFolder":
8108 clean = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 8102 clean = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
8109 break; 8103 break;
8110 case "Codepage": 8104 case "Codepage":
8111 codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); 8105 codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib);
8112 break; 8106 break;
8113 case "OutputPath": 8107 case "OutputPath":
8114 outputPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8108 outputPath = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8115 break; 8109 break;
8116 case "SourceList": 8110 case "SourceList":
8117 sourceList = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8111 sourceList = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8118 break; 8112 break;
8119 case "SymbolFlags": 8113 case "SymbolFlags":
8120 symbolFlags = String.Format(CultureInfo.InvariantCulture, "0x{0:x8}", this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, 0, uint.MaxValue)); 8114 symbolFlags = String.Format(CultureInfo.InvariantCulture, "0x{0:x8}", this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, 0, UInt32.MaxValue));
8121 break; 8115 break;
8122 case "WholeFilesOnly": 8116 case "WholeFilesOnly":
8123 wholeFiles = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 8117 wholeFiles = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
8124 break; 8118 break;
8125 default: 8119 default:
8126 this.Core.UnexpectedAttribute(node, attrib); 8120 this.Core.UnexpectedAttribute(node, attrib);
8127 break; 8121 break;
8128 } 8122 }
8129 } 8123 }
8130 else 8124 else
@@ -8140,41 +8134,41 @@ namespace WixToolset.Core
8140 8134
8141 this.Core.CreateActiveSection(this.activeName, SectionType.PatchCreation, codepage, this.Context.CompilationId); 8135 this.Core.CreateActiveSection(this.activeName, SectionType.PatchCreation, codepage, this.Context.CompilationId);
8142 8136
8143 foreach (XElement child in node.Elements()) 8137 foreach (var child in node.Elements())
8144 { 8138 {
8145 if (CompilerCore.WixNamespace == child.Name.Namespace) 8139 if (CompilerCore.WixNamespace == child.Name.Namespace)
8146 { 8140 {
8147 switch (child.Name.LocalName) 8141 switch (child.Name.LocalName)
8148 { 8142 {
8149 case "Family": 8143 case "Family":
8150 this.ParseFamilyElement(child); 8144 this.ParseFamilyElement(child);
8151 break; 8145 break;
8152 case "PatchInformation": 8146 case "PatchInformation":
8153 this.ParsePatchInformationElement(child); 8147 this.ParsePatchInformationElement(child);
8154 break; 8148 break;
8155 case "PatchMetadata": 8149 case "PatchMetadata":
8156 this.ParsePatchMetadataElement(child); 8150 this.ParsePatchMetadataElement(child);
8157 break; 8151 break;
8158 case "PatchProperty": 8152 case "PatchProperty":
8159 this.ParsePatchPropertyElement(child, false); 8153 this.ParsePatchPropertyElement(child, false);
8160 break; 8154 break;
8161 case "PatchSequence": 8155 case "PatchSequence":
8162 this.ParsePatchSequenceElement(child); 8156 this.ParsePatchSequenceElement(child);
8163 break; 8157 break;
8164 case "ReplacePatch": 8158 case "ReplacePatch":
8165 replaceGuids = String.Concat(replaceGuids, this.ParseReplacePatchElement(child)); 8159 replaceGuids = String.Concat(replaceGuids, this.ParseReplacePatchElement(child));
8166 break; 8160 break;
8167 case "TargetProductCode": 8161 case "TargetProductCode":
8168 string targetProduct = this.ParseTargetProductCodeElement(child); 8162 var targetProduct = this.ParseTargetProductCodeElement(child);
8169 if (0 < targetProducts.Length) 8163 if (0 < targetProducts.Length)
8170 { 8164 {
8171 targetProducts = String.Concat(targetProducts, ";"); 8165 targetProducts = String.Concat(targetProducts, ";");
8172 } 8166 }
8173 targetProducts = String.Concat(targetProducts, targetProduct); 8167 targetProducts = String.Concat(targetProducts, targetProduct);
8174 break; 8168 break;
8175 default: 8169 default:
8176 this.Core.UnexpectedElement(node, child); 8170 this.Core.UnexpectedElement(node, child);
8177 break; 8171 break;
8178 } 8172 }
8179 } 8173 }
8180 else 8174 else
@@ -8221,41 +8215,41 @@ namespace WixToolset.Core
8221 /// <param name="node">The element to parse.</param> 8215 /// <param name="node">The element to parse.</param>
8222 private void ParseFamilyElement(XElement node) 8216 private void ParseFamilyElement(XElement node)
8223 { 8217 {
8224 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 8218 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
8225 int diskId = CompilerConstants.IntegerNotSet; 8219 var diskId = CompilerConstants.IntegerNotSet;
8226 string diskPrompt = null; 8220 string diskPrompt = null;
8227 string mediaSrcProp = null; 8221 string mediaSrcProp = null;
8228 string name = null; 8222 string name = null;
8229 int sequenceStart = CompilerConstants.IntegerNotSet; 8223 var sequenceStart = CompilerConstants.IntegerNotSet;
8230 string volumeLabel = null; 8224 string volumeLabel = null;
8231 8225
8232 foreach (XAttribute attrib in node.Attributes()) 8226 foreach (var attrib in node.Attributes())
8233 { 8227 {
8234 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 8228 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
8235 { 8229 {
8236 switch (attrib.Name.LocalName) 8230 switch (attrib.Name.LocalName)
8237 { 8231 {
8238 case "DiskId": 8232 case "DiskId":
8239 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); 8233 diskId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
8240 break; 8234 break;
8241 case "DiskPrompt": 8235 case "DiskPrompt":
8242 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8236 diskPrompt = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8243 break; 8237 break;
8244 case "MediaSrcProp": 8238 case "MediaSrcProp":
8245 mediaSrcProp = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8239 mediaSrcProp = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8246 break; 8240 break;
8247 case "Name": 8241 case "Name":
8248 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8242 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8249 break; 8243 break;
8250 case "SequenceStart": 8244 case "SequenceStart":
8251 sequenceStart = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, int.MaxValue); 8245 sequenceStart = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int32.MaxValue);
8252 break; 8246 break;
8253 case "VolumeLabel": 8247 case "VolumeLabel":
8254 volumeLabel = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8248 volumeLabel = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8255 break; 8249 break;
8256 default: 8250 default:
8257 this.Core.UnexpectedAttribute(node, attrib); 8251 this.Core.UnexpectedAttribute(node, attrib);
8258 break; 8252 break;
8259 } 8253 }
8260 } 8254 }
8261 else 8255 else
@@ -8276,7 +8270,7 @@ namespace WixToolset.Core
8276 } 8270 }
8277 else // check for illegal characters 8271 else // check for illegal characters
8278 { 8272 {
8279 foreach (char character in name) 8273 foreach (var character in name)
8280 { 8274 {
8281 if (!Char.IsLetterOrDigit(character) && '_' != character) 8275 if (!Char.IsLetterOrDigit(character) && '_' != character)
8282 { 8276 {
@@ -8286,24 +8280,24 @@ namespace WixToolset.Core
8286 } 8280 }
8287 } 8281 }
8288 8282
8289 foreach (XElement child in node.Elements()) 8283 foreach (var child in node.Elements())
8290 { 8284 {
8291 if (CompilerCore.WixNamespace == child.Name.Namespace) 8285 if (CompilerCore.WixNamespace == child.Name.Namespace)
8292 { 8286 {
8293 switch (child.Name.LocalName) 8287 switch (child.Name.LocalName)
8294 { 8288 {
8295 case "UpgradeImage": 8289 case "UpgradeImage":
8296 this.ParseUpgradeImageElement(child, name); 8290 this.ParseUpgradeImageElement(child, name);
8297 break; 8291 break;
8298 case "ExternalFile": 8292 case "ExternalFile":
8299 this.ParseExternalFileElement(child, name); 8293 this.ParseExternalFileElement(child, name);
8300 break; 8294 break;
8301 case "ProtectFile": 8295 case "ProtectFile":
8302 this.ParseProtectFileElement(child, name); 8296 this.ParseProtectFileElement(child, name);
8303 break; 8297 break;
8304 default: 8298 default:
8305 this.Core.UnexpectedElement(node, child); 8299 this.Core.UnexpectedElement(node, child);
8306 break; 8300 break;
8307 } 8301 }
8308 } 8302 }
8309 else 8303 else
@@ -8338,54 +8332,54 @@ namespace WixToolset.Core
8338 /// <param name="family">The family for this element.</param> 8332 /// <param name="family">The family for this element.</param>
8339 private void ParseUpgradeImageElement(XElement node, string family) 8333 private void ParseUpgradeImageElement(XElement node, string family)
8340 { 8334 {
8341 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 8335 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
8342 string sourceFile = null; 8336 string sourceFile = null;
8343 string sourcePatch = null; 8337 string sourcePatch = null;
8344 List<string> symbols = new List<string>(); 8338 var symbols = new List<string>();
8345 string upgrade = null; 8339 string upgrade = null;
8346 8340
8347 foreach (XAttribute attrib in node.Attributes()) 8341 foreach (var attrib in node.Attributes())
8348 { 8342 {
8349 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 8343 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
8350 { 8344 {
8351 switch (attrib.Name.LocalName) 8345 switch (attrib.Name.LocalName)
8352 { 8346 {
8353 case "Id": 8347 case "Id":
8354 upgrade = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8348 upgrade = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8355 if (13 < upgrade.Length) 8349 if (13 < upgrade.Length)
8356 { 8350 {
8357 this.Core.Write(ErrorMessages.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", upgrade, 13)); 8351 this.Core.Write(ErrorMessages.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", upgrade, 13));
8358 } 8352 }
8359 break; 8353 break;
8360 case "SourceFile": 8354 case "SourceFile":
8361 case "src": 8355 case "src":
8362 if (null != sourceFile) 8356 if (null != sourceFile)
8363 { 8357 {
8364 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "SourceFile")); 8358 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "SourceFile"));
8365 } 8359 }
8366 8360
8367 if ("src" == attrib.Name.LocalName) 8361 if ("src" == attrib.Name.LocalName)
8368 { 8362 {
8369 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile")); 8363 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile"));
8370 } 8364 }
8371 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8365 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8372 break; 8366 break;
8373 case "SourcePatch": 8367 case "SourcePatch":
8374 case "srcPatch": 8368 case "srcPatch":
8375 if (null != sourcePatch) 8369 if (null != sourcePatch)
8376 { 8370 {
8377 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "srcPatch", "SourcePatch")); 8371 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "srcPatch", "SourcePatch"));
8378 } 8372 }
8379 8373
8380 if ("srcPatch" == attrib.Name.LocalName) 8374 if ("srcPatch" == attrib.Name.LocalName)
8381 { 8375 {
8382 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourcePatch")); 8376 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourcePatch"));
8383 } 8377 }
8384 sourcePatch = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8378 sourcePatch = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8385 break; 8379 break;
8386 default: 8380 default:
8387 this.Core.UnexpectedAttribute(node, attrib); 8381 this.Core.UnexpectedAttribute(node, attrib);
8388 break; 8382 break;
8389 } 8383 }
8390 } 8384 }
8391 else 8385 else
@@ -8404,24 +8398,24 @@ namespace WixToolset.Core
8404 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); 8398 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile"));
8405 } 8399 }
8406 8400
8407 foreach (XElement child in node.Elements()) 8401 foreach (var child in node.Elements())
8408 { 8402 {
8409 if (CompilerCore.WixNamespace == child.Name.Namespace) 8403 if (CompilerCore.WixNamespace == child.Name.Namespace)
8410 { 8404 {
8411 switch (child.Name.LocalName) 8405 switch (child.Name.LocalName)
8412 { 8406 {
8413 case "SymbolPath": 8407 case "SymbolPath":
8414 symbols.Add(this.ParseSymbolPathElement(child)); 8408 symbols.Add(this.ParseSymbolPathElement(child));
8415 break; 8409 break;
8416 case "TargetImage": 8410 case "TargetImage":
8417 this.ParseTargetImageElement(child, upgrade, family); 8411 this.ParseTargetImageElement(child, upgrade, family);
8418 break; 8412 break;
8419 case "UpgradeFile": 8413 case "UpgradeFile":
8420 this.ParseUpgradeFileElement(child, upgrade); 8414 this.ParseUpgradeFileElement(child, upgrade);
8421 break; 8415 break;
8422 default: 8416 default:
8423 this.Core.UnexpectedElement(node, child); 8417 this.Core.UnexpectedElement(node, child);
8424 break; 8418 break;
8425 } 8419 }
8426 } 8420 }
8427 else 8421 else
@@ -8448,34 +8442,34 @@ namespace WixToolset.Core
8448 /// <param name="upgrade">The upgrade key for this element.</param> 8442 /// <param name="upgrade">The upgrade key for this element.</param>
8449 private void ParseUpgradeFileElement(XElement node, string upgrade) 8443 private void ParseUpgradeFileElement(XElement node, string upgrade)
8450 { 8444 {
8451 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 8445 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
8452 bool allowIgnoreOnError = false; 8446 var allowIgnoreOnError = false;
8453 string file = null; 8447 string file = null;
8454 bool ignore = false; 8448 var ignore = false;
8455 List<string> symbols = new List<string>(); 8449 var symbols = new List<string>();
8456 bool wholeFile = false; 8450 var wholeFile = false;
8457 8451
8458 foreach (XAttribute attrib in node.Attributes()) 8452 foreach (var attrib in node.Attributes())
8459 { 8453 {
8460 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 8454 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
8461 { 8455 {
8462 switch (attrib.Name.LocalName) 8456 switch (attrib.Name.LocalName)
8463 { 8457 {
8464 case "AllowIgnoreOnError": 8458 case "AllowIgnoreOnError":
8465 allowIgnoreOnError = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 8459 allowIgnoreOnError = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
8466 break; 8460 break;
8467 case "File": 8461 case "File":
8468 file = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8462 file = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8469 break; 8463 break;
8470 case "Ignore": 8464 case "Ignore":
8471 ignore = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 8465 ignore = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
8472 break; 8466 break;
8473 case "WholeFile": 8467 case "WholeFile":
8474 wholeFile = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 8468 wholeFile = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
8475 break; 8469 break;
8476 default: 8470 default:
8477 this.Core.UnexpectedAttribute(node, attrib); 8471 this.Core.UnexpectedAttribute(node, attrib);
8478 break; 8472 break;
8479 } 8473 }
8480 } 8474 }
8481 else 8475 else
@@ -8489,18 +8483,18 @@ namespace WixToolset.Core
8489 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File")); 8483 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File"));
8490 } 8484 }
8491 8485
8492 foreach (XElement child in node.Elements()) 8486 foreach (var child in node.Elements())
8493 { 8487 {
8494 if (CompilerCore.WixNamespace == child.Name.Namespace) 8488 if (CompilerCore.WixNamespace == child.Name.Namespace)
8495 { 8489 {
8496 switch (child.Name.LocalName) 8490 switch (child.Name.LocalName)
8497 { 8491 {
8498 case "SymbolPath": 8492 case "SymbolPath":
8499 symbols.Add(this.ParseSymbolPathElement(child)); 8493 symbols.Add(this.ParseSymbolPathElement(child));
8500 break; 8494 break;
8501 default: 8495 default:
8502 this.Core.UnexpectedElement(node, child); 8496 this.Core.UnexpectedElement(node, child);
8503 break; 8497 break;
8504 } 8498 }
8505 } 8499 }
8506 else 8500 else
@@ -8537,52 +8531,52 @@ namespace WixToolset.Core
8537 /// <param name="family">The family key for this element.</param> 8531 /// <param name="family">The family key for this element.</param>
8538 private void ParseTargetImageElement(XElement node, string upgrade, string family) 8532 private void ParseTargetImageElement(XElement node, string upgrade, string family)
8539 { 8533 {
8540 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 8534 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
8541 bool ignore = false; 8535 var ignore = false;
8542 int order = CompilerConstants.IntegerNotSet; 8536 var order = CompilerConstants.IntegerNotSet;
8543 string sourceFile = null; 8537 string sourceFile = null;
8544 string symbols = null; 8538 string symbols = null;
8545 string target = null; 8539 string target = null;
8546 string validation = null; 8540 string validation = null;
8547 8541
8548 foreach (XAttribute attrib in node.Attributes()) 8542 foreach (var attrib in node.Attributes())
8549 { 8543 {
8550 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 8544 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
8551 { 8545 {
8552 switch (attrib.Name.LocalName) 8546 switch (attrib.Name.LocalName)
8553 { 8547 {
8554 case "Id": 8548 case "Id":
8555 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8549 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8556 if (target.Length > 13) 8550 if (target.Length > 13)
8557 { 8551 {
8558 this.Core.Write(ErrorMessages.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", target, 13)); 8552 this.Core.Write(ErrorMessages.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", target, 13));
8559 } 8553 }
8560 break; 8554 break;
8561 case "IgnoreMissingFiles": 8555 case "IgnoreMissingFiles":
8562 ignore = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 8556 ignore = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
8563 break; 8557 break;
8564 case "Order": 8558 case "Order":
8565 order = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, int.MinValue + 2, int.MaxValue); 8559 order = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int32.MinValue + 2, Int32.MaxValue);
8566 break; 8560 break;
8567 case "SourceFile": 8561 case "SourceFile":
8568 case "src": 8562 case "src":
8569 if (null != sourceFile) 8563 if (null != sourceFile)
8570 { 8564 {
8571 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "SourceFile")); 8565 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "SourceFile"));
8572 } 8566 }
8573 8567
8574 if ("src" == attrib.Name.LocalName) 8568 if ("src" == attrib.Name.LocalName)
8575 { 8569 {
8576 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile")); 8570 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "SourceFile"));
8577 } 8571 }
8578 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8572 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8579 break; 8573 break;
8580 case "Validation": 8574 case "Validation":
8581 validation = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8575 validation = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8582 break; 8576 break;
8583 default: 8577 default:
8584 this.Core.UnexpectedAttribute(node, attrib); 8578 this.Core.UnexpectedAttribute(node, attrib);
8585 break; 8579 break;
8586 } 8580 }
8587 } 8581 }
8588 else 8582 else
@@ -8606,28 +8600,28 @@ namespace WixToolset.Core
8606 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Order")); 8600 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Order"));
8607 } 8601 }
8608 8602
8609 foreach (XElement child in node.Elements()) 8603 foreach (var child in node.Elements())
8610 { 8604 {
8611 if (CompilerCore.WixNamespace == child.Name.Namespace) 8605 if (CompilerCore.WixNamespace == child.Name.Namespace)
8612 { 8606 {
8613 switch (child.Name.LocalName) 8607 switch (child.Name.LocalName)
8614 { 8608 {
8615 case "SymbolPath": 8609 case "SymbolPath":
8616 if (null != symbols) 8610 if (null != symbols)
8617 { 8611 {
8618 symbols = String.Concat(symbols, ";", this.ParseSymbolPathElement(child)); 8612 symbols = String.Concat(symbols, ";", this.ParseSymbolPathElement(child));
8619 } 8613 }
8620 else 8614 else
8621 { 8615 {
8622 symbols = this.ParseSymbolPathElement(child); 8616 symbols = this.ParseSymbolPathElement(child);
8623 } 8617 }
8624 break; 8618 break;
8625 case "TargetFile": 8619 case "TargetFile":
8626 this.ParseTargetFileElement(child, target, family); 8620 this.ParseTargetFileElement(child, target, family);
8627 break; 8621 break;
8628 default: 8622 default:
8629 this.Core.UnexpectedElement(node, child); 8623 this.Core.UnexpectedElement(node, child);
8630 break; 8624 break;
8631 } 8625 }
8632 } 8626 }
8633 else 8627 else
@@ -8657,7 +8651,7 @@ namespace WixToolset.Core
8657 /// <param name="family">The family key for this element.</param> 8651 /// <param name="family">The family key for this element.</param>
8658 private void ParseTargetFileElement(XElement node, string target, string family) 8652 private void ParseTargetFileElement(XElement node, string target, string family)
8659 { 8653 {
8660 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 8654 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
8661 string file = null; 8655 string file = null;
8662 string ignoreLengths = null; 8656 string ignoreLengths = null;
8663 string ignoreOffsets = null; 8657 string ignoreOffsets = null;
@@ -8665,18 +8659,18 @@ namespace WixToolset.Core
8665 string protectOffsets = null; 8659 string protectOffsets = null;
8666 string symbols = null; 8660 string symbols = null;
8667 8661
8668 foreach (XAttribute attrib in node.Attributes()) 8662 foreach (var attrib in node.Attributes())
8669 { 8663 {
8670 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 8664 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
8671 { 8665 {
8672 switch (attrib.Name.LocalName) 8666 switch (attrib.Name.LocalName)
8673 { 8667 {
8674 case "Id": 8668 case "Id":
8675 file = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8669 file = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8676 break; 8670 break;
8677 default: 8671 default:
8678 this.Core.UnexpectedAttribute(node, attrib); 8672 this.Core.UnexpectedAttribute(node, attrib);
8679 break; 8673 break;
8680 } 8674 }
8681 } 8675 }
8682 else 8676 else
@@ -8690,24 +8684,24 @@ namespace WixToolset.Core
8690 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); 8684 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
8691 } 8685 }
8692 8686
8693 foreach (XElement child in node.Elements()) 8687 foreach (var child in node.Elements())
8694 { 8688 {
8695 if (CompilerCore.WixNamespace == child.Name.Namespace) 8689 if (CompilerCore.WixNamespace == child.Name.Namespace)
8696 { 8690 {
8697 switch (child.Name.LocalName) 8691 switch (child.Name.LocalName)
8698 { 8692 {
8699 case "IgnoreRange": 8693 case "IgnoreRange":
8700 this.ParseRangeElement(child, ref ignoreOffsets, ref ignoreLengths); 8694 this.ParseRangeElement(child, ref ignoreOffsets, ref ignoreLengths);
8701 break; 8695 break;
8702 case "ProtectRange": 8696 case "ProtectRange":
8703 this.ParseRangeElement(child, ref protectOffsets, ref protectLengths); 8697 this.ParseRangeElement(child, ref protectOffsets, ref protectLengths);
8704 break; 8698 break;
8705 case "SymbolPath": 8699 case "SymbolPath":
8706 symbols = this.ParseSymbolPathElement(child); 8700 symbols = this.ParseSymbolPathElement(child);
8707 break; 8701 break;
8708 default: 8702 default:
8709 this.Core.UnexpectedElement(node, child); 8703 this.Core.UnexpectedElement(node, child);
8710 break; 8704 break;
8711 } 8705 }
8712 } 8706 }
8713 else 8707 else
@@ -8745,44 +8739,44 @@ namespace WixToolset.Core
8745 /// <param name="family">The family for this element.</param> 8739 /// <param name="family">The family for this element.</param>
8746 private void ParseExternalFileElement(XElement node, string family) 8740 private void ParseExternalFileElement(XElement node, string family)
8747 { 8741 {
8748 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 8742 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
8749 string file = null; 8743 string file = null;
8750 string ignoreLengths = null; 8744 string ignoreLengths = null;
8751 string ignoreOffsets = null; 8745 string ignoreOffsets = null;
8752 int order = CompilerConstants.IntegerNotSet; 8746 var order = CompilerConstants.IntegerNotSet;
8753 string protectLengths = null; 8747 string protectLengths = null;
8754 string protectOffsets = null; 8748 string protectOffsets = null;
8755 string source = null; 8749 string source = null;
8756 string symbols = null; 8750 string symbols = null;
8757 8751
8758 foreach (XAttribute attrib in node.Attributes()) 8752 foreach (var attrib in node.Attributes())
8759 { 8753 {
8760 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 8754 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
8761 { 8755 {
8762 switch (attrib.Name.LocalName) 8756 switch (attrib.Name.LocalName)
8763 { 8757 {
8764 case "File": 8758 case "File":
8765 file = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8759 file = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8766 break; 8760 break;
8767 case "Order": 8761 case "Order":
8768 order = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, int.MinValue + 2, int.MaxValue); 8762 order = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int32.MinValue + 2, Int32.MaxValue);
8769 break; 8763 break;
8770 case "Source": 8764 case "Source":
8771 case "src": 8765 case "src":
8772 if (null != source) 8766 if (null != source)
8773 { 8767 {
8774 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "Source")); 8768 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "src", "Source"));
8775 } 8769 }
8776 8770
8777 if ("src" == attrib.Name.LocalName) 8771 if ("src" == attrib.Name.LocalName)
8778 { 8772 {
8779 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Source")); 8773 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Source"));
8780 } 8774 }
8781 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8775 source = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8782 break; 8776 break;
8783 default: 8777 default:
8784 this.Core.UnexpectedAttribute(node, attrib); 8778 this.Core.UnexpectedAttribute(node, attrib);
8785 break; 8779 break;
8786 } 8780 }
8787 } 8781 }
8788 else 8782 else
@@ -8806,24 +8800,24 @@ namespace WixToolset.Core
8806 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Order")); 8800 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Order"));
8807 } 8801 }
8808 8802
8809 foreach (XElement child in node.Elements()) 8803 foreach (var child in node.Elements())
8810 { 8804 {
8811 if (CompilerCore.WixNamespace == child.Name.Namespace) 8805 if (CompilerCore.WixNamespace == child.Name.Namespace)
8812 { 8806 {
8813 switch (child.Name.LocalName) 8807 switch (child.Name.LocalName)
8814 { 8808 {
8815 case "IgnoreRange": 8809 case "IgnoreRange":
8816 this.ParseRangeElement(child, ref ignoreOffsets, ref ignoreLengths); 8810 this.ParseRangeElement(child, ref ignoreOffsets, ref ignoreLengths);
8817 break; 8811 break;
8818 case "ProtectRange": 8812 case "ProtectRange":
8819 this.ParseRangeElement(child, ref protectOffsets, ref protectLengths); 8813 this.ParseRangeElement(child, ref protectOffsets, ref protectLengths);
8820 break; 8814 break;
8821 case "SymbolPath": 8815 case "SymbolPath":
8822 symbols = this.ParseSymbolPathElement(child); 8816 symbols = this.ParseSymbolPathElement(child);
8823 break; 8817 break;
8824 default: 8818 default:
8825 this.Core.UnexpectedElement(node, child); 8819 this.Core.UnexpectedElement(node, child);
8826 break; 8820 break;
8827 } 8821 }
8828 } 8822 }
8829 else 8823 else
@@ -8869,23 +8863,23 @@ namespace WixToolset.Core
8869 /// <param name="family">The family for this element.</param> 8863 /// <param name="family">The family for this element.</param>
8870 private void ParseProtectFileElement(XElement node, string family) 8864 private void ParseProtectFileElement(XElement node, string family)
8871 { 8865 {
8872 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 8866 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
8873 string file = null; 8867 string file = null;
8874 string protectLengths = null; 8868 string protectLengths = null;
8875 string protectOffsets = null; 8869 string protectOffsets = null;
8876 8870
8877 foreach (XAttribute attrib in node.Attributes()) 8871 foreach (var attrib in node.Attributes())
8878 { 8872 {
8879 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 8873 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
8880 { 8874 {
8881 switch (attrib.Name.LocalName) 8875 switch (attrib.Name.LocalName)
8882 { 8876 {
8883 case "File": 8877 case "File":
8884 file = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8878 file = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8885 break; 8879 break;
8886 default: 8880 default:
8887 this.Core.UnexpectedAttribute(node, attrib); 8881 this.Core.UnexpectedAttribute(node, attrib);
8888 break; 8882 break;
8889 } 8883 }
8890 } 8884 }
8891 else 8885 else
@@ -8899,18 +8893,18 @@ namespace WixToolset.Core
8899 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File")); 8893 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "File"));
8900 } 8894 }
8901 8895
8902 foreach (XElement child in node.Elements()) 8896 foreach (var child in node.Elements())
8903 { 8897 {
8904 if (CompilerCore.WixNamespace == child.Name.Namespace) 8898 if (CompilerCore.WixNamespace == child.Name.Namespace)
8905 { 8899 {
8906 switch (child.Name.LocalName) 8900 switch (child.Name.LocalName)
8907 { 8901 {
8908 case "ProtectRange": 8902 case "ProtectRange":
8909 this.ParseRangeElement(child, ref protectOffsets, ref protectLengths); 8903 this.ParseRangeElement(child, ref protectOffsets, ref protectLengths);
8910 break; 8904 break;
8911 default: 8905 default:
8912 this.Core.UnexpectedElement(node, child); 8906 this.Core.UnexpectedElement(node, child);
8913 break; 8907 break;
8914 } 8908 }
8915 } 8909 }
8916 else 8910 else
@@ -8942,25 +8936,25 @@ namespace WixToolset.Core
8942 /// <param name="lengths">Reference to the lengths string.</param> 8936 /// <param name="lengths">Reference to the lengths string.</param>
8943 private void ParseRangeElement(XElement node, ref string offsets, ref string lengths) 8937 private void ParseRangeElement(XElement node, ref string offsets, ref string lengths)
8944 { 8938 {
8945 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 8939 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
8946 string length = null; 8940 string length = null;
8947 string offset = null; 8941 string offset = null;
8948 8942
8949 foreach (XAttribute attrib in node.Attributes()) 8943 foreach (var attrib in node.Attributes())
8950 { 8944 {
8951 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 8945 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
8952 { 8946 {
8953 switch (attrib.Name.LocalName) 8947 switch (attrib.Name.LocalName)
8954 { 8948 {
8955 case "Length": 8949 case "Length":
8956 length = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8950 length = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8957 break; 8951 break;
8958 case "Offset": 8952 case "Offset":
8959 offset = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 8953 offset = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
8960 break; 8954 break;
8961 default: 8955 default:
8962 this.Core.UnexpectedAttribute(node, attrib); 8956 this.Core.UnexpectedAttribute(node, attrib);
8963 break; 8957 break;
8964 } 8958 }
8965 } 8959 }
8966 else 8960 else
@@ -9007,30 +9001,30 @@ namespace WixToolset.Core
9007 /// <param name="patch">True if parsing an patch element.</param> 9001 /// <param name="patch">True if parsing an patch element.</param>
9008 private void ParsePatchPropertyElement(XElement node, bool patch) 9002 private void ParsePatchPropertyElement(XElement node, bool patch)
9009 { 9003 {
9010 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9004 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9011 string name = null; 9005 string name = null;
9012 string company = null; 9006 string company = null;
9013 string value = null; 9007 string value = null;
9014 9008
9015 foreach (XAttribute attrib in node.Attributes()) 9009 foreach (var attrib in node.Attributes())
9016 { 9010 {
9017 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9011 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9018 { 9012 {
9019 switch (attrib.Name.LocalName) 9013 switch (attrib.Name.LocalName)
9020 { 9014 {
9021 case "Id": 9015 case "Id":
9022 case "Name": 9016 case "Name":
9023 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9017 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9024 break; 9018 break;
9025 case "Company": 9019 case "Company":
9026 company = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9020 company = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9027 break; 9021 break;
9028 case "Value": 9022 case "Value":
9029 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9023 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9030 break; 9024 break;
9031 default: 9025 default:
9032 this.Core.UnexpectedAttribute(node, attrib); 9026 this.Core.UnexpectedAttribute(node, attrib);
9033 break; 9027 break;
9034 } 9028 }
9035 } 9029 }
9036 else 9030 else
@@ -9075,56 +9069,56 @@ namespace WixToolset.Core
9075 /// <param name="node">The element to parse.</param> 9069 /// <param name="node">The element to parse.</param>
9076 private void ParsePatchSequenceElement(XElement node) 9070 private void ParsePatchSequenceElement(XElement node)
9077 { 9071 {
9078 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9072 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9079 string family = null; 9073 string family = null;
9080 string target = null; 9074 string target = null;
9081 string sequence = null; 9075 string sequence = null;
9082 int attributes = 0; 9076 var attributes = 0;
9083 9077
9084 foreach (XAttribute attrib in node.Attributes()) 9078 foreach (var attrib in node.Attributes())
9085 { 9079 {
9086 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9080 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9087 { 9081 {
9088 switch (attrib.Name.LocalName) 9082 switch (attrib.Name.LocalName)
9089 { 9083 {
9090 case "PatchFamily": 9084 case "PatchFamily":
9091 family = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 9085 family = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
9092 break; 9086 break;
9093 case "ProductCode": 9087 case "ProductCode":
9094 if (null != target) 9088 if (null != target)
9095 { 9089 {
9096 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "TargetImage")); 9090 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "TargetImage"));
9097 } 9091 }
9098 target = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 9092 target = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
9099 break; 9093 break;
9100 case "Target": 9094 case "Target":
9101 if (null != target) 9095 if (null != target)
9102 { 9096 {
9103 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "TargetImage", "ProductCode")); 9097 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "TargetImage", "ProductCode"));
9104 } 9098 }
9105 this.Core.Write(WarningMessages.DeprecatedPatchSequenceTargetAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 9099 this.Core.Write(WarningMessages.DeprecatedPatchSequenceTargetAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
9106 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9100 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9107 break; 9101 break;
9108 case "TargetImage": 9102 case "TargetImage":
9109 if (null != target) 9103 if (null != target)
9110 { 9104 {
9111 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "ProductCode")); 9105 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Target", "ProductCode"));
9112 } 9106 }
9113 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9107 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9114 this.Core.CreateSimpleReference(sourceLineNumbers, "TargetImages", target); 9108 this.Core.CreateSimpleReference(sourceLineNumbers, "TargetImages", target);
9115 break; 9109 break;
9116 case "Sequence": 9110 case "Sequence":
9117 sequence = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); 9111 sequence = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
9118 break; 9112 break;
9119 case "Supersede": 9113 case "Supersede":
9120 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9114 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
9121 { 9115 {
9122 attributes |= 0x1; 9116 attributes |= 0x1;
9123 } 9117 }
9124 break; 9118 break;
9125 default: 9119 default:
9126 this.Core.UnexpectedAttribute(node, attrib); 9120 this.Core.UnexpectedAttribute(node, attrib);
9127 break; 9121 break;
9128 } 9122 }
9129 } 9123 }
9130 else 9124 else
@@ -9160,25 +9154,25 @@ namespace WixToolset.Core
9160 /// <returns>The id from the node.</returns> 9154 /// <returns>The id from the node.</returns>
9161 private string ParseTargetProductCodeElement(XElement node) 9155 private string ParseTargetProductCodeElement(XElement node)
9162 { 9156 {
9163 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9157 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9164 string id = null; 9158 string id = null;
9165 9159
9166 foreach (XAttribute attrib in node.Attributes()) 9160 foreach (var attrib in node.Attributes())
9167 { 9161 {
9168 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9162 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9169 { 9163 {
9170 switch (attrib.Name.LocalName) 9164 switch (attrib.Name.LocalName)
9171 { 9165 {
9172 case "Id": 9166 case "Id":
9173 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9167 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9174 if (id.Length > 0 && "*" != id) 9168 if (id.Length > 0 && "*" != id)
9175 { 9169 {
9176 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 9170 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
9177 } 9171 }
9178 break; 9172 break;
9179 default: 9173 default:
9180 this.Core.UnexpectedAttribute(node, attrib); 9174 this.Core.UnexpectedAttribute(node, attrib);
9181 break; 9175 break;
9182 } 9176 }
9183 } 9177 }
9184 else 9178 else
@@ -9203,22 +9197,22 @@ namespace WixToolset.Core
9203 /// <param name="node">The element to parse.</param> 9197 /// <param name="node">The element to parse.</param>
9204 private void ParseTargetProductCodesElement(XElement node) 9198 private void ParseTargetProductCodesElement(XElement node)
9205 { 9199 {
9206 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9200 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9207 bool replace = false; 9201 var replace = false;
9208 List<string> targetProductCodes = new List<string>(); 9202 var targetProductCodes = new List<string>();
9209 9203
9210 foreach (XAttribute attrib in node.Attributes()) 9204 foreach (var attrib in node.Attributes())
9211 { 9205 {
9212 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9206 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9213 { 9207 {
9214 switch (attrib.Name.LocalName) 9208 switch (attrib.Name.LocalName)
9215 { 9209 {
9216 case "Replace": 9210 case "Replace":
9217 replace = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 9211 replace = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
9218 break; 9212 break;
9219 default: 9213 default:
9220 this.Core.UnexpectedAttribute(node, attrib); 9214 this.Core.UnexpectedAttribute(node, attrib);
9221 break; 9215 break;
9222 } 9216 }
9223 } 9217 }
9224 else 9218 else
@@ -9227,26 +9221,26 @@ namespace WixToolset.Core
9227 } 9221 }
9228 } 9222 }
9229 9223
9230 foreach (XElement child in node.Elements()) 9224 foreach (var child in node.Elements())
9231 { 9225 {
9232 if (CompilerCore.WixNamespace == child.Name.Namespace) 9226 if (CompilerCore.WixNamespace == child.Name.Namespace)
9233 { 9227 {
9234 switch (child.Name.LocalName) 9228 switch (child.Name.LocalName)
9235 { 9229 {
9236 case "TargetProductCode": 9230 case "TargetProductCode":
9237 string id = this.ParseTargetProductCodeElement(child); 9231 var id = this.ParseTargetProductCodeElement(child);
9238 if (0 == String.CompareOrdinal("*", id)) 9232 if (0 == String.CompareOrdinal("*", id))
9239 { 9233 {
9240 this.Core.Write(ErrorMessages.IllegalAttributeValueWhenNested(sourceLineNumbers, child.Name.LocalName, "Id", id, node.Name.LocalName)); 9234 this.Core.Write(ErrorMessages.IllegalAttributeValueWhenNested(sourceLineNumbers, child.Name.LocalName, "Id", id, node.Name.LocalName));
9241 } 9235 }
9242 else 9236 else
9243 { 9237 {
9244 targetProductCodes.Add(id); 9238 targetProductCodes.Add(id);
9245 } 9239 }
9246 break; 9240 break;
9247 default: 9241 default:
9248 this.Core.UnexpectedElement(node, child); 9242 this.Core.UnexpectedElement(node, child);
9249 break; 9243 break;
9250 } 9244 }
9251 } 9245 }
9252 else 9246 else
@@ -9264,7 +9258,7 @@ namespace WixToolset.Core
9264 row.Set(0, "*"); 9258 row.Set(0, "*");
9265 } 9259 }
9266 9260
9267 foreach (string targetProductCode in targetProductCodes) 9261 foreach (var targetProductCode in targetProductCodes)
9268 { 9262 {
9269 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixPatchTarget); 9263 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixPatchTarget);
9270 row.Set(0, targetProductCode); 9264 row.Set(0, targetProductCode);
@@ -9279,21 +9273,21 @@ namespace WixToolset.Core
9279 /// <returns>The id from the node.</returns> 9273 /// <returns>The id from the node.</returns>
9280 private string ParseReplacePatchElement(XElement node) 9274 private string ParseReplacePatchElement(XElement node)
9281 { 9275 {
9282 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9276 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9283 string id = null; 9277 string id = null;
9284 9278
9285 foreach (XAttribute attrib in node.Attributes()) 9279 foreach (var attrib in node.Attributes())
9286 { 9280 {
9287 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9281 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9288 { 9282 {
9289 switch (attrib.Name.LocalName) 9283 switch (attrib.Name.LocalName)
9290 { 9284 {
9291 case "Id": 9285 case "Id":
9292 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 9286 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
9293 break; 9287 break;
9294 default: 9288 default:
9295 this.Core.UnexpectedAttribute(node, attrib); 9289 this.Core.UnexpectedAttribute(node, attrib);
9296 break; 9290 break;
9297 } 9291 }
9298 } 9292 }
9299 else 9293 else
@@ -9319,21 +9313,21 @@ namespace WixToolset.Core
9319 /// <returns>The path from the node.</returns> 9313 /// <returns>The path from the node.</returns>
9320 private string ParseSymbolPathElement(XElement node) 9314 private string ParseSymbolPathElement(XElement node)
9321 { 9315 {
9322 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9316 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9323 string path = null; 9317 string path = null;
9324 9318
9325 foreach (XAttribute attrib in node.Attributes()) 9319 foreach (var attrib in node.Attributes())
9326 { 9320 {
9327 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9321 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9328 { 9322 {
9329 switch (attrib.Name.LocalName) 9323 switch (attrib.Name.LocalName)
9330 { 9324 {
9331 case "Path": 9325 case "Path":
9332 path = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9326 path = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9333 break; 9327 break;
9334 default: 9328 default:
9335 this.Core.UnexpectedAttribute(node, attrib); 9329 this.Core.UnexpectedAttribute(node, attrib);
9336 break; 9330 break;
9337 } 9331 }
9338 } 9332 }
9339 else 9333 else
@@ -9358,93 +9352,93 @@ namespace WixToolset.Core
9358 /// <param name="node">The element to parse.</param> 9352 /// <param name="node">The element to parse.</param>
9359 private void ParsePatchElement(XElement node) 9353 private void ParsePatchElement(XElement node)
9360 { 9354 {
9361 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9355 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9362 string patchId = null; 9356 string patchId = null;
9363 int codepage = 0; 9357 var codepage = 0;
9364 ////bool versionMismatches = false; 9358 ////bool versionMismatches = false;
9365 ////bool productMismatches = false; 9359 ////bool productMismatches = false;
9366 bool allowRemoval = false; 9360 var allowRemoval = false;
9367 string classification = null; 9361 string classification = null;
9368 string clientPatchId = null; 9362 string clientPatchId = null;
9369 string description = null; 9363 string description = null;
9370 string displayName = null; 9364 string displayName = null;
9371 string comments = null; 9365 string comments = null;
9372 string manufacturer = null; 9366 string manufacturer = null;
9373 YesNoType minorUpdateTargetRTM = YesNoType.NotSet; 9367 var minorUpdateTargetRTM = YesNoType.NotSet;
9374 string moreInfoUrl = null; 9368 string moreInfoUrl = null;
9375 int optimizeCA = CompilerConstants.IntegerNotSet; 9369 var optimizeCA = CompilerConstants.IntegerNotSet;
9376 YesNoType optimizedInstallMode = YesNoType.NotSet; 9370 var optimizedInstallMode = YesNoType.NotSet;
9377 string targetProductName = null; 9371 string targetProductName = null;
9378 // string replaceGuids = String.Empty; 9372 // string replaceGuids = String.Empty;
9379 int apiPatchingSymbolFlags = 0; 9373 var apiPatchingSymbolFlags = 0;
9380 bool optimizePatchSizeForLargeFiles = false; 9374 var optimizePatchSizeForLargeFiles = false;
9381 9375
9382 foreach (XAttribute attrib in node.Attributes()) 9376 foreach (var attrib in node.Attributes())
9383 { 9377 {
9384 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9378 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9385 { 9379 {
9386 switch (attrib.Name.LocalName) 9380 switch (attrib.Name.LocalName)
9387 { 9381 {
9388 case "Id": 9382 case "Id":
9389 patchId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); 9383 patchId = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true);
9390 break; 9384 break;
9391 case "Codepage": 9385 case "Codepage":
9392 codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); 9386 codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib);
9393 break; 9387 break;
9394 case "AllowMajorVersionMismatches": 9388 case "AllowMajorVersionMismatches":
9395 ////versionMismatches = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); 9389 ////versionMismatches = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib));
9396 break; 9390 break;
9397 case "AllowProductCodeMismatches": 9391 case "AllowProductCodeMismatches":
9398 ////productMismatches = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); 9392 ////productMismatches = (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib));
9399 break; 9393 break;
9400 case "AllowRemoval": 9394 case "AllowRemoval":
9401 allowRemoval = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); 9395 allowRemoval = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib));
9402 break; 9396 break;
9403 case "Classification": 9397 case "Classification":
9404 classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9398 classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9405 break; 9399 break;
9406 case "ClientPatchId": 9400 case "ClientPatchId":
9407 clientPatchId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9401 clientPatchId = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9408 break; 9402 break;
9409 case "Description": 9403 case "Description":
9410 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9404 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9411 break; 9405 break;
9412 case "DisplayName": 9406 case "DisplayName":
9413 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9407 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9414 break; 9408 break;
9415 case "Comments": 9409 case "Comments":
9416 comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9410 comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9417 break; 9411 break;
9418 case "Manufacturer": 9412 case "Manufacturer":
9419 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9413 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9420 break; 9414 break;
9421 case "MinorUpdateTargetRTM": 9415 case "MinorUpdateTargetRTM":
9422 minorUpdateTargetRTM = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 9416 minorUpdateTargetRTM = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
9423 break; 9417 break;
9424 case "MoreInfoURL": 9418 case "MoreInfoURL":
9425 moreInfoUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9419 moreInfoUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9426 break; 9420 break;
9427 case "OptimizedInstallMode": 9421 case "OptimizedInstallMode":
9428 optimizedInstallMode = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 9422 optimizedInstallMode = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
9429 break; 9423 break;
9430 case "TargetProductName": 9424 case "TargetProductName":
9431 targetProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9425 targetProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9432 break; 9426 break;
9433 case "ApiPatchingSymbolNoImagehlpFlag": 9427 case "ApiPatchingSymbolNoImagehlpFlag":
9434 apiPatchingSymbolFlags |= (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_NO_IMAGEHLP : 0; 9428 apiPatchingSymbolFlags |= (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_NO_IMAGEHLP : 0;
9435 break; 9429 break;
9436 case "ApiPatchingSymbolNoFailuresFlag": 9430 case "ApiPatchingSymbolNoFailuresFlag":
9437 apiPatchingSymbolFlags |= (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_NO_FAILURES : 0; 9431 apiPatchingSymbolFlags |= (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_NO_FAILURES : 0;
9438 break; 9432 break;
9439 case "ApiPatchingSymbolUndecoratedTooFlag": 9433 case "ApiPatchingSymbolUndecoratedTooFlag":
9440 apiPatchingSymbolFlags |= (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_UNDECORATED_TOO : 0; 9434 apiPatchingSymbolFlags |= (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) ? (int)PatchSymbolFlagsType.PATCH_SYMBOL_UNDECORATED_TOO : 0;
9441 break; 9435 break;
9442 case "OptimizePatchSizeForLargeFiles": 9436 case "OptimizePatchSizeForLargeFiles":
9443 optimizePatchSizeForLargeFiles = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); 9437 optimizePatchSizeForLargeFiles = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib));
9444 break; 9438 break;
9445 default: 9439 default:
9446 this.Core.UnexpectedAttribute(node, attrib); 9440 this.Core.UnexpectedAttribute(node, attrib);
9447 break; 9441 break;
9448 } 9442 }
9449 } 9443 }
9450 else 9444 else
@@ -9487,42 +9481,42 @@ namespace WixToolset.Core
9487 9481
9488 this.Core.CreateActiveSection(this.activeName, SectionType.Patch, codepage, this.Context.CompilationId); 9482 this.Core.CreateActiveSection(this.activeName, SectionType.Patch, codepage, this.Context.CompilationId);
9489 9483
9490 foreach (XElement child in node.Elements()) 9484 foreach (var child in node.Elements())
9491 { 9485 {
9492 if (CompilerCore.WixNamespace == child.Name.Namespace) 9486 if (CompilerCore.WixNamespace == child.Name.Namespace)
9493 { 9487 {
9494 switch (child.Name.LocalName) 9488 switch (child.Name.LocalName)
9495 { 9489 {
9496 case "PatchInformation": 9490 case "PatchInformation":
9497 this.ParsePatchInformationElement(child); 9491 this.ParsePatchInformationElement(child);
9498 break; 9492 break;
9499 case "Media": 9493 case "Media":
9500 this.ParseMediaElement(child, patchId); 9494 this.ParseMediaElement(child, patchId);
9501 break; 9495 break;
9502 case "OptimizeCustomActions": 9496 case "OptimizeCustomActions":
9503 optimizeCA = this.ParseOptimizeCustomActionsElement(child); 9497 optimizeCA = this.ParseOptimizeCustomActionsElement(child);
9504 break; 9498 break;
9505 case "PatchFamily": 9499 case "PatchFamily":
9506 this.ParsePatchFamilyElement(child, ComplexReferenceParentType.Patch, patchId); 9500 this.ParsePatchFamilyElement(child, ComplexReferenceParentType.Patch, patchId);
9507 break; 9501 break;
9508 case "PatchFamilyRef": 9502 case "PatchFamilyRef":
9509 this.ParsePatchFamilyRefElement(child, ComplexReferenceParentType.Patch, patchId); 9503 this.ParsePatchFamilyRefElement(child, ComplexReferenceParentType.Patch, patchId);
9510 break; 9504 break;
9511 case "PatchFamilyGroup": 9505 case "PatchFamilyGroup":
9512 this.ParsePatchFamilyGroupElement(child, ComplexReferenceParentType.Patch, patchId); 9506 this.ParsePatchFamilyGroupElement(child, ComplexReferenceParentType.Patch, patchId);
9513 break; 9507 break;
9514 case "PatchFamilyGroupRef": 9508 case "PatchFamilyGroupRef":
9515 this.ParsePatchFamilyGroupRefElement(child, ComplexReferenceParentType.Patch, patchId); 9509 this.ParsePatchFamilyGroupRefElement(child, ComplexReferenceParentType.Patch, patchId);
9516 break; 9510 break;
9517 case "PatchProperty": 9511 case "PatchProperty":
9518 this.ParsePatchPropertyElement(child, true); 9512 this.ParsePatchPropertyElement(child, true);
9519 break; 9513 break;
9520 case "TargetProductCodes": 9514 case "TargetProductCodes":
9521 this.ParseTargetProductCodesElement(child); 9515 this.ParseTargetProductCodesElement(child);
9522 break; 9516 break;
9523 default: 9517 default:
9524 this.Core.UnexpectedElement(node, child); 9518 this.Core.UnexpectedElement(node, child);
9525 break; 9519 break;
9526 } 9520 }
9527 } 9521 }
9528 else 9522 else
@@ -9632,36 +9626,36 @@ namespace WixToolset.Core
9632 /// <param name="node">The element to parse.</param> 9626 /// <param name="node">The element to parse.</param>
9633 private void ParsePatchFamilyElement(XElement node, ComplexReferenceParentType parentType, string parentId) 9627 private void ParsePatchFamilyElement(XElement node, ComplexReferenceParentType parentType, string parentId)
9634 { 9628 {
9635 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9629 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9636 Identifier id = null; 9630 Identifier id = null;
9637 string productCode = null; 9631 string productCode = null;
9638 string version = null; 9632 string version = null;
9639 int attributes = 0; 9633 var attributes = 0;
9640 9634
9641 foreach (XAttribute attrib in node.Attributes()) 9635 foreach (var attrib in node.Attributes())
9642 { 9636 {
9643 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9637 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9644 { 9638 {
9645 switch (attrib.Name.LocalName) 9639 switch (attrib.Name.LocalName)
9646 { 9640 {
9647 case "Id": 9641 case "Id":
9648 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 9642 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
9649 break; 9643 break;
9650 case "ProductCode": 9644 case "ProductCode":
9651 productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 9645 productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
9652 break; 9646 break;
9653 case "Version": 9647 case "Version":
9654 version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); 9648 version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
9655 break; 9649 break;
9656 case "Supersede": 9650 case "Supersede":
9657 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9651 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
9658 { 9652 {
9659 attributes |= 0x1; 9653 attributes |= 0x1;
9660 } 9654 }
9661 break; 9655 break;
9662 default: 9656 default:
9663 this.Core.UnexpectedAttribute(node, attrib); 9657 this.Core.UnexpectedAttribute(node, attrib);
9664 break; 9658 break;
9665 } 9659 }
9666 } 9660 }
9667 else 9661 else
@@ -9686,45 +9680,45 @@ namespace WixToolset.Core
9686 } 9680 }
9687 9681
9688 // find unexpected child elements 9682 // find unexpected child elements
9689 foreach (XElement child in node.Elements()) 9683 foreach (var child in node.Elements())
9690 { 9684 {
9691 if (CompilerCore.WixNamespace == child.Name.Namespace) 9685 if (CompilerCore.WixNamespace == child.Name.Namespace)
9692 { 9686 {
9693 switch (child.Name.LocalName) 9687 switch (child.Name.LocalName)
9694 { 9688 {
9695 case "All": 9689 case "All":
9696 this.ParseAllElement(child); 9690 this.ParseAllElement(child);
9697 break; 9691 break;
9698 case "BinaryRef": 9692 case "BinaryRef":
9699 this.ParsePatchChildRefElement(child, "Binary"); 9693 this.ParsePatchChildRefElement(child, "Binary");
9700 break; 9694 break;
9701 case "ComponentRef": 9695 case "ComponentRef":
9702 this.ParsePatchChildRefElement(child, "Component"); 9696 this.ParsePatchChildRefElement(child, "Component");
9703 break; 9697 break;
9704 case "CustomActionRef": 9698 case "CustomActionRef":
9705 this.ParsePatchChildRefElement(child, "CustomAction"); 9699 this.ParsePatchChildRefElement(child, "CustomAction");
9706 break; 9700 break;
9707 case "DirectoryRef": 9701 case "DirectoryRef":
9708 this.ParsePatchChildRefElement(child, "Directory"); 9702 this.ParsePatchChildRefElement(child, "Directory");
9709 break; 9703 break;
9710 case "DigitalCertificateRef": 9704 case "DigitalCertificateRef":
9711 this.ParsePatchChildRefElement(child, "MsiDigitalCertificate"); 9705 this.ParsePatchChildRefElement(child, "MsiDigitalCertificate");
9712 break; 9706 break;
9713 case "FeatureRef": 9707 case "FeatureRef":
9714 this.ParsePatchChildRefElement(child, "Feature"); 9708 this.ParsePatchChildRefElement(child, "Feature");
9715 break; 9709 break;
9716 case "IconRef": 9710 case "IconRef":
9717 this.ParsePatchChildRefElement(child, "Icon"); 9711 this.ParsePatchChildRefElement(child, "Icon");
9718 break; 9712 break;
9719 case "PropertyRef": 9713 case "PropertyRef":
9720 this.ParsePatchChildRefElement(child, "Property"); 9714 this.ParsePatchChildRefElement(child, "Property");
9721 break; 9715 break;
9722 case "UIRef": 9716 case "UIRef":
9723 this.ParsePatchChildRefElement(child, "WixUI"); 9717 this.ParsePatchChildRefElement(child, "WixUI");
9724 break; 9718 break;
9725 default: 9719 default:
9726 this.Core.UnexpectedElement(node, child); 9720 this.Core.UnexpectedElement(node, child);
9727 break; 9721 break;
9728 } 9722 }
9729 } 9723 }
9730 else 9724 else
@@ -9754,10 +9748,10 @@ namespace WixToolset.Core
9754 /// <param name="node">The element to parse.</param> 9748 /// <param name="node">The element to parse.</param>
9755 private void ParseAllElement(XElement node) 9749 private void ParseAllElement(XElement node)
9756 { 9750 {
9757 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9751 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9758 9752
9759 // find unexpected attributes 9753 // find unexpected attributes
9760 foreach (XAttribute attrib in node.Attributes()) 9754 foreach (var attrib in node.Attributes())
9761 { 9755 {
9762 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9756 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9763 { 9757 {
@@ -9787,21 +9781,21 @@ namespace WixToolset.Core
9787 /// <param name="tableName">Table that reference was made to.</param> 9781 /// <param name="tableName">Table that reference was made to.</param>
9788 private void ParsePatchChildRefElement(XElement node, string tableName) 9782 private void ParsePatchChildRefElement(XElement node, string tableName)
9789 { 9783 {
9790 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9784 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9791 string id = null; 9785 string id = null;
9792 9786
9793 foreach (XAttribute attrib in node.Attributes()) 9787 foreach (var attrib in node.Attributes())
9794 { 9788 {
9795 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9789 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9796 { 9790 {
9797 switch (attrib.Name.LocalName) 9791 switch (attrib.Name.LocalName)
9798 { 9792 {
9799 case "Id": 9793 case "Id":
9800 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 9794 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
9801 break; 9795 break;
9802 default: 9796 default:
9803 this.Core.UnexpectedAttribute(node, attrib); 9797 this.Core.UnexpectedAttribute(node, attrib);
9804 break; 9798 break;
9805 } 9799 }
9806 } 9800 }
9807 else 9801 else
@@ -9830,23 +9824,23 @@ namespace WixToolset.Core
9830 /// <param name="diskId">Media index from parent element.</param> 9824 /// <param name="diskId">Media index from parent element.</param>
9831 private void ParsePatchBaselineElement(XElement node, int diskId) 9825 private void ParsePatchBaselineElement(XElement node, int diskId)
9832 { 9826 {
9833 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9827 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9834 Identifier id = null; 9828 Identifier id = null;
9835 bool parsedValidate = false; 9829 var parsedValidate = false;
9836 TransformFlags validationFlags = TransformFlags.PatchTransformDefault; 9830 var validationFlags = TransformFlags.PatchTransformDefault;
9837 9831
9838 foreach (XAttribute attrib in node.Attributes()) 9832 foreach (var attrib in node.Attributes())
9839 { 9833 {
9840 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9834 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9841 { 9835 {
9842 switch (attrib.Name.LocalName) 9836 switch (attrib.Name.LocalName)
9843 { 9837 {
9844 case "Id": 9838 case "Id":
9845 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 9839 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
9846 break; 9840 break;
9847 default: 9841 default:
9848 this.Core.UnexpectedAttribute(node, attrib); 9842 this.Core.UnexpectedAttribute(node, attrib);
9849 break; 9843 break;
9850 } 9844 }
9851 } 9845 }
9852 else 9846 else
@@ -9865,27 +9859,27 @@ namespace WixToolset.Core
9865 this.Core.Write(ErrorMessages.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, 27)); 9859 this.Core.Write(ErrorMessages.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Id", id.Id, 27));
9866 } 9860 }
9867 9861
9868 foreach (XElement child in node.Elements()) 9862 foreach (var child in node.Elements())
9869 { 9863 {
9870 if (CompilerCore.WixNamespace == child.Name.Namespace) 9864 if (CompilerCore.WixNamespace == child.Name.Namespace)
9871 { 9865 {
9872 switch (child.Name.LocalName) 9866 switch (child.Name.LocalName)
9873 { 9867 {
9874 case "Validate": 9868 case "Validate":
9875 if (parsedValidate) 9869 if (parsedValidate)
9876 { 9870 {
9877 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 9871 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
9878 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); 9872 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName));
9879 } 9873 }
9880 else 9874 else
9881 { 9875 {
9882 this.ParseValidateElement(child, ref validationFlags); 9876 this.ParseValidateElement(child, ref validationFlags);
9883 parsedValidate = true; 9877 parsedValidate = true;
9884 } 9878 }
9885 break; 9879 break;
9886 default: 9880 default:
9887 this.Core.UnexpectedElement(node, child); 9881 this.Core.UnexpectedElement(node, child);
9888 break; 9882 break;
9889 } 9883 }
9890 } 9884 }
9891 else 9885 else
@@ -9909,153 +9903,153 @@ namespace WixToolset.Core
9909 /// <param name="validationFlags">TransformValidation flags to use when creating the authoring patch transform.</param> 9903 /// <param name="validationFlags">TransformValidation flags to use when creating the authoring patch transform.</param>
9910 private void ParseValidateElement(XElement node, ref TransformFlags validationFlags) 9904 private void ParseValidateElement(XElement node, ref TransformFlags validationFlags)
9911 { 9905 {
9912 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 9906 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
9913 9907
9914 foreach (XAttribute attrib in node.Attributes()) 9908 foreach (var attrib in node.Attributes())
9915 { 9909 {
9916 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 9910 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
9917 { 9911 {
9918 switch (attrib.Name.LocalName) 9912 switch (attrib.Name.LocalName)
9919 { 9913 {
9920 case "ProductId": 9914 case "ProductId":
9921 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9915 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
9922 { 9916 {
9923 validationFlags |= TransformFlags.ValidateProduct; 9917 validationFlags |= TransformFlags.ValidateProduct;
9924 } 9918 }
9925 else 9919 else
9926 { 9920 {
9927 validationFlags &= ~TransformFlags.ValidateProduct; 9921 validationFlags &= ~TransformFlags.ValidateProduct;
9928 } 9922 }
9929 break; 9923 break;
9930 case "ProductLanguage": 9924 case "ProductLanguage":
9931 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9925 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
9932 { 9926 {
9933 validationFlags |= TransformFlags.ValidateLanguage; 9927 validationFlags |= TransformFlags.ValidateLanguage;
9934 } 9928 }
9935 else 9929 else
9936 { 9930 {
9937 validationFlags &= ~TransformFlags.ValidateLanguage; 9931 validationFlags &= ~TransformFlags.ValidateLanguage;
9938 } 9932 }
9939 break; 9933 break;
9940 case "ProductVersion": 9934 case "ProductVersion":
9941 string check = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9935 var check = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
9942 validationFlags &= ~TransformFlags.ProductVersionMask; 9936 validationFlags &= ~TransformFlags.ProductVersionMask;
9943 Wix.Validate.ProductVersionType productVersionType = Wix.Validate.ParseProductVersionType(check); 9937 var productVersionType = Wix.Validate.ParseProductVersionType(check);
9944 switch (productVersionType) 9938 switch (productVersionType)
9945 { 9939 {
9946 case Wix.Validate.ProductVersionType.Major: 9940 case Wix.Validate.ProductVersionType.Major:
9947 validationFlags |= TransformFlags.ValidateMajorVersion; 9941 validationFlags |= TransformFlags.ValidateMajorVersion;
9948 break;
9949 case Wix.Validate.ProductVersionType.Minor:
9950 validationFlags |= TransformFlags.ValidateMinorVersion;
9951 break;
9952 case Wix.Validate.ProductVersionType.Update:
9953 validationFlags |= TransformFlags.ValidateUpdateVersion;
9954 break;
9955 default:
9956 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Version", check, "Major", "Minor", "Update"));
9957 break;
9958 }
9959 break; 9942 break;
9960 case "ProductVersionOperator": 9943 case Wix.Validate.ProductVersionType.Minor:
9961 string op = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 9944 validationFlags |= TransformFlags.ValidateMinorVersion;
9962 validationFlags &= ~TransformFlags.ProductVersionOperatorMask;
9963 Wix.Validate.ProductVersionOperatorType opType = Wix.Validate.ParseProductVersionOperatorType(op);
9964 switch (opType)
9965 {
9966 case Wix.Validate.ProductVersionOperatorType.Lesser:
9967 validationFlags |= TransformFlags.ValidateNewLessBaseVersion;
9968 break;
9969 case Wix.Validate.ProductVersionOperatorType.LesserOrEqual:
9970 validationFlags |= TransformFlags.ValidateNewLessEqualBaseVersion;
9971 break;
9972 case Wix.Validate.ProductVersionOperatorType.Equal:
9973 validationFlags |= TransformFlags.ValidateNewEqualBaseVersion;
9974 break;
9975 case Wix.Validate.ProductVersionOperatorType.GreaterOrEqual:
9976 validationFlags |= TransformFlags.ValidateNewGreaterEqualBaseVersion;
9977 break;
9978 case Wix.Validate.ProductVersionOperatorType.Greater:
9979 validationFlags |= TransformFlags.ValidateNewGreaterBaseVersion;
9980 break;
9981 default:
9982 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Operator", op, "Lesser", "LesserOrEqual", "Equal", "GreaterOrEqual", "Greater"));
9983 break;
9984 }
9985 break; 9945 break;
9986 case "UpgradeCode": 9946 case Wix.Validate.ProductVersionType.Update:
9987 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9947 validationFlags |= TransformFlags.ValidateUpdateVersion;
9988 {
9989 validationFlags |= TransformFlags.ValidateUpgradeCode;
9990 }
9991 else
9992 {
9993 validationFlags &= ~TransformFlags.ValidateUpgradeCode;
9994 }
9995 break; 9948 break;
9996 case "IgnoreAddExistingRow": 9949 default:
9997 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9950 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Version", check, "Major", "Minor", "Update"));
9998 {
9999 validationFlags |= TransformFlags.ErrorAddExistingRow;
10000 }
10001 else
10002 {
10003 validationFlags &= ~TransformFlags.ErrorAddExistingRow;
10004 }
10005 break; 9951 break;
10006 case "IgnoreAddExistingTable": 9952 }
10007 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9953 break;
10008 { 9954 case "ProductVersionOperator":
10009 validationFlags |= TransformFlags.ErrorAddExistingTable; 9955 var op = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10010 } 9956 validationFlags &= ~TransformFlags.ProductVersionOperatorMask;
10011 else 9957 var opType = Wix.Validate.ParseProductVersionOperatorType(op);
10012 { 9958 switch (opType)
10013 validationFlags &= ~TransformFlags.ErrorAddExistingTable; 9959 {
10014 } 9960 case Wix.Validate.ProductVersionOperatorType.Lesser:
9961 validationFlags |= TransformFlags.ValidateNewLessBaseVersion;
10015 break; 9962 break;
10016 case "IgnoreDeleteMissingRow": 9963 case Wix.Validate.ProductVersionOperatorType.LesserOrEqual:
10017 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9964 validationFlags |= TransformFlags.ValidateNewLessEqualBaseVersion;
10018 {
10019 validationFlags |= TransformFlags.ErrorDeleteMissingRow;
10020 }
10021 else
10022 {
10023 validationFlags &= ~TransformFlags.ErrorDeleteMissingRow;
10024 }
10025 break; 9965 break;
10026 case "IgnoreDeleteMissingTable": 9966 case Wix.Validate.ProductVersionOperatorType.Equal:
10027 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9967 validationFlags |= TransformFlags.ValidateNewEqualBaseVersion;
10028 {
10029 validationFlags |= TransformFlags.ErrorDeleteMissingTable;
10030 }
10031 else
10032 {
10033 validationFlags &= ~TransformFlags.ErrorDeleteMissingTable;
10034 }
10035 break; 9968 break;
10036 case "IgnoreUpdateMissingRow": 9969 case Wix.Validate.ProductVersionOperatorType.GreaterOrEqual:
10037 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9970 validationFlags |= TransformFlags.ValidateNewGreaterEqualBaseVersion;
10038 {
10039 validationFlags |= TransformFlags.ErrorUpdateMissingRow;
10040 }
10041 else
10042 {
10043 validationFlags &= ~TransformFlags.ErrorUpdateMissingRow;
10044 }
10045 break; 9971 break;
10046 case "IgnoreChangingCodePage": 9972 case Wix.Validate.ProductVersionOperatorType.Greater:
10047 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 9973 validationFlags |= TransformFlags.ValidateNewGreaterBaseVersion;
10048 {
10049 validationFlags |= TransformFlags.ErrorChangeCodePage;
10050 }
10051 else
10052 {
10053 validationFlags &= ~TransformFlags.ErrorChangeCodePage;
10054 }
10055 break; 9974 break;
10056 default: 9975 default:
10057 this.Core.UnexpectedAttribute(node, attrib); 9976 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Operator", op, "Lesser", "LesserOrEqual", "Equal", "GreaterOrEqual", "Greater"));
10058 break; 9977 break;
9978 }
9979 break;
9980 case "UpgradeCode":
9981 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
9982 {
9983 validationFlags |= TransformFlags.ValidateUpgradeCode;
9984 }
9985 else
9986 {
9987 validationFlags &= ~TransformFlags.ValidateUpgradeCode;
9988 }
9989 break;
9990 case "IgnoreAddExistingRow":
9991 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
9992 {
9993 validationFlags |= TransformFlags.ErrorAddExistingRow;
9994 }
9995 else
9996 {
9997 validationFlags &= ~TransformFlags.ErrorAddExistingRow;
9998 }
9999 break;
10000 case "IgnoreAddExistingTable":
10001 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10002 {
10003 validationFlags |= TransformFlags.ErrorAddExistingTable;
10004 }
10005 else
10006 {
10007 validationFlags &= ~TransformFlags.ErrorAddExistingTable;
10008 }
10009 break;
10010 case "IgnoreDeleteMissingRow":
10011 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10012 {
10013 validationFlags |= TransformFlags.ErrorDeleteMissingRow;
10014 }
10015 else
10016 {
10017 validationFlags &= ~TransformFlags.ErrorDeleteMissingRow;
10018 }
10019 break;
10020 case "IgnoreDeleteMissingTable":
10021 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10022 {
10023 validationFlags |= TransformFlags.ErrorDeleteMissingTable;
10024 }
10025 else
10026 {
10027 validationFlags &= ~TransformFlags.ErrorDeleteMissingTable;
10028 }
10029 break;
10030 case "IgnoreUpdateMissingRow":
10031 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10032 {
10033 validationFlags |= TransformFlags.ErrorUpdateMissingRow;
10034 }
10035 else
10036 {
10037 validationFlags &= ~TransformFlags.ErrorUpdateMissingRow;
10038 }
10039 break;
10040 case "IgnoreChangingCodePage":
10041 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10042 {
10043 validationFlags |= TransformFlags.ErrorChangeCodePage;
10044 }
10045 else
10046 {
10047 validationFlags &= ~TransformFlags.ErrorChangeCodePage;
10048 }
10049 break;
10050 default:
10051 this.Core.UnexpectedAttribute(node, attrib);
10052 break;
10059 } 10053 }
10060 } 10054 }
10061 else 10055 else
@@ -10088,29 +10082,29 @@ namespace WixToolset.Core
10088 /// <param name="node">Element to parse.</param> 10082 /// <param name="node">Element to parse.</param>
10089 private void ParseDependencyElement(XElement node) 10083 private void ParseDependencyElement(XElement node)
10090 { 10084 {
10091 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 10085 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
10092 string requiredId = null; 10086 string requiredId = null;
10093 int requiredLanguage = CompilerConstants.IntegerNotSet; 10087 var requiredLanguage = CompilerConstants.IntegerNotSet;
10094 string requiredVersion = null; 10088 string requiredVersion = null;
10095 10089
10096 foreach (XAttribute attrib in node.Attributes()) 10090 foreach (var attrib in node.Attributes())
10097 { 10091 {
10098 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 10092 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
10099 { 10093 {
10100 switch (attrib.Name.LocalName) 10094 switch (attrib.Name.LocalName)
10101 { 10095 {
10102 case "RequiredId": 10096 case "RequiredId":
10103 requiredId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 10097 requiredId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
10104 break; 10098 break;
10105 case "RequiredLanguage": 10099 case "RequiredLanguage":
10106 requiredLanguage = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 10100 requiredLanguage = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
10107 break; 10101 break;
10108 case "RequiredVersion": 10102 case "RequiredVersion":
10109 requiredVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10103 requiredVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10110 break; 10104 break;
10111 default: 10105 default:
10112 this.Core.UnexpectedAttribute(node, attrib); 10106 this.Core.UnexpectedAttribute(node, attrib);
10113 break; 10107 break;
10114 } 10108 }
10115 } 10109 }
10116 else 10110 else
@@ -10150,38 +10144,38 @@ namespace WixToolset.Core
10150 /// <param name="node">Element to parse.</param> 10144 /// <param name="node">Element to parse.</param>
10151 private void ParseExclusionElement(XElement node) 10145 private void ParseExclusionElement(XElement node)
10152 { 10146 {
10153 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 10147 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
10154 string excludedId = null; 10148 string excludedId = null;
10155 int excludeExceptLanguage = CompilerConstants.IntegerNotSet; 10149 var excludeExceptLanguage = CompilerConstants.IntegerNotSet;
10156 int excludeLanguage = CompilerConstants.IntegerNotSet; 10150 var excludeLanguage = CompilerConstants.IntegerNotSet;
10157 string excludedLanguageField = "0"; 10151 var excludedLanguageField = "0";
10158 string excludedMaxVersion = null; 10152 string excludedMaxVersion = null;
10159 string excludedMinVersion = null; 10153 string excludedMinVersion = null;
10160 10154
10161 foreach (XAttribute attrib in node.Attributes()) 10155 foreach (var attrib in node.Attributes())
10162 { 10156 {
10163 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 10157 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
10164 { 10158 {
10165 switch (attrib.Name.LocalName) 10159 switch (attrib.Name.LocalName)
10166 { 10160 {
10167 case "ExcludedId": 10161 case "ExcludedId":
10168 excludedId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 10162 excludedId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
10169 break; 10163 break;
10170 case "ExcludeExceptLanguage": 10164 case "ExcludeExceptLanguage":
10171 excludeExceptLanguage = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 10165 excludeExceptLanguage = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
10172 break; 10166 break;
10173 case "ExcludeLanguage": 10167 case "ExcludeLanguage":
10174 excludeLanguage = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 10168 excludeLanguage = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
10175 break; 10169 break;
10176 case "ExcludedMaxVersion": 10170 case "ExcludedMaxVersion":
10177 excludedMaxVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10171 excludedMaxVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10178 break; 10172 break;
10179 case "ExcludedMinVersion": 10173 case "ExcludedMinVersion":
10180 excludedMinVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10174 excludedMinVersion = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10181 break; 10175 break;
10182 default: 10176 default:
10183 this.Core.UnexpectedAttribute(node, attrib); 10177 this.Core.UnexpectedAttribute(node, attrib);
10184 break; 10178 break;
10185 } 10179 }
10186 } 10180 }
10187 else 10181 else
@@ -10229,88 +10223,88 @@ namespace WixToolset.Core
10229 /// <param name="node">Element to parse.</param> 10223 /// <param name="node">Element to parse.</param>
10230 private void ParseConfigurationElement(XElement node) 10224 private void ParseConfigurationElement(XElement node)
10231 { 10225 {
10232 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 10226 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
10233 int attributes = 0; 10227 var attributes = 0;
10234 string contextData = null; 10228 string contextData = null;
10235 string defaultValue = null; 10229 string defaultValue = null;
10236 string description = null; 10230 string description = null;
10237 string displayName = null; 10231 string displayName = null;
10238 int format = CompilerConstants.IntegerNotSet; 10232 var format = CompilerConstants.IntegerNotSet;
10239 string helpKeyword = null; 10233 string helpKeyword = null;
10240 string helpLocation = null; 10234 string helpLocation = null;
10241 string name = null; 10235 string name = null;
10242 string type = null; 10236 string type = null;
10243 10237
10244 foreach (XAttribute attrib in node.Attributes()) 10238 foreach (var attrib in node.Attributes())
10245 { 10239 {
10246 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 10240 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
10247 { 10241 {
10248 switch (attrib.Name.LocalName) 10242 switch (attrib.Name.LocalName)
10249 { 10243 {
10250 case "Name": 10244 case "Name":
10251 name = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 10245 name = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
10252 break; 10246 break;
10253 case "ContextData": 10247 case "ContextData":
10254 contextData = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10248 contextData = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10255 break; 10249 break;
10256 case "Description": 10250 case "Description":
10257 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10251 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10258 break; 10252 break;
10259 case "DefaultValue": 10253 case "DefaultValue":
10260 defaultValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10254 defaultValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10261 break; 10255 break;
10262 case "DisplayName": 10256 case "DisplayName":
10263 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10257 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10264 break; 10258 break;
10265 case "Format": 10259 case "Format":
10266 string formatStr = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10260 var formatStr = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10267 if (0 < formatStr.Length) 10261 if (0 < formatStr.Length)
10268 { 10262 {
10269 Wix.Configuration.FormatType formatType = Wix.Configuration.ParseFormatType(formatStr); 10263 var formatType = Wix.Configuration.ParseFormatType(formatStr);
10270 switch (formatType) 10264 switch (formatType)
10271 {
10272 case Wix.Configuration.FormatType.Text:
10273 format = 0;
10274 break;
10275 case Wix.Configuration.FormatType.Key:
10276 format = 1;
10277 break;
10278 case Wix.Configuration.FormatType.Integer:
10279 format = 2;
10280 break;
10281 case Wix.Configuration.FormatType.Bitfield:
10282 format = 3;
10283 break;
10284 default:
10285 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Format", formatStr, "Text", "Key", "Integer", "Bitfield"));
10286 break;
10287 }
10288 }
10289 break;
10290 case "HelpKeyword":
10291 helpKeyword = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10292 break;
10293 case "HelpLocation":
10294 helpLocation = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10295 break;
10296 case "KeyNoOrphan":
10297 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10298 {
10299 attributes |= MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan;
10300 }
10301 break;
10302 case "NonNullable":
10303 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10304 { 10265 {
10305 attributes |= MsiInterop.MsidbMsmConfigurableOptionNonNullable; 10266 case Wix.Configuration.FormatType.Text:
10267 format = 0;
10268 break;
10269 case Wix.Configuration.FormatType.Key:
10270 format = 1;
10271 break;
10272 case Wix.Configuration.FormatType.Integer:
10273 format = 2;
10274 break;
10275 case Wix.Configuration.FormatType.Bitfield:
10276 format = 3;
10277 break;
10278 default:
10279 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Format", formatStr, "Text", "Key", "Integer", "Bitfield"));
10280 break;
10306 } 10281 }
10307 break; 10282 }
10308 case "Type": 10283 break;
10309 type = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10284 case "HelpKeyword":
10310 break; 10285 helpKeyword = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10311 default: 10286 break;
10312 this.Core.UnexpectedAttribute(node, attrib); 10287 case "HelpLocation":
10313 break; 10288 helpLocation = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10289 break;
10290 case "KeyNoOrphan":
10291 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10292 {
10293 attributes |= MsiInterop.MsidbMsmConfigurableOptionKeyNoOrphan;
10294 }
10295 break;
10296 case "NonNullable":
10297 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10298 {
10299 attributes |= MsiInterop.MsidbMsmConfigurableOptionNonNullable;
10300 }
10301 break;
10302 case "Type":
10303 type = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10304 break;
10305 default:
10306 this.Core.UnexpectedAttribute(node, attrib);
10307 break;
10314 } 10308 }
10315 } 10309 }
10316 else 10310 else
@@ -10355,33 +10349,33 @@ namespace WixToolset.Core
10355 /// <param name="node">Element to parse.</param> 10349 /// <param name="node">Element to parse.</param>
10356 private void ParseSubstitutionElement(XElement node) 10350 private void ParseSubstitutionElement(XElement node)
10357 { 10351 {
10358 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 10352 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
10359 string column = null; 10353 string column = null;
10360 string rowKeys = null; 10354 string rowKeys = null;
10361 string table = null; 10355 string table = null;
10362 string value = null; 10356 string value = null;
10363 10357
10364 foreach (XAttribute attrib in node.Attributes()) 10358 foreach (var attrib in node.Attributes())
10365 { 10359 {
10366 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 10360 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
10367 { 10361 {
10368 switch (attrib.Name.LocalName) 10362 switch (attrib.Name.LocalName)
10369 { 10363 {
10370 case "Column": 10364 case "Column":
10371 column = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 10365 column = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
10372 break; 10366 break;
10373 case "Row": 10367 case "Row":
10374 rowKeys = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10368 rowKeys = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10375 break; 10369 break;
10376 case "Table": 10370 case "Table":
10377 table = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 10371 table = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
10378 break; 10372 break;
10379 case "Value": 10373 case "Value":
10380 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10374 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10381 break; 10375 break;
10382 default: 10376 default:
10383 this.Core.UnexpectedAttribute(node, attrib); 10377 this.Core.UnexpectedAttribute(node, attrib);
10384 break; 10378 break;
10385 } 10379 }
10386 } 10380 }
10387 else 10381 else
@@ -10425,21 +10419,21 @@ namespace WixToolset.Core
10425 /// <param name="node">Element to parse.</param> 10419 /// <param name="node">Element to parse.</param>
10426 private void ParseIgnoreTableElement(XElement node) 10420 private void ParseIgnoreTableElement(XElement node)
10427 { 10421 {
10428 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 10422 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
10429 string id = null; 10423 string id = null;
10430 10424
10431 foreach (XAttribute attrib in node.Attributes()) 10425 foreach (var attrib in node.Attributes())
10432 { 10426 {
10433 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 10427 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
10434 { 10428 {
10435 switch (attrib.Name.LocalName) 10429 switch (attrib.Name.LocalName)
10436 { 10430 {
10437 case "Id": 10431 case "Id":
10438 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 10432 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
10439 break; 10433 break;
10440 default: 10434 default:
10441 this.Core.UnexpectedAttribute(node, attrib); 10435 this.Core.UnexpectedAttribute(node, attrib);
10442 break; 10436 break;
10443 } 10437 }
10444 } 10438 }
10445 else 10439 else
@@ -10471,35 +10465,35 @@ namespace WixToolset.Core
10471 /// <param name="table">Table we're processing for.</param> 10465 /// <param name="table">Table we're processing for.</param>
10472 private void ParseODBCDriverOrTranslator(XElement node, string componentId, string fileId, TupleDefinitionType tableName) 10466 private void ParseODBCDriverOrTranslator(XElement node, string componentId, string fileId, TupleDefinitionType tableName)
10473 { 10467 {
10474 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 10468 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
10475 Identifier id = null; 10469 Identifier id = null;
10476 string driver = fileId; 10470 var driver = fileId;
10477 string name = null; 10471 string name = null;
10478 string setup = fileId; 10472 var setup = fileId;
10479 10473
10480 foreach (XAttribute attrib in node.Attributes()) 10474 foreach (var attrib in node.Attributes())
10481 { 10475 {
10482 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 10476 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
10483 { 10477 {
10484 switch (attrib.Name.LocalName) 10478 switch (attrib.Name.LocalName)
10485 { 10479 {
10486 case "Id": 10480 case "Id":
10487 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 10481 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
10488 break; 10482 break;
10489 case "File": 10483 case "File":
10490 driver = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 10484 driver = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
10491 this.Core.CreateSimpleReference(sourceLineNumbers, "File", driver); 10485 this.Core.CreateSimpleReference(sourceLineNumbers, "File", driver);
10492 break; 10486 break;
10493 case "Name": 10487 case "Name":
10494 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10488 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10495 break; 10489 break;
10496 case "SetupFile": 10490 case "SetupFile":
10497 setup = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 10491 setup = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
10498 this.Core.CreateSimpleReference(sourceLineNumbers, "File", setup); 10492 this.Core.CreateSimpleReference(sourceLineNumbers, "File", setup);
10499 break; 10493 break;
10500 default: 10494 default:
10501 this.Core.UnexpectedAttribute(node, attrib); 10495 this.Core.UnexpectedAttribute(node, attrib);
10502 break; 10496 break;
10503 } 10497 }
10504 } 10498 }
10505 else 10499 else
@@ -10522,22 +10516,22 @@ namespace WixToolset.Core
10522 if (TupleDefinitionType.ODBCDriver == tableName) 10516 if (TupleDefinitionType.ODBCDriver == tableName)
10523 { 10517 {
10524 // process any data sources for the driver 10518 // process any data sources for the driver
10525 foreach (XElement child in node.Elements()) 10519 foreach (var child in node.Elements())
10526 { 10520 {
10527 if (CompilerCore.WixNamespace == child.Name.Namespace) 10521 if (CompilerCore.WixNamespace == child.Name.Namespace)
10528 { 10522 {
10529 switch (child.Name.LocalName) 10523 switch (child.Name.LocalName)
10530 { 10524 {
10531 case "ODBCDataSource": 10525 case "ODBCDataSource":
10532 string ignoredKeyPath = null; 10526 string ignoredKeyPath = null;
10533 this.ParseODBCDataSource(child, componentId, name, out ignoredKeyPath); 10527 this.ParseODBCDataSource(child, componentId, name, out ignoredKeyPath);
10534 break; 10528 break;
10535 case "Property": 10529 case "Property":
10536 this.ParseODBCProperty(child, id.Id, TupleDefinitionType.ODBCAttribute); 10530 this.ParseODBCProperty(child, id.Id, TupleDefinitionType.ODBCAttribute);
10537 break; 10531 break;
10538 default: 10532 default:
10539 this.Core.UnexpectedElement(node, child); 10533 this.Core.UnexpectedElement(node, child);
10540 break; 10534 break;
10541 } 10535 }
10542 } 10536 }
10543 else 10537 else
@@ -10569,25 +10563,25 @@ namespace WixToolset.Core
10569 /// <param name="tableName">Name of the table to create property in.</param> 10563 /// <param name="tableName">Name of the table to create property in.</param>
10570 private void ParseODBCProperty(XElement node, string parentId, TupleDefinitionType tableName) 10564 private void ParseODBCProperty(XElement node, string parentId, TupleDefinitionType tableName)
10571 { 10565 {
10572 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 10566 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
10573 string id = null; 10567 string id = null;
10574 string propertyValue = null; 10568 string propertyValue = null;
10575 10569
10576 foreach (XAttribute attrib in node.Attributes()) 10570 foreach (var attrib in node.Attributes())
10577 { 10571 {
10578 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 10572 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
10579 { 10573 {
10580 switch (attrib.Name.LocalName) 10574 switch (attrib.Name.LocalName)
10581 { 10575 {
10582 case "Id": 10576 case "Id":
10583 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10577 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10584 break; 10578 break;
10585 case "Value": 10579 case "Value":
10586 propertyValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10580 propertyValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10587 break; 10581 break;
10588 default: 10582 default:
10589 this.Core.UnexpectedAttribute(node, attrib); 10583 this.Core.UnexpectedAttribute(node, attrib);
10590 break; 10584 break;
10591 } 10585 }
10592 } 10586 }
10593 else 10587 else
@@ -10622,52 +10616,52 @@ namespace WixToolset.Core
10622 /// <returns>Yes if this element was marked as the parent component's key path, No if explicitly marked as not being a key path, or NotSet otherwise.</returns> 10616 /// <returns>Yes if this element was marked as the parent component's key path, No if explicitly marked as not being a key path, or NotSet otherwise.</returns>
10623 private YesNoType ParseODBCDataSource(XElement node, string componentId, string driverName, out string possibleKeyPath) 10617 private YesNoType ParseODBCDataSource(XElement node, string componentId, string driverName, out string possibleKeyPath)
10624 { 10618 {
10625 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 10619 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
10626 Identifier id = null; 10620 Identifier id = null;
10627 YesNoType keyPath = YesNoType.NotSet; 10621 var keyPath = YesNoType.NotSet;
10628 string name = null; 10622 string name = null;
10629 int registration = CompilerConstants.IntegerNotSet; 10623 var registration = CompilerConstants.IntegerNotSet;
10630 10624
10631 foreach (XAttribute attrib in node.Attributes()) 10625 foreach (var attrib in node.Attributes())
10632 { 10626 {
10633 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 10627 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
10634 { 10628 {
10635 switch (attrib.Name.LocalName) 10629 switch (attrib.Name.LocalName)
10636 { 10630 {
10637 case "Id": 10631 case "Id":
10638 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 10632 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
10639 break; 10633 break;
10640 case "DriverName": 10634 case "DriverName":
10641 driverName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10635 driverName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10642 break; 10636 break;
10643 case "KeyPath": 10637 case "KeyPath":
10644 keyPath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 10638 keyPath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
10645 break; 10639 break;
10646 case "Name": 10640 case "Name":
10647 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10641 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10648 break; 10642 break;
10649 case "Registration": 10643 case "Registration":
10650 string registrationValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10644 var registrationValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10651 if (0 < registrationValue.Length) 10645 if (0 < registrationValue.Length)
10646 {
10647 var registrationType = Wix.ODBCDataSource.ParseRegistrationType(registrationValue);
10648 switch (registrationType)
10652 { 10649 {
10653 Wix.ODBCDataSource.RegistrationType registrationType = Wix.ODBCDataSource.ParseRegistrationType(registrationValue); 10650 case Wix.ODBCDataSource.RegistrationType.machine:
10654 switch (registrationType) 10651 registration = 0;
10655 { 10652 break;
10656 case Wix.ODBCDataSource.RegistrationType.machine: 10653 case Wix.ODBCDataSource.RegistrationType.user:
10657 registration = 0; 10654 registration = 1;
10658 break; 10655 break;
10659 case Wix.ODBCDataSource.RegistrationType.user: 10656 default:
10660 registration = 1; 10657 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Registration", registrationValue, "machine", "user"));
10661 break; 10658 break;
10662 default:
10663 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Registration", registrationValue, "machine", "user"));
10664 break;
10665 }
10666 } 10659 }
10667 break; 10660 }
10668 default: 10661 break;
10669 this.Core.UnexpectedAttribute(node, attrib); 10662 default:
10670 break; 10663 this.Core.UnexpectedAttribute(node, attrib);
10664 break;
10671 } 10665 }
10672 } 10666 }
10673 else 10667 else
@@ -10687,18 +10681,18 @@ namespace WixToolset.Core
10687 id = this.Core.CreateIdentifier("odc", name, driverName, registration.ToString()); 10681 id = this.Core.CreateIdentifier("odc", name, driverName, registration.ToString());
10688 } 10682 }
10689 10683
10690 foreach (XElement child in node.Elements()) 10684 foreach (var child in node.Elements())
10691 { 10685 {
10692 if (CompilerCore.WixNamespace == child.Name.Namespace) 10686 if (CompilerCore.WixNamespace == child.Name.Namespace)
10693 { 10687 {
10694 switch (child.Name.LocalName) 10688 switch (child.Name.LocalName)
10695 { 10689 {
10696 case "Property": 10690 case "Property":
10697 this.ParseODBCProperty(child, id.Id, TupleDefinitionType.ODBCSourceAttribute); 10691 this.ParseODBCProperty(child, id.Id, TupleDefinitionType.ODBCSourceAttribute);
10698 break; 10692 break;
10699 default: 10693 default:
10700 this.Core.UnexpectedElement(node, child); 10694 this.Core.UnexpectedElement(node, child);
10701 break; 10695 break;
10702 } 10696 }
10703 } 10697 }
10704 else 10698 else
@@ -10728,195 +10722,195 @@ namespace WixToolset.Core
10728 /// <param name="moduleId">The module guid - this is necessary until Module/@Guid is removed.</param> 10722 /// <param name="moduleId">The module guid - this is necessary until Module/@Guid is removed.</param>
10729 private void ParsePackageElement(XElement node, string productAuthor, string moduleId) 10723 private void ParsePackageElement(XElement node, string productAuthor, string moduleId)
10730 { 10724 {
10731 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 10725 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
10732 string codepage = "1252"; 10726 var codepage = "1252";
10733 string comments = String.Format(CultureInfo.InvariantCulture, "This installer database contains the logic and data required to install {0}.", this.activeName); 10727 var comments = String.Format(CultureInfo.InvariantCulture, "This installer database contains the logic and data required to install {0}.", this.activeName);
10734 string keywords = "Installer"; 10728 var keywords = "Installer";
10735 int msiVersion = 100; // lowest released version, really should be specified 10729 var msiVersion = 100; // lowest released version, really should be specified
10736 string packageAuthor = productAuthor; 10730 var packageAuthor = productAuthor;
10737 string packageCode = null; 10731 string packageCode = null;
10738 string packageLanguages = this.activeLanguage; 10732 var packageLanguages = this.activeLanguage;
10739 string packageName = this.activeName; 10733 var packageName = this.activeName;
10740 string platform = null; 10734 string platform = null;
10741 string platformValue = null; 10735 string platformValue = null;
10742 YesNoDefaultType security = YesNoDefaultType.Default; 10736 var security = YesNoDefaultType.Default;
10743 int sourceBits = (this.compilingModule ? 2 : 0); 10737 var sourceBits = (this.compilingModule ? 2 : 0);
10744 IntermediateTuple row; 10738 IntermediateTuple row;
10745 bool installPrivilegeSeen = false; 10739 var installPrivilegeSeen = false;
10746 bool installScopeSeen = false; 10740 var installScopeSeen = false;
10747 10741
10748 switch (this.CurrentPlatform) 10742 switch (this.CurrentPlatform)
10749 { 10743 {
10750 case Platform.X86: 10744 case Platform.X86:
10751 platform = "Intel"; 10745 platform = "Intel";
10752 break; 10746 break;
10753 case Platform.X64: 10747 case Platform.X64:
10754 platform = "x64"; 10748 platform = "x64";
10755 msiVersion = 200; 10749 msiVersion = 200;
10756 break; 10750 break;
10757 case Platform.IA64: 10751 case Platform.IA64:
10758 platform = "Intel64"; 10752 platform = "Intel64";
10759 msiVersion = 200; 10753 msiVersion = 200;
10760 break; 10754 break;
10761 case Platform.ARM: 10755 case Platform.ARM:
10762 platform = "Arm"; 10756 platform = "Arm";
10763 msiVersion = 500; 10757 msiVersion = 500;
10764 break; 10758 break;
10765 default: 10759 default:
10766 throw new ArgumentException(WixStrings.EXP_UnknownPlatformEnum, this.CurrentPlatform.ToString()); 10760 throw new ArgumentException(WixStrings.EXP_UnknownPlatformEnum, this.CurrentPlatform.ToString());
10767 } 10761 }
10768 10762
10769 foreach (XAttribute attrib in node.Attributes()) 10763 foreach (var attrib in node.Attributes())
10770 { 10764 {
10771 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 10765 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
10772 { 10766 {
10773 switch (attrib.Name.LocalName) 10767 switch (attrib.Name.LocalName)
10774 { 10768 {
10775 case "Id": 10769 case "Id":
10776 packageCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, this.compilingProduct); 10770 packageCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, this.compilingProduct);
10777 break; 10771 break;
10778 case "AdminImage": 10772 case "AdminImage":
10779 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 10773 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10780 { 10774 {
10781 sourceBits = sourceBits | 4; 10775 sourceBits = sourceBits | 4;
10782 } 10776 }
10783 break; 10777 break;
10784 case "Comments": 10778 case "Comments":
10785 comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10779 comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10786 break; 10780 break;
10787 case "Compressed": 10781 case "Compressed":
10788 // merge modules must always be compressed, so this attribute is invalid 10782 // merge modules must always be compressed, so this attribute is invalid
10789 if (this.compilingModule) 10783 if (this.compilingModule)
10790 { 10784 {
10791 this.Core.Write(WarningMessages.DeprecatedPackageCompressedAttribute(sourceLineNumbers)); 10785 this.Core.Write(WarningMessages.DeprecatedPackageCompressedAttribute(sourceLineNumbers));
10792 // this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "Compressed", "Module")); 10786 // this.core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "Compressed", "Module"));
10793 } 10787 }
10794 else if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 10788 else if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10795 { 10789 {
10796 sourceBits = sourceBits | 2; 10790 sourceBits = sourceBits | 2;
10797 } 10791 }
10798 break; 10792 break;
10799 case "Description": 10793 case "Description":
10800 packageName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10794 packageName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10801 break; 10795 break;
10802 case "InstallPrivileges": 10796 case "InstallPrivileges":
10803 string installPrivileges = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10797 var installPrivileges = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10804 if (0 < installPrivileges.Length) 10798 if (0 < installPrivileges.Length)
10805 { 10799 {
10806 installPrivilegeSeen = true; 10800 installPrivilegeSeen = true;
10807 Wix.Package.InstallPrivilegesType installPrivilegesType = Wix.Package.ParseInstallPrivilegesType(installPrivileges); 10801 var installPrivilegesType = Wix.Package.ParseInstallPrivilegesType(installPrivileges);
10808 switch (installPrivilegesType) 10802 switch (installPrivilegesType)
10809 {
10810 case Wix.Package.InstallPrivilegesType.elevated:
10811 // this is the default setting
10812 break;
10813 case Wix.Package.InstallPrivilegesType.limited:
10814 sourceBits = sourceBits | 8;
10815 break;
10816 default:
10817 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installPrivileges, "elevated", "limited"));
10818 break;
10819 }
10820 }
10821 break;
10822 case "InstallScope":
10823 string installScope = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10824 if (0 < installScope.Length)
10825 {
10826 installScopeSeen = true;
10827 Wix.Package.InstallScopeType installScopeType = Wix.Package.ParseInstallScopeType(installScope);
10828 switch (installScopeType)
10829 {
10830 case Wix.Package.InstallScopeType.perMachine:
10831 {
10832 row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Property, new Identifier("ALLUSERS", AccessModifier.Public));
10833 row.Set(1, "1");
10834 }
10835 break;
10836 case Wix.Package.InstallScopeType.perUser:
10837 sourceBits = sourceBits | 8;
10838 break;
10839 default:
10840 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installScope, "perMachine", "perUser"));
10841 break;
10842 }
10843 }
10844 break;
10845 case "InstallerVersion":
10846 msiVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue);
10847 break;
10848 case "Keywords":
10849 keywords = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10850 break;
10851 case "Languages":
10852 packageLanguages = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10853 break;
10854 case "Manufacturer":
10855 packageAuthor = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10856 if ("PUT-COMPANY-NAME-HERE" == packageAuthor)
10857 { 10803 {
10858 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, packageAuthor)); 10804 case Wix.Package.InstallPrivilegesType.elevated:
10805 // this is the default setting
10806 break;
10807 case Wix.Package.InstallPrivilegesType.limited:
10808 sourceBits = sourceBits | 8;
10809 break;
10810 default:
10811 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installPrivileges, "elevated", "limited"));
10812 break;
10859 } 10813 }
10860 break; 10814 }
10861 case "Platform": 10815 break;
10862 if (null != platformValue) 10816 case "InstallScope":
10817 var installScope = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10818 if (0 < installScope.Length)
10819 {
10820 installScopeSeen = true;
10821 var installScopeType = Wix.Package.ParseInstallScopeType(installScope);
10822 switch (installScopeType)
10863 { 10823 {
10864 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platforms")); 10824 case Wix.Package.InstallScopeType.perMachine:
10865 }
10866
10867 platformValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10868 Wix.Package.PlatformType platformType = Wix.Package.ParsePlatformType(platformValue);
10869 switch (platformType)
10870 { 10825 {
10871 case Wix.Package.PlatformType.intel: 10826 row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Property, new Identifier("ALLUSERS", AccessModifier.Public));
10872 this.Core.Write(WarningMessages.DeprecatedAttributeValue(sourceLineNumbers, platformValue, node.Name.LocalName, attrib.Name.LocalName, "x86")); 10827 row.Set(1, "1");
10873 goto case Wix.Package.PlatformType.x86;
10874 case Wix.Package.PlatformType.x86:
10875 platform = "Intel";
10876 break;
10877 case Wix.Package.PlatformType.x64:
10878 platform = "x64";
10879 break;
10880 case Wix.Package.PlatformType.intel64:
10881 this.Core.Write(WarningMessages.DeprecatedAttributeValue(sourceLineNumbers, platformValue, node.Name.LocalName, attrib.Name.LocalName, "ia64"));
10882 goto case Wix.Package.PlatformType.ia64;
10883 case Wix.Package.PlatformType.ia64:
10884 platform = "Intel64";
10885 break;
10886 case Wix.Package.PlatformType.arm:
10887 platform = "Arm";
10888 break;
10889 default:
10890 this.Core.Write(ErrorMessages.InvalidPlatformValue(sourceLineNumbers, platformValue));
10891 break;
10892 } 10828 }
10893 break; 10829 break;
10894 case "Platforms": 10830 case Wix.Package.InstallScopeType.perUser:
10895 if (null != platformValue) 10831 sourceBits = sourceBits | 8;
10896 { 10832 break;
10897 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform")); 10833 default:
10834 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installScope, "perMachine", "perUser"));
10835 break;
10898 } 10836 }
10837 }
10838 break;
10839 case "InstallerVersion":
10840 msiVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
10841 break;
10842 case "Keywords":
10843 keywords = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10844 break;
10845 case "Languages":
10846 packageLanguages = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10847 break;
10848 case "Manufacturer":
10849 packageAuthor = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10850 if ("PUT-COMPANY-NAME-HERE" == packageAuthor)
10851 {
10852 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, packageAuthor));
10853 }
10854 break;
10855 case "Platform":
10856 if (null != platformValue)
10857 {
10858 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platforms"));
10859 }
10899 10860
10900 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform")); 10861 platformValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10901 platformValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 10862 var platformType = Wix.Package.ParsePlatformType(platformValue);
10902 platform = platformValue; 10863 switch (platformType)
10864 {
10865 case Wix.Package.PlatformType.intel:
10866 this.Core.Write(WarningMessages.DeprecatedAttributeValue(sourceLineNumbers, platformValue, node.Name.LocalName, attrib.Name.LocalName, "x86"));
10867 goto case Wix.Package.PlatformType.x86;
10868 case Wix.Package.PlatformType.x86:
10869 platform = "Intel";
10903 break; 10870 break;
10904 case "ReadOnly": 10871 case Wix.Package.PlatformType.x64:
10905 security = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); 10872 platform = "x64";
10906 break; 10873 break;
10907 case "ShortNames": 10874 case Wix.Package.PlatformType.intel64:
10908 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 10875 this.Core.Write(WarningMessages.DeprecatedAttributeValue(sourceLineNumbers, platformValue, node.Name.LocalName, attrib.Name.LocalName, "ia64"));
10909 { 10876 goto case Wix.Package.PlatformType.ia64;
10910 sourceBits = sourceBits | 1; 10877 case Wix.Package.PlatformType.ia64:
10911 this.useShortFileNames = true; 10878 platform = "Intel64";
10912 }
10913 break; 10879 break;
10914 case "SummaryCodepage": 10880 case Wix.Package.PlatformType.arm:
10915 codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib, true); 10881 platform = "Arm";
10916 break; 10882 break;
10917 default: 10883 default:
10918 this.Core.UnexpectedAttribute(node, attrib); 10884 this.Core.Write(ErrorMessages.InvalidPlatformValue(sourceLineNumbers, platformValue));
10919 break; 10885 break;
10886 }
10887 break;
10888 case "Platforms":
10889 if (null != platformValue)
10890 {
10891 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform"));
10892 }
10893
10894 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Platform"));
10895 platformValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
10896 platform = platformValue;
10897 break;
10898 case "ReadOnly":
10899 security = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
10900 break;
10901 case "ShortNames":
10902 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
10903 {
10904 sourceBits = sourceBits | 1;
10905 this.useShortFileNames = true;
10906 }
10907 break;
10908 case "SummaryCodepage":
10909 codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib, true);
10910 break;
10911 default:
10912 this.Core.UnexpectedAttribute(node, attrib);
10913 break;
10920 } 10914 }
10921 } 10915 }
10922 else 10916 else
@@ -11024,15 +11018,15 @@ namespace WixToolset.Core
11024 row.Set(0, 19); 11018 row.Set(0, 19);
11025 switch (security) 11019 switch (security)
11026 { 11020 {
11027 case YesNoDefaultType.No: // no restriction 11021 case YesNoDefaultType.No: // no restriction
11028 row.Set(1, "0"); 11022 row.Set(1, "0");
11029 break; 11023 break;
11030 case YesNoDefaultType.Default: // read-only recommended 11024 case YesNoDefaultType.Default: // read-only recommended
11031 row.Set(1, "2"); 11025 row.Set(1, "2");
11032 break; 11026 break;
11033 case YesNoDefaultType.Yes: // read-only enforced 11027 case YesNoDefaultType.Yes: // read-only enforced
11034 row.Set(1, "4"); 11028 row.Set(1, "4");
11035 break; 11029 break;
11036 } 11030 }
11037 } 11031 }
11038 } 11032 }
@@ -11043,8 +11037,8 @@ namespace WixToolset.Core
11043 /// <param name="node">Element to parse.</param> 11037 /// <param name="node">Element to parse.</param>
11044 private void ParsePatchMetadataElement(XElement node) 11038 private void ParsePatchMetadataElement(XElement node)
11045 { 11039 {
11046 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 11040 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
11047 YesNoType allowRemoval = YesNoType.NotSet; 11041 var allowRemoval = YesNoType.NotSet;
11048 string classification = null; 11042 string classification = null;
11049 string creationTimeUtc = null; 11043 string creationTimeUtc = null;
11050 string description = null; 11044 string description = null;
@@ -11052,49 +11046,49 @@ namespace WixToolset.Core
11052 string manufacturerName = null; 11046 string manufacturerName = null;
11053 string minorUpdateTargetRTM = null; 11047 string minorUpdateTargetRTM = null;
11054 string moreInfoUrl = null; 11048 string moreInfoUrl = null;
11055 int optimizeCA = CompilerConstants.IntegerNotSet; 11049 var optimizeCA = CompilerConstants.IntegerNotSet;
11056 YesNoType optimizedInstallMode = YesNoType.NotSet; 11050 var optimizedInstallMode = YesNoType.NotSet;
11057 string targetProductName = null; 11051 string targetProductName = null;
11058 11052
11059 foreach (XAttribute attrib in node.Attributes()) 11053 foreach (var attrib in node.Attributes())
11060 { 11054 {
11061 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 11055 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
11062 { 11056 {
11063 switch (attrib.Name.LocalName) 11057 switch (attrib.Name.LocalName)
11064 { 11058 {
11065 case "AllowRemoval": 11059 case "AllowRemoval":
11066 allowRemoval = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 11060 allowRemoval = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
11067 break; 11061 break;
11068 case "Classification": 11062 case "Classification":
11069 classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11063 classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11070 break; 11064 break;
11071 case "CreationTimeUTC": 11065 case "CreationTimeUTC":
11072 creationTimeUtc = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11066 creationTimeUtc = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11073 break; 11067 break;
11074 case "Description": 11068 case "Description":
11075 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11069 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11076 break; 11070 break;
11077 case "DisplayName": 11071 case "DisplayName":
11078 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11072 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11079 break; 11073 break;
11080 case "ManufacturerName": 11074 case "ManufacturerName":
11081 manufacturerName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11075 manufacturerName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11082 break; 11076 break;
11083 case "MinorUpdateTargetRTM": 11077 case "MinorUpdateTargetRTM":
11084 minorUpdateTargetRTM = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11078 minorUpdateTargetRTM = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11085 break; 11079 break;
11086 case "MoreInfoURL": 11080 case "MoreInfoURL":
11087 moreInfoUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11081 moreInfoUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11088 break; 11082 break;
11089 case "OptimizedInstallMode": 11083 case "OptimizedInstallMode":
11090 optimizedInstallMode = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 11084 optimizedInstallMode = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
11091 break; 11085 break;
11092 case "TargetProductName": 11086 case "TargetProductName":
11093 targetProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11087 targetProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11094 break; 11088 break;
11095 default: 11089 default:
11096 this.Core.UnexpectedAttribute(node, attrib); 11090 this.Core.UnexpectedAttribute(node, attrib);
11097 break; 11091 break;
11098 } 11092 }
11099 } 11093 }
11100 else 11094 else
@@ -11138,21 +11132,21 @@ namespace WixToolset.Core
11138 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "TargetProductName")); 11132 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "TargetProductName"));
11139 } 11133 }
11140 11134
11141 foreach (XElement child in node.Elements()) 11135 foreach (var child in node.Elements())
11142 { 11136 {
11143 if (CompilerCore.WixNamespace == child.Name.Namespace) 11137 if (CompilerCore.WixNamespace == child.Name.Namespace)
11144 { 11138 {
11145 switch (child.Name.LocalName) 11139 switch (child.Name.LocalName)
11146 { 11140 {
11147 case "CustomProperty": 11141 case "CustomProperty":
11148 this.ParseCustomPropertyElement(child); 11142 this.ParseCustomPropertyElement(child);
11149 break; 11143 break;
11150 case "OptimizeCustomActions": 11144 case "OptimizeCustomActions":
11151 optimizeCA = this.ParseOptimizeCustomActionsElement(child); 11145 optimizeCA = this.ParseOptimizeCustomActionsElement(child);
11152 break; 11146 break;
11153 default: 11147 default:
11154 this.Core.UnexpectedElement(node, child); 11148 this.Core.UnexpectedElement(node, child);
11155 break; 11149 break;
11156 } 11150 }
11157 } 11151 }
11158 else 11152 else
@@ -11248,29 +11242,29 @@ namespace WixToolset.Core
11248 /// <param name="node">Element to parse.</param> 11242 /// <param name="node">Element to parse.</param>
11249 private void ParseCustomPropertyElement(XElement node) 11243 private void ParseCustomPropertyElement(XElement node)
11250 { 11244 {
11251 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 11245 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
11252 string company = null; 11246 string company = null;
11253 string property = null; 11247 string property = null;
11254 string value = null; 11248 string value = null;
11255 11249
11256 foreach (XAttribute attrib in node.Attributes()) 11250 foreach (var attrib in node.Attributes())
11257 { 11251 {
11258 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 11252 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
11259 { 11253 {
11260 switch (attrib.Name.LocalName) 11254 switch (attrib.Name.LocalName)
11261 { 11255 {
11262 case "Company": 11256 case "Company":
11263 company = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11257 company = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11264 break; 11258 break;
11265 case "Property": 11259 case "Property":
11266 property = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11260 property = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11267 break; 11261 break;
11268 case "Value": 11262 case "Value":
11269 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11263 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11270 break; 11264 break;
11271 default: 11265 default:
11272 this.Core.UnexpectedAttribute(node, attrib); 11266 this.Core.UnexpectedAttribute(node, attrib);
11273 break; 11267 break;
11274 } 11268 }
11275 } 11269 }
11276 else 11270 else
@@ -11312,36 +11306,36 @@ namespace WixToolset.Core
11312 /// <returns>The combined integer value for callers to store as appropriate.</returns> 11306 /// <returns>The combined integer value for callers to store as appropriate.</returns>
11313 private int ParseOptimizeCustomActionsElement(XElement node) 11307 private int ParseOptimizeCustomActionsElement(XElement node)
11314 { 11308 {
11315 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 11309 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
11316 OptimizeCA optimizeCA = OptimizeCA.None; 11310 var optimizeCA = OptimizeCA.None;
11317 11311
11318 foreach (XAttribute attrib in node.Attributes()) 11312 foreach (var attrib in node.Attributes())
11319 { 11313 {
11320 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 11314 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
11321 { 11315 {
11322 switch (attrib.Name.LocalName) 11316 switch (attrib.Name.LocalName)
11323 { 11317 {
11324 case "SkipAssignment": 11318 case "SkipAssignment":
11325 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 11319 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
11326 { 11320 {
11327 optimizeCA |= OptimizeCA.SkipAssignment; 11321 optimizeCA |= OptimizeCA.SkipAssignment;
11328 } 11322 }
11329 break; 11323 break;
11330 case "SkipImmediate": 11324 case "SkipImmediate":
11331 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 11325 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
11332 { 11326 {
11333 optimizeCA |= OptimizeCA.SkipImmediate; 11327 optimizeCA |= OptimizeCA.SkipImmediate;
11334 } 11328 }
11335 break; 11329 break;
11336 case "SkipDeferred": 11330 case "SkipDeferred":
11337 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 11331 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
11338 { 11332 {
11339 optimizeCA |= OptimizeCA.SkipDeferred; 11333 optimizeCA |= OptimizeCA.SkipDeferred;
11340 } 11334 }
11341 break; 11335 break;
11342 default: 11336 default:
11343 this.Core.UnexpectedAttribute(node, attrib); 11337 this.Core.UnexpectedAttribute(node, attrib);
11344 break; 11338 break;
11345 } 11339 }
11346 } 11340 }
11347 else 11341 else
@@ -11359,57 +11353,57 @@ namespace WixToolset.Core
11359 /// <param name="node">Element to parse.</param> 11353 /// <param name="node">Element to parse.</param>
11360 private void ParsePatchInformationElement(XElement node) 11354 private void ParsePatchInformationElement(XElement node)
11361 { 11355 {
11362 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 11356 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
11363 string codepage = "1252"; 11357 var codepage = "1252";
11364 string comments = null; 11358 string comments = null;
11365 string keywords = "Installer,Patching,PCP,Database"; 11359 var keywords = "Installer,Patching,PCP,Database";
11366 int msiVersion = 1; // Should always be 1 for patches 11360 var msiVersion = 1; // Should always be 1 for patches
11367 string packageAuthor = null; 11361 string packageAuthor = null;
11368 string packageName = this.activeName; 11362 var packageName = this.activeName;
11369 YesNoDefaultType security = YesNoDefaultType.Default; 11363 var security = YesNoDefaultType.Default;
11370 11364
11371 foreach (XAttribute attrib in node.Attributes()) 11365 foreach (var attrib in node.Attributes())
11372 { 11366 {
11373 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 11367 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
11374 { 11368 {
11375 switch (attrib.Name.LocalName) 11369 switch (attrib.Name.LocalName)
11376 { 11370 {
11377 case "AdminImage": 11371 case "AdminImage":
11378 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 11372 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
11379 break; 11373 break;
11380 case "Comments": 11374 case "Comments":
11381 comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11375 comments = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11382 break; 11376 break;
11383 case "Compressed": 11377 case "Compressed":
11384 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 11378 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
11385 break; 11379 break;
11386 case "Description": 11380 case "Description":
11387 packageName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11381 packageName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11388 break; 11382 break;
11389 case "Keywords": 11383 case "Keywords":
11390 keywords = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11384 keywords = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11391 break; 11385 break;
11392 case "Languages": 11386 case "Languages":
11393 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 11387 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
11394 break; 11388 break;
11395 case "Manufacturer": 11389 case "Manufacturer":
11396 packageAuthor = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11390 packageAuthor = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11397 break; 11391 break;
11398 case "Platforms": 11392 case "Platforms":
11399 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 11393 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
11400 break; 11394 break;
11401 case "ReadOnly": 11395 case "ReadOnly":
11402 security = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); 11396 security = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
11403 break; 11397 break;
11404 case "ShortNames": 11398 case "ShortNames":
11405 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 11399 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
11406 break; 11400 break;
11407 case "SummaryCodepage": 11401 case "SummaryCodepage":
11408 codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib); 11402 codepage = this.Core.GetAttributeLocalizableCodePageValue(sourceLineNumbers, attrib);
11409 break; 11403 break;
11410 default: 11404 default:
11411 this.Core.UnexpectedAttribute(node, attrib); 11405 this.Core.UnexpectedAttribute(node, attrib);
11412 break; 11406 break;
11413 } 11407 }
11414 } 11408 }
11415 else 11409 else
@@ -11479,15 +11473,15 @@ namespace WixToolset.Core
11479 row.Set(0, 19); 11473 row.Set(0, 19);
11480 switch (security) 11474 switch (security)
11481 { 11475 {
11482 case YesNoDefaultType.No: // no restriction 11476 case YesNoDefaultType.No: // no restriction
11483 row.Set(1, "0"); 11477 row.Set(1, "0");
11484 break; 11478 break;
11485 case YesNoDefaultType.Default: // read-only recommended 11479 case YesNoDefaultType.Default: // read-only recommended
11486 row.Set(1, "2"); 11480 row.Set(1, "2");
11487 break; 11481 break;
11488 case YesNoDefaultType.Yes: // read-only enforced 11482 case YesNoDefaultType.Yes: // read-only enforced
11489 row.Set(1, "4"); 11483 row.Set(1, "4");
11490 break; 11484 break;
11491 } 11485 }
11492 } 11486 }
11493 } 11487 }
@@ -11498,26 +11492,26 @@ namespace WixToolset.Core
11498 /// <param name="node">XmlNode on an IgnoreModulatization element.</param> 11492 /// <param name="node">XmlNode on an IgnoreModulatization element.</param>
11499 private void ParseIgnoreModularizationElement(XElement node) 11493 private void ParseIgnoreModularizationElement(XElement node)
11500 { 11494 {
11501 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 11495 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
11502 string name = null; 11496 string name = null;
11503 11497
11504 this.Core.Write(WarningMessages.DeprecatedIgnoreModularizationElement(sourceLineNumbers)); 11498 this.Core.Write(WarningMessages.DeprecatedIgnoreModularizationElement(sourceLineNumbers));
11505 11499
11506 foreach (XAttribute attrib in node.Attributes()) 11500 foreach (var attrib in node.Attributes())
11507 { 11501 {
11508 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 11502 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
11509 { 11503 {
11510 switch (attrib.Name.LocalName) 11504 switch (attrib.Name.LocalName)
11511 { 11505 {
11512 case "Name": 11506 case "Name":
11513 name = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 11507 name = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
11514 break; 11508 break;
11515 case "Type": 11509 case "Type":
11516 // this is actually not used 11510 // this is actually not used
11517 break; 11511 break;
11518 default: 11512 default:
11519 this.Core.UnexpectedAttribute(node, attrib); 11513 this.Core.UnexpectedAttribute(node, attrib);
11520 break; 11514 break;
11521 } 11515 }
11522 } 11516 }
11523 else 11517 else
@@ -11548,63 +11542,63 @@ namespace WixToolset.Core
11548 /// <param name="tableName">Name of table that contains objectId.</param> 11542 /// <param name="tableName">Name of table that contains objectId.</param>
11549 private void ParsePermissionElement(XElement node, string objectId, string tableName) 11543 private void ParsePermissionElement(XElement node, string objectId, string tableName)
11550 { 11544 {
11551 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 11545 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
11552 BitArray bits = new BitArray(32); 11546 var bits = new BitArray(32);
11553 string domain = null; 11547 string domain = null;
11554 int permission = 0; 11548 var permission = 0;
11555 string[] specialPermissions = null; 11549 string[] specialPermissions = null;
11556 string user = null; 11550 string user = null;
11557 11551
11558 switch (tableName) 11552 switch (tableName)
11559 { 11553 {
11560 case "CreateFolder": 11554 case "CreateFolder":
11561 specialPermissions = Common.FolderPermissions; 11555 specialPermissions = Common.FolderPermissions;
11562 break; 11556 break;
11563 case "File": 11557 case "File":
11564 specialPermissions = Common.FilePermissions; 11558 specialPermissions = Common.FilePermissions;
11565 break; 11559 break;
11566 case "Registry": 11560 case "Registry":
11567 specialPermissions = Common.RegistryPermissions; 11561 specialPermissions = Common.RegistryPermissions;
11568 break; 11562 break;
11569 default: 11563 default:
11570 this.Core.UnexpectedElement(node.Parent, node); 11564 this.Core.UnexpectedElement(node.Parent, node);
11571 return; // stop processing this element since no valid permissions are available 11565 return; // stop processing this element since no valid permissions are available
11572 } 11566 }
11573 11567
11574 foreach (XAttribute attrib in node.Attributes()) 11568 foreach (var attrib in node.Attributes())
11575 { 11569 {
11576 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 11570 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
11577 { 11571 {
11578 switch (attrib.Name.LocalName) 11572 switch (attrib.Name.LocalName)
11579 { 11573 {
11580 case "Domain": 11574 case "Domain":
11581 domain = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11575 domain = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11582 break; 11576 break;
11583 case "User": 11577 case "User":
11584 user = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11578 user = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11585 break; 11579 break;
11586 case "FileAllRights": 11580 case "FileAllRights":
11587 // match the WinNT.h mask FILE_ALL_ACCESS for value 0x001F01FF (aka 1 1111 0000 0001 1111 1111 or 2032127) 11581 // match the WinNT.h mask FILE_ALL_ACCESS for value 0x001F01FF (aka 1 1111 0000 0001 1111 1111 or 2032127)
11588 bits[0] = bits[1] = bits[2] = bits[3] = bits[4] = bits[5] = bits[6] = bits[7] = bits[8] = bits[16] = bits[17] = bits[18] = bits[19] = bits[20] = true; 11582 bits[0] = bits[1] = bits[2] = bits[3] = bits[4] = bits[5] = bits[6] = bits[7] = bits[8] = bits[16] = bits[17] = bits[18] = bits[19] = bits[20] = true;
11589 break; 11583 break;
11590 case "SpecificRightsAll": 11584 case "SpecificRightsAll":
11591 // match the WinNT.h mask SPECIFIC_RIGHTS_ALL for value 0x0000FFFF (aka 1111 1111 1111 1111) 11585 // match the WinNT.h mask SPECIFIC_RIGHTS_ALL for value 0x0000FFFF (aka 1111 1111 1111 1111)
11592 bits[0] = bits[1] = bits[2] = bits[3] = bits[4] = bits[5] = bits[6] = bits[7] = bits[8] = bits[9] = bits[10] = bits[11] = bits[12] = bits[13] = bits[14] = bits[15] = true; 11586 bits[0] = bits[1] = bits[2] = bits[3] = bits[4] = bits[5] = bits[6] = bits[7] = bits[8] = bits[9] = bits[10] = bits[11] = bits[12] = bits[13] = bits[14] = bits[15] = true;
11593 break; 11587 break;
11594 default: 11588 default:
11595 YesNoType attribValue = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 11589 var attribValue = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
11596 if (!this.Core.TrySetBitFromName(Common.StandardPermissions, attrib.Name.LocalName, attribValue, bits, 16)) 11590 if (!this.Core.TrySetBitFromName(Common.StandardPermissions, attrib.Name.LocalName, attribValue, bits, 16))
11591 {
11592 if (!this.Core.TrySetBitFromName(Common.GenericPermissions, attrib.Name.LocalName, attribValue, bits, 28))
11597 { 11593 {
11598 if (!this.Core.TrySetBitFromName(Common.GenericPermissions, attrib.Name.LocalName, attribValue, bits, 28)) 11594 if (!this.Core.TrySetBitFromName(specialPermissions, attrib.Name.LocalName, attribValue, bits, 0))
11599 { 11595 {
11600 if (!this.Core.TrySetBitFromName(specialPermissions, attrib.Name.LocalName, attribValue, bits, 0)) 11596 this.Core.UnexpectedAttribute(node, attrib);
11601 { 11597 break;
11602 this.Core.UnexpectedAttribute(node, attrib);
11603 break;
11604 }
11605 } 11598 }
11606 } 11599 }
11607 break; 11600 }
11601 break;
11608 } 11602 }
11609 } 11603 }
11610 else 11604 else
@@ -11620,7 +11614,7 @@ namespace WixToolset.Core
11620 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "User")); 11614 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "User"));
11621 } 11615 }
11622 11616
11623 if (int.MinValue == permission) // just GENERIC_READ, which is MSI_NULL 11617 if (Int32.MinValue == permission) // just GENERIC_READ, which is MSI_NULL
11624 { 11618 {
11625 this.Core.Write(ErrorMessages.GenericReadNotAllowed(sourceLineNumbers)); 11619 this.Core.Write(ErrorMessages.GenericReadNotAllowed(sourceLineNumbers));
11626 } 11620 }
@@ -11646,38 +11640,38 @@ namespace WixToolset.Core
11646 /// <param name="tableName">Name of table that contains objectId.</param> 11640 /// <param name="tableName">Name of table that contains objectId.</param>
11647 private void ParsePermissionExElement(XElement node, string objectId, string tableName) 11641 private void ParsePermissionExElement(XElement node, string objectId, string tableName)
11648 { 11642 {
11649 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 11643 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
11650 string condition = null; 11644 string condition = null;
11651 Identifier id = null; 11645 Identifier id = null;
11652 string sddl = null; 11646 string sddl = null;
11653 11647
11654 switch (tableName) 11648 switch (tableName)
11655 { 11649 {
11656 case "CreateFolder": 11650 case "CreateFolder":
11657 case "File": 11651 case "File":
11658 case "Registry": 11652 case "Registry":
11659 case "ServiceInstall": 11653 case "ServiceInstall":
11660 break; 11654 break;
11661 default: 11655 default:
11662 this.Core.UnexpectedElement(node.Parent, node); 11656 this.Core.UnexpectedElement(node.Parent, node);
11663 return; // stop processing this element since nothing will be valid. 11657 return; // stop processing this element since nothing will be valid.
11664 } 11658 }
11665 11659
11666 foreach (XAttribute attrib in node.Attributes()) 11660 foreach (var attrib in node.Attributes())
11667 { 11661 {
11668 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 11662 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
11669 { 11663 {
11670 switch (attrib.Name.LocalName) 11664 switch (attrib.Name.LocalName)
11671 { 11665 {
11672 case "Id": 11666 case "Id":
11673 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 11667 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
11674 break; 11668 break;
11675 case "Sddl": 11669 case "Sddl":
11676 sddl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 11670 sddl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
11677 break; 11671 break;
11678 default: 11672 default:
11679 this.Core.UnexpectedAttribute(node, attrib); 11673 this.Core.UnexpectedAttribute(node, attrib);
11680 break; 11674 break;
11681 } 11675 }
11682 } 11676 }
11683 else 11677 else
@@ -11696,24 +11690,24 @@ namespace WixToolset.Core
11696 id = this.Core.CreateIdentifier("pme", objectId, tableName, sddl); 11690 id = this.Core.CreateIdentifier("pme", objectId, tableName, sddl);
11697 } 11691 }
11698 11692
11699 foreach (XElement child in node.Elements()) 11693 foreach (var child in node.Elements())
11700 { 11694 {
11701 if (CompilerCore.WixNamespace == child.Name.Namespace) 11695 if (CompilerCore.WixNamespace == child.Name.Namespace)
11702 { 11696 {
11703 switch (child.Name.LocalName) 11697 switch (child.Name.LocalName)
11704 { 11698 {
11705 case "Condition": 11699 case "Condition":
11706 if (null != condition) 11700 if (null != condition)
11707 { 11701 {
11708 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 11702 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
11709 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); 11703 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName));
11710 } 11704 }
11711 11705
11712 condition = this.ParseConditionElement(child, node.Name.LocalName, null, null); 11706 condition = this.ParseConditionElement(child, node.Name.LocalName, null, null);
11713 break; 11707 break;
11714 default: 11708 default:
11715 this.Core.UnexpectedElement(node, child); 11709 this.Core.UnexpectedElement(node, child);
11716 break; 11710 break;
11717 } 11711 }
11718 } 11712 }
11719 else 11713 else
@@ -11739,8 +11733,8 @@ namespace WixToolset.Core
11739 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 11733 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
11740 private void ParseProductElement(XElement node) 11734 private void ParseProductElement(XElement node)
11741 { 11735 {
11742 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 11736 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
11743 int codepage = 65001; 11737 var codepage = 65001;
11744 string productCode = null; 11738 string productCode = null;
11745 string upgradeCode = null; 11739 string upgradeCode = null;
11746 string manufacturer = null; 11740 string manufacturer = null;
@@ -11750,48 +11744,48 @@ namespace WixToolset.Core
11750 this.activeName = null; 11744 this.activeName = null;
11751 this.activeLanguage = null; 11745 this.activeLanguage = null;
11752 11746
11753 foreach (XAttribute attrib in node.Attributes()) 11747 foreach (var attrib in node.Attributes())
11754 { 11748 {
11755 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 11749 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
11756 { 11750 {
11757 switch (attrib.Name.LocalName) 11751 switch (attrib.Name.LocalName)
11758 { 11752 {
11759 case "Id": 11753 case "Id":
11760 productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true); 11754 productCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, true);
11761 break; 11755 break;
11762 case "Codepage": 11756 case "Codepage":
11763 codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib); 11757 codepage = this.Core.GetAttributeCodePageValue(sourceLineNumbers, attrib);
11764 break; 11758 break;
11765 case "Language": 11759 case "Language":
11766 this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 11760 this.activeLanguage = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
11767 break; 11761 break;
11768 case "Manufacturer": 11762 case "Manufacturer":
11769 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters); 11763 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters);
11770 if ("PUT-COMPANY-NAME-HERE" == manufacturer) 11764 if ("PUT-COMPANY-NAME-HERE" == manufacturer)
11771 { 11765 {
11772 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, manufacturer)); 11766 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, manufacturer));
11773 } 11767 }
11774 break; 11768 break;
11775 case "Name": 11769 case "Name":
11776 this.activeName = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters); 11770 this.activeName = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.MustHaveNonWhitespaceCharacters);
11777 if ("PUT-PRODUCT-NAME-HERE" == this.activeName) 11771 if ("PUT-PRODUCT-NAME-HERE" == this.activeName)
11778 { 11772 {
11779 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName)); 11773 this.Core.Write(WarningMessages.PlaceholderValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, this.activeName));
11780 } 11774 }
11781 break; 11775 break;
11782 case "UpgradeCode": 11776 case "UpgradeCode":
11783 upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 11777 upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
11784 break; 11778 break;
11785 case "Version": // if the attribute is valid version, use the attribute value as is (so "1.0000.01.01" would *not* get translated to "1.0.1.1"). 11779 case "Version": // if the attribute is valid version, use the attribute value as is (so "1.0000.01.01" would *not* get translated to "1.0.1.1").
11786 string verifiedVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); 11780 var verifiedVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
11787 if (!String.IsNullOrEmpty(verifiedVersion)) 11781 if (!String.IsNullOrEmpty(verifiedVersion))
11788 { 11782 {
11789 version = attrib.Value; 11783 version = attrib.Value;
11790 } 11784 }
11791 break; 11785 break;
11792 default: 11786 default:
11793 this.Core.UnexpectedAttribute(node, attrib); 11787 this.Core.UnexpectedAttribute(node, attrib);
11794 break; 11788 break;
11795 } 11789 }
11796 } 11790 }
11797 else 11791 else
@@ -11854,141 +11848,143 @@ namespace WixToolset.Core
11854 this.AddProperty(sourceLineNumbers, new Identifier("UpgradeCode", AccessModifier.Public), upgradeCode, false, false, false, true); 11848 this.AddProperty(sourceLineNumbers, new Identifier("UpgradeCode", AccessModifier.Public), upgradeCode, false, false, false, true);
11855 } 11849 }
11856 11850
11857 Dictionary<string, string> contextValues = new Dictionary<string, string>(); 11851 var contextValues = new Dictionary<string, string>
11858 contextValues["ProductLanguage"] = this.activeLanguage; 11852 {
11859 contextValues["ProductVersion"] = version; 11853 ["ProductLanguage"] = this.activeLanguage,
11860 contextValues["UpgradeCode"] = upgradeCode; 11854 ["ProductVersion"] = version,
11855 ["UpgradeCode"] = upgradeCode
11856 };
11861 11857
11862 int featureDisplay = 0; 11858 var featureDisplay = 0;
11863 foreach (XElement child in node.Elements()) 11859 foreach (var child in node.Elements())
11864 { 11860 {
11865 if (CompilerCore.WixNamespace == child.Name.Namespace) 11861 if (CompilerCore.WixNamespace == child.Name.Namespace)
11866 { 11862 {
11867 switch (child.Name.LocalName) 11863 switch (child.Name.LocalName)
11868 { 11864 {
11869 case "_locDefinition": 11865 case "_locDefinition":
11870 break; 11866 break;
11871 case "AdminExecuteSequence": 11867 case "AdminExecuteSequence":
11872 case "AdminUISequence": 11868 case "AdminUISequence":
11873 case "AdvertiseExecuteSequence": 11869 case "AdvertiseExecuteSequence":
11874 case "InstallExecuteSequence": 11870 case "InstallExecuteSequence":
11875 case "InstallUISequence": 11871 case "InstallUISequence":
11876 this.ParseSequenceElement(child, child.Name.LocalName); 11872 this.ParseSequenceElement(child, child.Name.LocalName);
11877 break; 11873 break;
11878 case "AppId": 11874 case "AppId":
11879 this.ParseAppIdElement(child, null, YesNoType.Yes, null, null, null); 11875 this.ParseAppIdElement(child, null, YesNoType.Yes, null, null, null);
11880 break; 11876 break;
11881 case "Binary": 11877 case "Binary":
11882 this.ParseBinaryElement(child); 11878 this.ParseBinaryElement(child);
11883 break; 11879 break;
11884 case "ComplianceCheck": 11880 case "ComplianceCheck":
11885 this.ParseComplianceCheckElement(child); 11881 this.ParseComplianceCheckElement(child);
11886 break; 11882 break;
11887 case "Component": 11883 case "Component":
11888 this.ParseComponentElement(child, ComplexReferenceParentType.Unknown, null, null, CompilerConstants.IntegerNotSet, null, null); 11884 this.ParseComponentElement(child, ComplexReferenceParentType.Unknown, null, null, CompilerConstants.IntegerNotSet, null, null);
11889 break; 11885 break;
11890 case "ComponentGroup": 11886 case "ComponentGroup":
11891 this.ParseComponentGroupElement(child, ComplexReferenceParentType.Unknown, null); 11887 this.ParseComponentGroupElement(child, ComplexReferenceParentType.Unknown, null);
11892 break; 11888 break;
11893 case "Condition": 11889 case "Condition":
11894 this.ParseConditionElement(child, node.Name.LocalName, null, null); 11890 this.ParseConditionElement(child, node.Name.LocalName, null, null);
11895 break; 11891 break;
11896 case "CustomAction": 11892 case "CustomAction":
11897 this.ParseCustomActionElement(child); 11893 this.ParseCustomActionElement(child);
11898 break; 11894 break;
11899 case "CustomActionRef": 11895 case "CustomActionRef":
11900 this.ParseSimpleRefElement(child, "CustomAction"); 11896 this.ParseSimpleRefElement(child, "CustomAction");
11901 break; 11897 break;
11902 case "CustomTable": 11898 case "CustomTable":
11903 this.ParseCustomTableElement(child); 11899 this.ParseCustomTableElement(child);
11904 break; 11900 break;
11905 case "Directory": 11901 case "Directory":
11906 this.ParseDirectoryElement(child, null, CompilerConstants.IntegerNotSet, String.Empty); 11902 this.ParseDirectoryElement(child, null, CompilerConstants.IntegerNotSet, String.Empty);
11907 break; 11903 break;
11908 case "DirectoryRef": 11904 case "DirectoryRef":
11909 this.ParseDirectoryRefElement(child); 11905 this.ParseDirectoryRefElement(child);
11910 break; 11906 break;
11911 case "EmbeddedChainer": 11907 case "EmbeddedChainer":
11912 this.ParseEmbeddedChainerElement(child); 11908 this.ParseEmbeddedChainerElement(child);
11913 break; 11909 break;
11914 case "EmbeddedChainerRef": 11910 case "EmbeddedChainerRef":
11915 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer"); 11911 this.ParseSimpleRefElement(child, "MsiEmbeddedChainer");
11916 break; 11912 break;
11917 case "EnsureTable": 11913 case "EnsureTable":
11918 this.ParseEnsureTableElement(child); 11914 this.ParseEnsureTableElement(child);
11919 break; 11915 break;
11920 case "Feature": 11916 case "Feature":
11921 this.ParseFeatureElement(child, ComplexReferenceParentType.Product, productCode, ref featureDisplay); 11917 this.ParseFeatureElement(child, ComplexReferenceParentType.Product, productCode, ref featureDisplay);
11922 break; 11918 break;
11923 case "FeatureRef": 11919 case "FeatureRef":
11924 this.ParseFeatureRefElement(child, ComplexReferenceParentType.Product, productCode); 11920 this.ParseFeatureRefElement(child, ComplexReferenceParentType.Product, productCode);
11925 break; 11921 break;
11926 case "FeatureGroupRef": 11922 case "FeatureGroupRef":
11927 this.ParseFeatureGroupRefElement(child, ComplexReferenceParentType.Product, productCode); 11923 this.ParseFeatureGroupRefElement(child, ComplexReferenceParentType.Product, productCode);
11928 break; 11924 break;
11929 case "Icon": 11925 case "Icon":
11930 this.ParseIconElement(child); 11926 this.ParseIconElement(child);
11931 break; 11927 break;
11932 case "InstanceTransforms": 11928 case "InstanceTransforms":
11933 this.ParseInstanceTransformsElement(child); 11929 this.ParseInstanceTransformsElement(child);
11934 break; 11930 break;
11935 case "MajorUpgrade": 11931 case "MajorUpgrade":
11936 this.ParseMajorUpgradeElement(child, contextValues); 11932 this.ParseMajorUpgradeElement(child, contextValues);
11937 break; 11933 break;
11938 case "Media": 11934 case "Media":
11939 this.ParseMediaElement(child, null); 11935 this.ParseMediaElement(child, null);
11940 break; 11936 break;
11941 case "MediaTemplate": 11937 case "MediaTemplate":
11942 this.ParseMediaTemplateElement(child, null); 11938 this.ParseMediaTemplateElement(child, null);
11943 break; 11939 break;
11944 case "Package": 11940 case "Package":
11945 this.ParsePackageElement(child, manufacturer, null); 11941 this.ParsePackageElement(child, manufacturer, null);
11946 break; 11942 break;
11947 case "PackageCertificates": 11943 case "PackageCertificates":
11948 case "PatchCertificates": 11944 case "PatchCertificates":
11949 this.ParseCertificatesElement(child); 11945 this.ParseCertificatesElement(child);
11950 break; 11946 break;
11951 case "Property": 11947 case "Property":
11952 this.ParsePropertyElement(child); 11948 this.ParsePropertyElement(child);
11953 break; 11949 break;
11954 case "PropertyRef": 11950 case "PropertyRef":
11955 this.ParseSimpleRefElement(child, "Property"); 11951 this.ParseSimpleRefElement(child, "Property");
11956 break; 11952 break;
11957 case "SetDirectory": 11953 case "SetDirectory":
11958 this.ParseSetDirectoryElement(child); 11954 this.ParseSetDirectoryElement(child);
11959 break; 11955 break;
11960 case "SetProperty": 11956 case "SetProperty":
11961 this.ParseSetPropertyElement(child); 11957 this.ParseSetPropertyElement(child);
11962 break; 11958 break;
11963 case "SFPCatalog": 11959 case "SFPCatalog":
11964 string parentName = null; 11960 string parentName = null;
11965 this.ParseSFPCatalogElement(child, ref parentName); 11961 this.ParseSFPCatalogElement(child, ref parentName);
11966 break; 11962 break;
11967 case "SymbolPath": 11963 case "SymbolPath":
11968 if (null != symbols) 11964 if (null != symbols)
11969 { 11965 {
11970 symbols += ";" + this.ParseSymbolPathElement(child); 11966 symbols += ";" + this.ParseSymbolPathElement(child);
11971 } 11967 }
11972 else 11968 else
11973 { 11969 {
11974 symbols = this.ParseSymbolPathElement(child); 11970 symbols = this.ParseSymbolPathElement(child);
11975 } 11971 }
11976 break; 11972 break;
11977 case "UI": 11973 case "UI":
11978 this.ParseUIElement(child); 11974 this.ParseUIElement(child);
11979 break; 11975 break;
11980 case "UIRef": 11976 case "UIRef":
11981 this.ParseSimpleRefElement(child, "WixUI"); 11977 this.ParseSimpleRefElement(child, "WixUI");
11982 break; 11978 break;
11983 case "Upgrade": 11979 case "Upgrade":
11984 this.ParseUpgradeElement(child); 11980 this.ParseUpgradeElement(child);
11985 break; 11981 break;
11986 case "WixVariable": 11982 case "WixVariable":
11987 this.ParseWixVariableElement(child); 11983 this.ParseWixVariableElement(child);
11988 break; 11984 break;
11989 default: 11985 default:
11990 this.Core.UnexpectedElement(node, child); 11986 this.Core.UnexpectedElement(node, child);
11991 break; 11987 break;
11992 } 11988 }
11993 } 11989 }
11994 else 11990 else
@@ -12028,40 +12024,40 @@ namespace WixToolset.Core
12028 /// <returns>This element's Id.</returns> 12024 /// <returns>This element's Id.</returns>
12029 private string ParseProgIdElement(XElement node, string componentId, YesNoType advertise, string classId, string description, string parent, ref bool foundExtension, YesNoType firstProgIdForClass) 12025 private string ParseProgIdElement(XElement node, string componentId, YesNoType advertise, string classId, string description, string parent, ref bool foundExtension, YesNoType firstProgIdForClass)
12030 { 12026 {
12031 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 12027 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
12032 string icon = null; 12028 string icon = null;
12033 int iconIndex = CompilerConstants.IntegerNotSet; 12029 var iconIndex = CompilerConstants.IntegerNotSet;
12034 string noOpen = null; 12030 string noOpen = null;
12035 string progId = null; 12031 string progId = null;
12036 YesNoType progIdAdvertise = YesNoType.NotSet; 12032 var progIdAdvertise = YesNoType.NotSet;
12037 12033
12038 foreach (XAttribute attrib in node.Attributes()) 12034 foreach (var attrib in node.Attributes())
12039 { 12035 {
12040 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 12036 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
12041 { 12037 {
12042 switch (attrib.Name.LocalName) 12038 switch (attrib.Name.LocalName)
12043 { 12039 {
12044 case "Id": 12040 case "Id":
12045 progId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12041 progId = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12046 break; 12042 break;
12047 case "Advertise": 12043 case "Advertise":
12048 progIdAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 12044 progIdAdvertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12049 break; 12045 break;
12050 case "Description": 12046 case "Description":
12051 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 12047 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
12052 break; 12048 break;
12053 case "Icon": 12049 case "Icon":
12054 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 12050 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
12055 break; 12051 break;
12056 case "IconIndex": 12052 case "IconIndex":
12057 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, short.MinValue + 1, short.MaxValue); 12053 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int16.MinValue + 1, Int16.MaxValue);
12058 break; 12054 break;
12059 case "NoOpen": 12055 case "NoOpen":
12060 noOpen = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 12056 noOpen = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
12061 break; 12057 break;
12062 default: 12058 default:
12063 this.Core.UnexpectedAttribute(node, attrib); 12059 this.Core.UnexpectedAttribute(node, attrib);
12064 break; 12060 break;
12065 } 12061 }
12066 } 12062 }
12067 else 12063 else
@@ -12089,41 +12085,41 @@ namespace WixToolset.Core
12089 this.Core.Write(ErrorMessages.VersionIndependentProgIdsCannotHaveIcons(sourceLineNumbers)); 12085 this.Core.Write(ErrorMessages.VersionIndependentProgIdsCannotHaveIcons(sourceLineNumbers));
12090 } 12086 }
12091 12087
12092 YesNoType firstProgIdForNestedClass = YesNoType.Yes; 12088 var firstProgIdForNestedClass = YesNoType.Yes;
12093 foreach (XElement child in node.Elements()) 12089 foreach (var child in node.Elements())
12094 { 12090 {
12095 if (CompilerCore.WixNamespace == child.Name.Namespace) 12091 if (CompilerCore.WixNamespace == child.Name.Namespace)
12096 { 12092 {
12097 switch (child.Name.LocalName) 12093 switch (child.Name.LocalName)
12098 { 12094 {
12099 case "Extension": 12095 case "Extension":
12100 this.ParseExtensionElement(child, componentId, advertise, progId); 12096 this.ParseExtensionElement(child, componentId, advertise, progId);
12101 foundExtension = true; 12097 foundExtension = true;
12102 break; 12098 break;
12103 case "ProgId": 12099 case "ProgId":
12104 // Only allow one nested ProgId. If we have a child, we should not have a parent. 12100 // Only allow one nested ProgId. If we have a child, we should not have a parent.
12105 if (null == parent) 12101 if (null == parent)
12102 {
12103 if (YesNoType.Yes == advertise)
12106 { 12104 {
12107 if (YesNoType.Yes == advertise) 12105 this.ParseProgIdElement(child, componentId, advertise, null, description, progId, ref foundExtension, firstProgIdForNestedClass);
12108 {
12109 this.ParseProgIdElement(child, componentId, advertise, null, description, progId, ref foundExtension, firstProgIdForNestedClass);
12110 }
12111 else if (YesNoType.No == advertise)
12112 {
12113 this.ParseProgIdElement(child, componentId, advertise, classId, description, progId, ref foundExtension, firstProgIdForNestedClass);
12114 }
12115
12116 firstProgIdForNestedClass = YesNoType.No; // any ProgId after this one is definitely not the first.
12117 } 12106 }
12118 else 12107 else if (YesNoType.No == advertise)
12119 { 12108 {
12120 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 12109 this.ParseProgIdElement(child, componentId, advertise, classId, description, progId, ref foundExtension, firstProgIdForNestedClass);
12121 this.Core.Write(ErrorMessages.ProgIdNestedTooDeep(childSourceLineNumbers));
12122 } 12110 }
12123 break; 12111
12124 default: 12112 firstProgIdForNestedClass = YesNoType.No; // any ProgId after this one is definitely not the first.
12125 this.Core.UnexpectedElement(node, child); 12113 }
12126 break; 12114 else
12115 {
12116 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
12117 this.Core.Write(ErrorMessages.ProgIdNestedTooDeep(childSourceLineNumbers));
12118 }
12119 break;
12120 default:
12121 this.Core.UnexpectedElement(node, child);
12122 break;
12127 } 12123 }
12128 } 12124 }
12129 else 12125 else
@@ -12214,45 +12210,45 @@ namespace WixToolset.Core
12214 /// <param name="node">Element to parse.</param> 12210 /// <param name="node">Element to parse.</param>
12215 private void ParsePropertyElement(XElement node) 12211 private void ParsePropertyElement(XElement node)
12216 { 12212 {
12217 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 12213 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
12218 Identifier id = null; 12214 Identifier id = null;
12219 bool admin = false; 12215 var admin = false;
12220 bool complianceCheck = false; 12216 var complianceCheck = false;
12221 bool hidden = false; 12217 var hidden = false;
12222 bool secure = false; 12218 var secure = false;
12223 YesNoType suppressModularization = YesNoType.NotSet; 12219 var suppressModularization = YesNoType.NotSet;
12224 string value = null; 12220 string value = null;
12225 12221
12226 foreach (XAttribute attrib in node.Attributes()) 12222 foreach (var attrib in node.Attributes())
12227 { 12223 {
12228 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 12224 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
12229 { 12225 {
12230 switch (attrib.Name.LocalName) 12226 switch (attrib.Name.LocalName)
12231 { 12227 {
12232 case "Id": 12228 case "Id":
12233 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 12229 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
12234 break; 12230 break;
12235 case "Admin": 12231 case "Admin":
12236 admin = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 12232 admin = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12237 break; 12233 break;
12238 case "ComplianceCheck": 12234 case "ComplianceCheck":
12239 complianceCheck = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 12235 complianceCheck = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12240 break; 12236 break;
12241 case "Hidden": 12237 case "Hidden":
12242 hidden = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 12238 hidden = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12243 break; 12239 break;
12244 case "Secure": 12240 case "Secure":
12245 secure = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 12241 secure = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12246 break; 12242 break;
12247 case "SuppressModularization": 12243 case "SuppressModularization":
12248 suppressModularization = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 12244 suppressModularization = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12249 break; 12245 break;
12250 case "Value": 12246 case "Value":
12251 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12247 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12252 break; 12248 break;
12253 default: 12249 default:
12254 this.Core.UnexpectedAttribute(node, attrib); 12250 this.Core.UnexpectedAttribute(node, attrib);
12255 break; 12251 break;
12256 } 12252 }
12257 } 12253 }
12258 else 12254 else
@@ -12275,7 +12271,7 @@ namespace WixToolset.Core
12275 this.Core.Write(ErrorMessages.CannotAuthorSpecialProperties(sourceLineNumbers, id.Id)); 12271 this.Core.Write(ErrorMessages.CannotAuthorSpecialProperties(sourceLineNumbers, id.Id));
12276 } 12272 }
12277 12273
12278 string innerText = this.Core.GetTrimmedInnerText(node); 12274 var innerText = this.Core.GetTrimmedInnerText(node);
12279 if (null != value) 12275 if (null != value)
12280 { 12276 {
12281 // cannot specify both the value attribute and inner text 12277 // cannot specify both the value attribute and inner text
@@ -12294,27 +12290,27 @@ namespace WixToolset.Core
12294 this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", value); 12290 this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", value);
12295 } 12291 }
12296 12292
12297 foreach (XElement child in node.Elements()) 12293 foreach (var child in node.Elements())
12298 { 12294 {
12299 if (CompilerCore.WixNamespace == child.Name.Namespace) 12295 if (CompilerCore.WixNamespace == child.Name.Namespace)
12300 { 12296 {
12301 { 12297 {
12302 switch (child.Name.LocalName) 12298 switch (child.Name.LocalName)
12303 { 12299 {
12304 case "ProductSearch": 12300 case "ProductSearch":
12305 this.ParseProductSearchElement(child, id.Id); 12301 this.ParseProductSearchElement(child, id.Id);
12306 secure = true; 12302 secure = true;
12307 break; 12303 break;
12308 default: 12304 default:
12309 // let ParseSearchSignatures handle standard AppSearch children and unknown elements 12305 // let ParseSearchSignatures handle standard AppSearch children and unknown elements
12310 break; 12306 break;
12311 } 12307 }
12312 } 12308 }
12313 } 12309 }
12314 } 12310 }
12315 12311
12316 // see if this property is used for appSearch 12312 // see if this property is used for appSearch
12317 List<string> signatures = this.ParseSearchSignatures(node); 12313 var signatures = this.ParseSearchSignatures(node);
12318 12314
12319 // If we're doing CCP then there must be a signature. 12315 // If we're doing CCP then there must be a signature.
12320 if (complianceCheck && 0 == signatures.Count) 12316 if (complianceCheck && 0 == signatures.Count)
@@ -12322,7 +12318,7 @@ namespace WixToolset.Core
12322 this.Core.Write(ErrorMessages.SearchElementRequiredWithAttribute(sourceLineNumbers, node.Name.LocalName, "ComplianceCheck", "yes")); 12318 this.Core.Write(ErrorMessages.SearchElementRequiredWithAttribute(sourceLineNumbers, node.Name.LocalName, "ComplianceCheck", "yes"));
12323 } 12319 }
12324 12320
12325 foreach (string sig in signatures) 12321 foreach (var sig in signatures)
12326 { 12322 {
12327 if (complianceCheck && !this.Core.EncounteredError) 12323 if (complianceCheck && !this.Core.EncounteredError)
12328 { 12324 {
@@ -12374,73 +12370,73 @@ namespace WixToolset.Core
12374 "Furthermore, there is no security hole here, as the strings won't need to make a round trip")] 12370 "Furthermore, there is no security hole here, as the strings won't need to make a round trip")]
12375 private YesNoType ParseRegistryKeyElement(XElement node, string componentId, int root, string parentKey, bool win64Component, out string possibleKeyPath) 12371 private YesNoType ParseRegistryKeyElement(XElement node, string componentId, int root, string parentKey, bool win64Component, out string possibleKeyPath)
12376 { 12372 {
12377 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 12373 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
12378 Identifier id = null; 12374 Identifier id = null;
12379 string key = parentKey; // default to parent key path 12375 var key = parentKey; // default to parent key path
12380 string action = null; 12376 string action = null;
12381 bool forceCreateOnInstall = false; 12377 var forceCreateOnInstall = false;
12382 bool forceDeleteOnUninstall = false; 12378 var forceDeleteOnUninstall = false;
12383 Wix.RegistryKey.ActionType actionType = Wix.RegistryKey.ActionType.NotSet; 12379 var actionType = Wix.RegistryKey.ActionType.NotSet;
12384 YesNoType keyPath = YesNoType.NotSet; 12380 var keyPath = YesNoType.NotSet;
12385 12381
12386 possibleKeyPath = null; 12382 possibleKeyPath = null;
12387 12383
12388 foreach (XAttribute attrib in node.Attributes()) 12384 foreach (var attrib in node.Attributes())
12389 { 12385 {
12390 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 12386 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
12391 { 12387 {
12392 switch (attrib.Name.LocalName) 12388 switch (attrib.Name.LocalName)
12393 { 12389 {
12394 case "Id": 12390 case "Id":
12395 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 12391 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
12396 break; 12392 break;
12397 case "Action": 12393 case "Action":
12398 this.Core.Write(WarningMessages.DeprecatedRegistryKeyActionAttribute(sourceLineNumbers)); 12394 this.Core.Write(WarningMessages.DeprecatedRegistryKeyActionAttribute(sourceLineNumbers));
12399 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12395 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12400 if (0 < action.Length) 12396 if (0 < action.Length)
12401 { 12397 {
12402 actionType = Wix.RegistryKey.ParseActionType(action); 12398 actionType = Wix.RegistryKey.ParseActionType(action);
12403 switch (actionType) 12399 switch (actionType)
12404 {
12405 case Wix.RegistryKey.ActionType.create:
12406 forceCreateOnInstall = true;
12407 break;
12408 case Wix.RegistryKey.ActionType.createAndRemoveOnUninstall:
12409 forceCreateOnInstall = true;
12410 forceDeleteOnUninstall = true;
12411 break;
12412 case Wix.RegistryKey.ActionType.none:
12413 break;
12414 default:
12415 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "create", "createAndRemoveOnUninstall", "none"));
12416 break;
12417 }
12418 }
12419 break;
12420 case "ForceCreateOnInstall":
12421 forceCreateOnInstall = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12422 break;
12423 case "ForceDeleteOnUninstall":
12424 forceDeleteOnUninstall = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12425 break;
12426 case "Key":
12427 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12428 if (null != parentKey)
12429 {
12430 key = Path.Combine(parentKey, key);
12431 }
12432 break;
12433 case "Root":
12434 if (CompilerConstants.IntegerNotSet != root)
12435 { 12400 {
12436 this.Core.Write(ErrorMessages.RegistryRootInvalid(sourceLineNumbers)); 12401 case Wix.RegistryKey.ActionType.create:
12402 forceCreateOnInstall = true;
12403 break;
12404 case Wix.RegistryKey.ActionType.createAndRemoveOnUninstall:
12405 forceCreateOnInstall = true;
12406 forceDeleteOnUninstall = true;
12407 break;
12408 case Wix.RegistryKey.ActionType.none:
12409 break;
12410 default:
12411 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "create", "createAndRemoveOnUninstall", "none"));
12412 break;
12437 } 12413 }
12414 }
12415 break;
12416 case "ForceCreateOnInstall":
12417 forceCreateOnInstall = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12418 break;
12419 case "ForceDeleteOnUninstall":
12420 forceDeleteOnUninstall = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12421 break;
12422 case "Key":
12423 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12424 if (null != parentKey)
12425 {
12426 key = Path.Combine(parentKey, key);
12427 }
12428 break;
12429 case "Root":
12430 if (CompilerConstants.IntegerNotSet != root)
12431 {
12432 this.Core.Write(ErrorMessages.RegistryRootInvalid(sourceLineNumbers));
12433 }
12438 12434
12439 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); 12435 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true);
12440 break; 12436 break;
12441 default: 12437 default:
12442 this.Core.UnexpectedAttribute(node, attrib); 12438 this.Core.UnexpectedAttribute(node, attrib);
12443 break; 12439 break;
12444 } 12440 }
12445 } 12441 }
12446 else 12442 else
@@ -12449,7 +12445,7 @@ namespace WixToolset.Core
12449 } 12445 }
12450 } 12446 }
12451 12447
12452 string name = forceCreateOnInstall ? (forceDeleteOnUninstall ? "*" : "+") : (forceDeleteOnUninstall ? "-" : null); 12448 var name = forceCreateOnInstall ? (forceDeleteOnUninstall ? "*" : "+") : (forceDeleteOnUninstall ? "-" : null);
12453 12449
12454 if (forceCreateOnInstall || forceDeleteOnUninstall) // generates a Registry row, so an Id must be present 12450 if (forceCreateOnInstall || forceDeleteOnUninstall) // generates a Registry row, so an Id must be present
12455 { 12451 {
@@ -12479,7 +12475,7 @@ namespace WixToolset.Core
12479 key = String.Empty; // set the key to something to prevent null reference exceptions 12475 key = String.Empty; // set the key to something to prevent null reference exceptions
12480 } 12476 }
12481 12477
12482 foreach (XElement child in node.Elements()) 12478 foreach (var child in node.Elements())
12483 { 12479 {
12484 if (CompilerCore.WixNamespace == child.Name.Namespace) 12480 if (CompilerCore.WixNamespace == child.Name.Namespace)
12485 { 12481 {
@@ -12487,60 +12483,60 @@ namespace WixToolset.Core
12487 12483
12488 switch (child.Name.LocalName) 12484 switch (child.Name.LocalName)
12489 { 12485 {
12490 case "RegistryKey": 12486 case "RegistryKey":
12491 if (YesNoType.Yes == this.ParseRegistryKeyElement(child, componentId, root, key, win64Component, out possibleChildKeyPath)) 12487 if (YesNoType.Yes == this.ParseRegistryKeyElement(child, componentId, root, key, win64Component, out possibleChildKeyPath))
12492 { 12488 {
12493 if (YesNoType.Yes == keyPath) 12489 if (YesNoType.Yes == keyPath)
12494 {
12495 this.Core.Write(ErrorMessages.ComponentMultipleKeyPaths(sourceLineNumbers, child.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource"));
12496 }
12497
12498 possibleKeyPath = possibleChildKeyPath; // the child is the key path
12499 keyPath = YesNoType.Yes;
12500 }
12501 else if (null == possibleKeyPath && null != possibleChildKeyPath)
12502 { 12490 {
12503 possibleKeyPath = possibleChildKeyPath; 12491 this.Core.Write(ErrorMessages.ComponentMultipleKeyPaths(sourceLineNumbers, child.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource"));
12504 } 12492 }
12505 break;
12506 case "RegistryValue":
12507 if (YesNoType.Yes == this.ParseRegistryValueElement(child, componentId, root, key, win64Component, out possibleChildKeyPath))
12508 {
12509 if (YesNoType.Yes == keyPath)
12510 {
12511 this.Core.Write(ErrorMessages.ComponentMultipleKeyPaths(sourceLineNumbers, child.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource"));
12512 }
12513 12493
12514 possibleKeyPath = possibleChildKeyPath; // the child is the key path 12494 possibleKeyPath = possibleChildKeyPath; // the child is the key path
12515 keyPath = YesNoType.Yes; 12495 keyPath = YesNoType.Yes;
12516 } 12496 }
12517 else if (null == possibleKeyPath && null != possibleChildKeyPath) 12497 else if (null == possibleKeyPath && null != possibleChildKeyPath)
12518 { 12498 {
12519 possibleKeyPath = possibleChildKeyPath; 12499 possibleKeyPath = possibleChildKeyPath;
12520 } 12500 }
12521 break; 12501 break;
12522 case "Permission": 12502 case "RegistryValue":
12523 if (!forceCreateOnInstall) 12503 if (YesNoType.Yes == this.ParseRegistryValueElement(child, componentId, root, key, win64Component, out possibleChildKeyPath))
12524 { 12504 {
12525 this.Core.Write(ErrorMessages.UnexpectedElementWithAttributeValue(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, "ForceCreateOnInstall", "yes")); 12505 if (YesNoType.Yes == keyPath)
12526 }
12527 this.ParsePermissionElement(child, id.Id, "Registry");
12528 break;
12529 case "PermissionEx":
12530 if (!forceCreateOnInstall)
12531 { 12506 {
12532 this.Core.Write(ErrorMessages.UnexpectedElementWithAttributeValue(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, "ForceCreateOnInstall", "yes")); 12507 this.Core.Write(ErrorMessages.ComponentMultipleKeyPaths(sourceLineNumbers, child.Name.LocalName, "KeyPath", "yes", "File", "RegistryValue", "ODBCDataSource"));
12533 } 12508 }
12534 this.ParsePermissionExElement(child, id.Id, "Registry"); 12509
12535 break; 12510 possibleKeyPath = possibleChildKeyPath; // the child is the key path
12536 default: 12511 keyPath = YesNoType.Yes;
12537 this.Core.UnexpectedElement(node, child); 12512 }
12538 break; 12513 else if (null == possibleKeyPath && null != possibleChildKeyPath)
12514 {
12515 possibleKeyPath = possibleChildKeyPath;
12516 }
12517 break;
12518 case "Permission":
12519 if (!forceCreateOnInstall)
12520 {
12521 this.Core.Write(ErrorMessages.UnexpectedElementWithAttributeValue(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, "ForceCreateOnInstall", "yes"));
12522 }
12523 this.ParsePermissionElement(child, id.Id, "Registry");
12524 break;
12525 case "PermissionEx":
12526 if (!forceCreateOnInstall)
12527 {
12528 this.Core.Write(ErrorMessages.UnexpectedElementWithAttributeValue(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, "ForceCreateOnInstall", "yes"));
12529 }
12530 this.ParsePermissionExElement(child, id.Id, "Registry");
12531 break;
12532 default:
12533 this.Core.UnexpectedElement(node, child);
12534 break;
12539 } 12535 }
12540 } 12536 }
12541 else 12537 else
12542 { 12538 {
12543 Dictionary<string, string> context = new Dictionary<string, string>() { { "RegistryId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } }; 12539 var context = new Dictionary<string, string>() { { "RegistryId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } };
12544 this.Core.ParseExtensionElement(node, child, context); 12540 this.Core.ParseExtensionElement(node, child, context);
12545 } 12541 }
12546 } 12542 }
@@ -12574,83 +12570,83 @@ namespace WixToolset.Core
12574 "Furthermore, there is no security hole here, as the strings won't need to make a round trip")] 12570 "Furthermore, there is no security hole here, as the strings won't need to make a round trip")]
12575 private YesNoType ParseRegistryValueElement(XElement node, string componentId, int root, string parentKey, bool win64Component, out string possibleKeyPath) 12571 private YesNoType ParseRegistryValueElement(XElement node, string componentId, int root, string parentKey, bool win64Component, out string possibleKeyPath)
12576 { 12572 {
12577 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 12573 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
12578 Identifier id = null; 12574 Identifier id = null;
12579 string key = parentKey; // default to parent key path 12575 var key = parentKey; // default to parent key path
12580 string name = null; 12576 string name = null;
12581 string value = null; 12577 string value = null;
12582 string type = null; 12578 string type = null;
12583 Wix.RegistryValue.TypeType typeType = Wix.RegistryValue.TypeType.NotSet; 12579 var typeType = Wix.RegistryValue.TypeType.NotSet;
12584 string action = null; 12580 string action = null;
12585 Wix.RegistryValue.ActionType actionType = Wix.RegistryValue.ActionType.NotSet; 12581 var actionType = Wix.RegistryValue.ActionType.NotSet;
12586 YesNoType keyPath = YesNoType.NotSet; 12582 var keyPath = YesNoType.NotSet;
12587 bool couldBeKeyPath = true; // assume that this is a regular registry key that could become the key path 12583 var couldBeKeyPath = true; // assume that this is a regular registry key that could become the key path
12588 12584
12589 possibleKeyPath = null; 12585 possibleKeyPath = null;
12590 12586
12591 foreach (XAttribute attrib in node.Attributes()) 12587 foreach (var attrib in node.Attributes())
12592 { 12588 {
12593 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 12589 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
12594 { 12590 {
12595 switch (attrib.Name.LocalName) 12591 switch (attrib.Name.LocalName)
12596 { 12592 {
12597 case "Id": 12593 case "Id":
12598 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 12594 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
12599 break; 12595 break;
12600 case "Action": 12596 case "Action":
12601 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12597 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12602 if (0 < action.Length) 12598 if (0 < action.Length)
12599 {
12600 if (!Wix.RegistryValue.TryParseActionType(action, out actionType))
12603 { 12601 {
12604 if (!Wix.RegistryValue.TryParseActionType(action, out actionType)) 12602 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "append", "prepend", "write"));
12605 {
12606 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "append", "prepend", "write"));
12607 }
12608 } 12603 }
12609 break; 12604 }
12610 case "Key": 12605 break;
12611 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12606 case "Key":
12612 if (null != parentKey) 12607 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12608 if (null != parentKey)
12609 {
12610 if (parentKey.EndsWith("\\", StringComparison.Ordinal))
12613 { 12611 {
12614 if (parentKey.EndsWith("\\", StringComparison.Ordinal)) 12612 key = String.Concat(parentKey, key);
12615 {
12616 key = String.Concat(parentKey, key);
12617 }
12618 else
12619 {
12620 key = String.Concat(parentKey, "\\", key);
12621 }
12622 } 12613 }
12623 break; 12614 else
12624 case "KeyPath":
12625 keyPath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12626 break;
12627 case "Name":
12628 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12629 break;
12630 case "Root":
12631 if (CompilerConstants.IntegerNotSet != root)
12632 { 12615 {
12633 this.Core.Write(ErrorMessages.RegistryRootInvalid(sourceLineNumbers)); 12616 key = String.Concat(parentKey, "\\", key);
12634 } 12617 }
12618 }
12619 break;
12620 case "KeyPath":
12621 keyPath = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
12622 break;
12623 case "Name":
12624 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12625 break;
12626 case "Root":
12627 if (CompilerConstants.IntegerNotSet != root)
12628 {
12629 this.Core.Write(ErrorMessages.RegistryRootInvalid(sourceLineNumbers));
12630 }
12635 12631
12636 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); 12632 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true);
12637 break; 12633 break;
12638 case "Type": 12634 case "Type":
12639 type = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12635 type = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12640 if (0 < type.Length) 12636 if (0 < type.Length)
12637 {
12638 if (!Wix.RegistryValue.TryParseTypeType(type, out typeType))
12641 { 12639 {
12642 if (!Wix.RegistryValue.TryParseTypeType(type, out typeType)) 12640 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, type, "binary", "expandable", "integer", "multiString", "string"));
12643 {
12644 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, type, "binary", "expandable", "integer", "multiString", "string"));
12645 }
12646 } 12641 }
12647 break; 12642 }
12648 case "Value": 12643 break;
12649 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 12644 case "Value":
12650 break; 12645 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
12651 default: 12646 break;
12652 this.Core.UnexpectedAttribute(node, attrib); 12647 default:
12653 break; 12648 this.Core.UnexpectedAttribute(node, attrib);
12649 break;
12654 } 12650 }
12655 } 12651 }
12656 else 12652 else
@@ -12686,40 +12682,40 @@ namespace WixToolset.Core
12686 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); 12682 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type"));
12687 } 12683 }
12688 12684
12689 foreach (XElement child in node.Elements()) 12685 foreach (var child in node.Elements())
12690 { 12686 {
12691 if (CompilerCore.WixNamespace == child.Name.Namespace) 12687 if (CompilerCore.WixNamespace == child.Name.Namespace)
12692 { 12688 {
12693 switch (child.Name.LocalName) 12689 switch (child.Name.LocalName)
12694 { 12690 {
12695 case "MultiStringValue": 12691 case "MultiStringValue":
12696 if (Wix.RegistryValue.TypeType.multiString != typeType && null != value) 12692 if (Wix.RegistryValue.TypeType.multiString != typeType && null != value)
12697 { 12693 {
12698 this.Core.Write(ErrorMessages.RegistryMultipleValuesWithoutMultiString(sourceLineNumbers, node.Name.LocalName, "Value", child.Name.LocalName, "Type")); 12694 this.Core.Write(ErrorMessages.RegistryMultipleValuesWithoutMultiString(sourceLineNumbers, node.Name.LocalName, "Value", child.Name.LocalName, "Type"));
12699 } 12695 }
12700 else if (null == value) 12696 else if (null == value)
12701 { 12697 {
12702 value = Common.GetInnerText(child); 12698 value = Common.GetInnerText(child);
12703 } 12699 }
12704 else 12700 else
12705 { 12701 {
12706 value = String.Concat(value, "[~]", Common.GetInnerText(child)); 12702 value = String.Concat(value, "[~]", Common.GetInnerText(child));
12707 } 12703 }
12708 break; 12704 break;
12709 case "Permission": 12705 case "Permission":
12710 this.ParsePermissionElement(child, id.Id, "Registry"); 12706 this.ParsePermissionElement(child, id.Id, "Registry");
12711 break; 12707 break;
12712 case "PermissionEx": 12708 case "PermissionEx":
12713 this.ParsePermissionExElement(child, id.Id, "Registry"); 12709 this.ParsePermissionExElement(child, id.Id, "Registry");
12714 break; 12710 break;
12715 default: 12711 default:
12716 this.Core.UnexpectedElement(node, child); 12712 this.Core.UnexpectedElement(node, child);
12717 break; 12713 break;
12718 } 12714 }
12719 } 12715 }
12720 else 12716 else
12721 { 12717 {
12722 Dictionary<string, string> context = new Dictionary<string, string>() { { "RegistryId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } }; 12718 var context = new Dictionary<string, string>() { { "RegistryId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } };
12723 this.Core.ParseExtensionElement(node, child, context); 12719 this.Core.ParseExtensionElement(node, child, context);
12724 } 12720 }
12725 } 12721 }
@@ -12727,40 +12723,40 @@ namespace WixToolset.Core
12727 12723
12728 switch (typeType) 12724 switch (typeType)
12729 { 12725 {
12730 case Wix.RegistryValue.TypeType.binary: 12726 case Wix.RegistryValue.TypeType.binary:
12731 value = String.Concat("#x", value); 12727 value = String.Concat("#x", value);
12728 break;
12729 case Wix.RegistryValue.TypeType.expandable:
12730 value = String.Concat("#%", value);
12731 break;
12732 case Wix.RegistryValue.TypeType.integer:
12733 value = String.Concat("#", value);
12734 break;
12735 case Wix.RegistryValue.TypeType.multiString:
12736 switch (actionType)
12737 {
12738 case Wix.RegistryValue.ActionType.append:
12739 value = String.Concat("[~]", value);
12732 break; 12740 break;
12733 case Wix.RegistryValue.TypeType.expandable: 12741 case Wix.RegistryValue.ActionType.prepend:
12734 value = String.Concat("#%", value); 12742 value = String.Concat(value, "[~]");
12735 break; 12743 break;
12736 case Wix.RegistryValue.TypeType.integer: 12744 case Wix.RegistryValue.ActionType.write:
12737 value = String.Concat("#", value); 12745 default:
12738 break; 12746 if (null != value && -1 == value.IndexOf("[~]", StringComparison.Ordinal))
12739 case Wix.RegistryValue.TypeType.multiString:
12740 switch (actionType)
12741 {
12742 case Wix.RegistryValue.ActionType.append:
12743 value = String.Concat("[~]", value);
12744 break;
12745 case Wix.RegistryValue.ActionType.prepend:
12746 value = String.Concat(value, "[~]");
12747 break;
12748 case Wix.RegistryValue.ActionType.write:
12749 default:
12750 if (null != value && -1 == value.IndexOf("[~]", StringComparison.Ordinal))
12751 {
12752 value = String.Format(CultureInfo.InvariantCulture, "[~]{0}[~]", value);
12753 }
12754 break;
12755 }
12756 break;
12757 case Wix.RegistryValue.TypeType.@string:
12758 // escape the leading '#' character for string registry keys
12759 if (null != value && value.StartsWith("#", StringComparison.Ordinal))
12760 { 12747 {
12761 value = String.Concat("#", value); 12748 value = String.Format(CultureInfo.InvariantCulture, "[~]{0}[~]", value);
12762 } 12749 }
12763 break; 12750 break;
12751 }
12752 break;
12753 case Wix.RegistryValue.TypeType.@string:
12754 // escape the leading '#' character for string registry keys
12755 if (null != value && value.StartsWith("#", StringComparison.Ordinal))
12756 {
12757 value = String.Concat("#", value);
12758 }
12759 break;
12764 } 12760 }
12765 12761
12766 // value may be set by child MultiStringValue elements, so it must be checked here 12762 // value may be set by child MultiStringValue elements, so it must be checked here
@@ -12804,42 +12800,42 @@ namespace WixToolset.Core
12804 "Furthermore, there is no security hole here, as the strings won't need to make a round trip")] 12800 "Furthermore, there is no security hole here, as the strings won't need to make a round trip")]
12805 private void ParseRemoveRegistryKeyElement(XElement node, string componentId) 12801 private void ParseRemoveRegistryKeyElement(XElement node, string componentId)
12806 { 12802 {
12807 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 12803 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
12808 Identifier id = null; 12804 Identifier id = null;
12809 string action = null; 12805 string action = null;
12810 Wix.RemoveRegistryKey.ActionType actionType = Wix.RemoveRegistryKey.ActionType.NotSet; 12806 var actionType = Wix.RemoveRegistryKey.ActionType.NotSet;
12811 string key = null; 12807 string key = null;
12812 string name = "-"; 12808 var name = "-";
12813 int root = CompilerConstants.IntegerNotSet; 12809 var root = CompilerConstants.IntegerNotSet;
12814 12810
12815 foreach (XAttribute attrib in node.Attributes()) 12811 foreach (var attrib in node.Attributes())
12816 { 12812 {
12817 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 12813 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
12818 { 12814 {
12819 switch (attrib.Name.LocalName) 12815 switch (attrib.Name.LocalName)
12820 { 12816 {
12821 case "Id": 12817 case "Id":
12822 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 12818 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
12823 break; 12819 break;
12824 case "Action": 12820 case "Action":
12825 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12821 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12826 if (0 < action.Length) 12822 if (0 < action.Length)
12823 {
12824 if (!Wix.RemoveRegistryKey.TryParseActionType(action, out actionType))
12827 { 12825 {
12828 if (!Wix.RemoveRegistryKey.TryParseActionType(action, out actionType)) 12826 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "removeOnInstall", "removeOnUninstall"));
12829 {
12830 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, action, "removeOnInstall", "removeOnUninstall"));
12831 }
12832 } 12827 }
12833 break; 12828 }
12834 case "Key": 12829 break;
12835 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12830 case "Key":
12836 break; 12831 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12837 case "Root": 12832 break;
12838 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); 12833 case "Root":
12839 break; 12834 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true);
12840 default: 12835 break;
12841 this.Core.UnexpectedAttribute(node, attrib); 12836 default:
12842 break; 12837 this.Core.UnexpectedAttribute(node, attrib);
12838 break;
12843 } 12839 }
12844 } 12840 }
12845 else 12841 else
@@ -12899,33 +12895,33 @@ namespace WixToolset.Core
12899 "Furthermore, there is no security hole here, as the strings won't need to make a round trip")] 12895 "Furthermore, there is no security hole here, as the strings won't need to make a round trip")]
12900 private void ParseRemoveRegistryValueElement(XElement node, string componentId) 12896 private void ParseRemoveRegistryValueElement(XElement node, string componentId)
12901 { 12897 {
12902 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 12898 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
12903 Identifier id = null; 12899 Identifier id = null;
12904 string key = null; 12900 string key = null;
12905 string name = null; 12901 string name = null;
12906 int root = CompilerConstants.IntegerNotSet; 12902 var root = CompilerConstants.IntegerNotSet;
12907 12903
12908 foreach (XAttribute attrib in node.Attributes()) 12904 foreach (var attrib in node.Attributes())
12909 { 12905 {
12910 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 12906 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
12911 { 12907 {
12912 switch (attrib.Name.LocalName) 12908 switch (attrib.Name.LocalName)
12913 { 12909 {
12914 case "Id": 12910 case "Id":
12915 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 12911 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
12916 break; 12912 break;
12917 case "Key": 12913 case "Key":
12918 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12914 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12919 break; 12915 break;
12920 case "Name": 12916 case "Name":
12921 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 12917 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
12922 break; 12918 break;
12923 case "Root": 12919 case "Root":
12924 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true); 12920 root = this.Core.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attrib, true);
12925 break; 12921 break;
12926 default: 12922 default:
12927 this.Core.UnexpectedAttribute(node, attrib); 12923 this.Core.UnexpectedAttribute(node, attrib);
12928 break; 12924 break;
12929 } 12925 }
12930 } 12926 }
12931 else 12927 else
@@ -12970,56 +12966,56 @@ namespace WixToolset.Core
12970 /// <param name="parentDirectory">Identifier of the parent component's directory.</param> 12966 /// <param name="parentDirectory">Identifier of the parent component's directory.</param>
12971 private void ParseRemoveFileElement(XElement node, string componentId, string parentDirectory) 12967 private void ParseRemoveFileElement(XElement node, string componentId, string parentDirectory)
12972 { 12968 {
12973 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 12969 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
12974 Identifier id = null; 12970 Identifier id = null;
12975 string directory = null; 12971 string directory = null;
12976 string name = null; 12972 string name = null;
12977 int on = CompilerConstants.IntegerNotSet; 12973 var on = CompilerConstants.IntegerNotSet;
12978 string property = null; 12974 string property = null;
12979 string shortName = null; 12975 string shortName = null;
12980 12976
12981 foreach (XAttribute attrib in node.Attributes()) 12977 foreach (var attrib in node.Attributes())
12982 { 12978 {
12983 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 12979 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
12984 { 12980 {
12985 switch (attrib.Name.LocalName) 12981 switch (attrib.Name.LocalName)
12986 { 12982 {
12987 case "Id": 12983 case "Id":
12988 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 12984 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
12989 break; 12985 break;
12990 case "Directory": 12986 case "Directory":
12991 directory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, parentDirectory); 12987 directory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, parentDirectory);
12992 break; 12988 break;
12993 case "Name": 12989 case "Name":
12994 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, true); 12990 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, true);
12995 break; 12991 break;
12996 case "On": 12992 case "On":
12997 Wix.InstallUninstallType onValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); 12993 var onValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib);
12998 switch (onValue) 12994 switch (onValue)
12999 { 12995 {
13000 case Wix.InstallUninstallType.install: 12996 case Wix.InstallUninstallType.install:
13001 on = 1; 12997 on = 1;
13002 break;
13003 case Wix.InstallUninstallType.uninstall:
13004 on = 2;
13005 break;
13006 case Wix.InstallUninstallType.both:
13007 on = 3;
13008 break;
13009 default:
13010 on = CompilerConstants.IllegalInteger;
13011 break;
13012 }
13013 break; 12998 break;
13014 case "Property": 12999 case Wix.InstallUninstallType.uninstall:
13015 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 13000 on = 2;
13016 break; 13001 break;
13017 case "ShortName": 13002 case Wix.InstallUninstallType.both:
13018 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, true); 13003 on = 3;
13019 break; 13004 break;
13020 default: 13005 default:
13021 this.Core.UnexpectedAttribute(node, attrib); 13006 on = CompilerConstants.IllegalInteger;
13022 break; 13007 break;
13008 }
13009 break;
13010 case "Property":
13011 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
13012 break;
13013 case "ShortName":
13014 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, true);
13015 break;
13016 default:
13017 this.Core.UnexpectedAttribute(node, attrib);
13018 break;
13023 } 13019 }
13024 } 13020 }
13025 else 13021 else
@@ -13074,7 +13070,7 @@ namespace WixToolset.Core
13074 { 13070 {
13075 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.RemoveFile, id); 13071 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.RemoveFile, id);
13076 row.Set(1, componentId); 13072 row.Set(1, componentId);
13077 row.Set(2, GetMsiFilenameValue(shortName, name)); 13073 row.Set(2, this.GetMsiFilenameValue(shortName, name));
13078 if (null != directory) 13074 if (null != directory)
13079 { 13075 {
13080 row.Set(3, directory); 13076 row.Set(3, directory);
@@ -13099,48 +13095,48 @@ namespace WixToolset.Core
13099 /// <param name="parentDirectory">Identifier of parent component's directory.</param> 13095 /// <param name="parentDirectory">Identifier of parent component's directory.</param>
13100 private void ParseRemoveFolderElement(XElement node, string componentId, string parentDirectory) 13096 private void ParseRemoveFolderElement(XElement node, string componentId, string parentDirectory)
13101 { 13097 {
13102 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 13098 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
13103 Identifier id = null; 13099 Identifier id = null;
13104 string directory = null; 13100 string directory = null;
13105 int on = CompilerConstants.IntegerNotSet; 13101 var on = CompilerConstants.IntegerNotSet;
13106 string property = null; 13102 string property = null;
13107 13103
13108 foreach (XAttribute attrib in node.Attributes()) 13104 foreach (var attrib in node.Attributes())
13109 { 13105 {
13110 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 13106 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
13111 { 13107 {
13112 switch (attrib.Name.LocalName) 13108 switch (attrib.Name.LocalName)
13113 { 13109 {
13114 case "Id": 13110 case "Id":
13115 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 13111 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
13112 break;
13113 case "Directory":
13114 directory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, parentDirectory);
13115 break;
13116 case "On":
13117 var onValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib);
13118 switch (onValue)
13119 {
13120 case Wix.InstallUninstallType.install:
13121 on = 1;
13116 break; 13122 break;
13117 case "Directory": 13123 case Wix.InstallUninstallType.uninstall:
13118 directory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, parentDirectory); 13124 on = 2;
13119 break; 13125 break;
13120 case "On": 13126 case Wix.InstallUninstallType.both:
13121 Wix.InstallUninstallType onValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); 13127 on = 3;
13122 switch (onValue)
13123 {
13124 case Wix.InstallUninstallType.install:
13125 on = 1;
13126 break;
13127 case Wix.InstallUninstallType.uninstall:
13128 on = 2;
13129 break;
13130 case Wix.InstallUninstallType.both:
13131 on = 3;
13132 break;
13133 default:
13134 on = CompilerConstants.IllegalInteger;
13135 break;
13136 }
13137 break;
13138 case "Property":
13139 property = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
13140 break; 13128 break;
13141 default: 13129 default:
13142 this.Core.UnexpectedAttribute(node, attrib); 13130 on = CompilerConstants.IllegalInteger;
13143 break; 13131 break;
13132 }
13133 break;
13134 case "Property":
13135 property = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
13136 break;
13137 default:
13138 this.Core.UnexpectedAttribute(node, attrib);
13139 break;
13144 } 13140 }
13145 } 13141 }
13146 else 13142 else
@@ -13196,32 +13192,32 @@ namespace WixToolset.Core
13196 /// <param name="directoryId">Optional and default identifier of referenced directory.</param> 13192 /// <param name="directoryId">Optional and default identifier of referenced directory.</param>
13197 private void ParseReserveCostElement(XElement node, string componentId, string directoryId) 13193 private void ParseReserveCostElement(XElement node, string componentId, string directoryId)
13198 { 13194 {
13199 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 13195 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
13200 Identifier id = null; 13196 Identifier id = null;
13201 int runFromSource = CompilerConstants.IntegerNotSet; 13197 var runFromSource = CompilerConstants.IntegerNotSet;
13202 int runLocal = CompilerConstants.IntegerNotSet; 13198 var runLocal = CompilerConstants.IntegerNotSet;
13203 13199
13204 foreach (XAttribute attrib in node.Attributes()) 13200 foreach (var attrib in node.Attributes())
13205 { 13201 {
13206 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 13202 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
13207 { 13203 {
13208 switch (attrib.Name.LocalName) 13204 switch (attrib.Name.LocalName)
13209 { 13205 {
13210 case "Id": 13206 case "Id":
13211 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 13207 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
13212 break; 13208 break;
13213 case "Directory": 13209 case "Directory":
13214 directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId); 13210 directoryId = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, directoryId);
13215 break; 13211 break;
13216 case "RunFromSource": 13212 case "RunFromSource":
13217 runFromSource = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 13213 runFromSource = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
13218 break; 13214 break;
13219 case "RunLocal": 13215 case "RunLocal":
13220 runLocal = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 13216 runLocal = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
13221 break; 13217 break;
13222 default: 13218 default:
13223 this.Core.UnexpectedAttribute(node, attrib); 13219 this.Core.UnexpectedAttribute(node, attrib);
13224 break; 13220 break;
13225 } 13221 }
13226 } 13222 }
13227 else 13223 else
@@ -13271,109 +13267,109 @@ namespace WixToolset.Core
13271 } 13267 }
13272 13268
13273 // Parse each action in the sequence. 13269 // Parse each action in the sequence.
13274 foreach (XElement child in node.Elements()) 13270 foreach (var child in node.Elements())
13275 { 13271 {
13276 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 13272 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
13277 string actionName = child.Name.LocalName; 13273 var actionName = child.Name.LocalName;
13278 string afterAction = null; 13274 string afterAction = null;
13279 string beforeAction = null; 13275 string beforeAction = null;
13280 string condition = null; 13276 string condition = null;
13281 bool customAction = "Custom" == actionName; 13277 var customAction = "Custom" == actionName;
13282 bool overridable = false; 13278 var overridable = false;
13283 int exitSequence = CompilerConstants.IntegerNotSet; 13279 var exitSequence = CompilerConstants.IntegerNotSet;
13284 int sequence = CompilerConstants.IntegerNotSet; 13280 var sequence = CompilerConstants.IntegerNotSet;
13285 bool showDialog = "Show" == actionName; 13281 var showDialog = "Show" == actionName;
13286 bool specialAction = "InstallExecute" == actionName || "InstallExecuteAgain" == actionName || "RemoveExistingProducts" == actionName || "DisableRollback" == actionName || "ScheduleReboot" == actionName || "ForceReboot" == actionName || "ResolveSource" == actionName; 13282 var specialAction = "InstallExecute" == actionName || "InstallExecuteAgain" == actionName || "RemoveExistingProducts" == actionName || "DisableRollback" == actionName || "ScheduleReboot" == actionName || "ForceReboot" == actionName || "ResolveSource" == actionName;
13287 bool specialStandardAction = "AppSearch" == actionName || "CCPSearch" == actionName || "RMCCPSearch" == actionName || "LaunchConditions" == actionName || "FindRelatedProducts" == actionName; 13283 var specialStandardAction = "AppSearch" == actionName || "CCPSearch" == actionName || "RMCCPSearch" == actionName || "LaunchConditions" == actionName || "FindRelatedProducts" == actionName;
13288 bool suppress = false; 13284 var suppress = false;
13289 13285
13290 foreach (XAttribute attrib in child.Attributes()) 13286 foreach (var attrib in child.Attributes())
13291 { 13287 {
13292 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 13288 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
13293 { 13289 {
13294 switch (attrib.Name.LocalName) 13290 switch (attrib.Name.LocalName)
13295 { 13291 {
13296 case "Action": 13292 case "Action":
13297 if (customAction) 13293 if (customAction)
13298 { 13294 {
13299 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 13295 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
13300 this.Core.CreateSimpleReference(childSourceLineNumbers, "CustomAction", actionName); 13296 this.Core.CreateSimpleReference(childSourceLineNumbers, "CustomAction", actionName);
13301 } 13297 }
13302 else 13298 else
13303 { 13299 {
13304 this.Core.UnexpectedAttribute(child, attrib); 13300 this.Core.UnexpectedAttribute(child, attrib);
13305 } 13301 }
13306 break; 13302 break;
13307 case "After": 13303 case "After":
13308 if (customAction || showDialog || specialAction || specialStandardAction) 13304 if (customAction || showDialog || specialAction || specialStandardAction)
13309 { 13305 {
13310 afterAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 13306 afterAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
13311 this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable, afterAction); 13307 this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable, afterAction);
13312 } 13308 }
13313 else 13309 else
13314 { 13310 {
13315 this.Core.UnexpectedAttribute(child, attrib); 13311 this.Core.UnexpectedAttribute(child, attrib);
13316 } 13312 }
13317 break; 13313 break;
13318 case "Before": 13314 case "Before":
13319 if (customAction || showDialog || specialAction || specialStandardAction) 13315 if (customAction || showDialog || specialAction || specialStandardAction)
13320 { 13316 {
13321 beforeAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 13317 beforeAction = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
13322 this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable, beforeAction); 13318 this.Core.CreateSimpleReference(childSourceLineNumbers, "WixAction", sequenceTable, beforeAction);
13323 } 13319 }
13324 else 13320 else
13325 { 13321 {
13326 this.Core.UnexpectedAttribute(child, attrib); 13322 this.Core.UnexpectedAttribute(child, attrib);
13327 } 13323 }
13328 break; 13324 break;
13329 case "Dialog": 13325 case "Dialog":
13330 if (showDialog) 13326 if (showDialog)
13331 { 13327 {
13332 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib); 13328 actionName = this.Core.GetAttributeIdentifierValue(childSourceLineNumbers, attrib);
13333 this.Core.CreateSimpleReference(childSourceLineNumbers, "Dialog", actionName); 13329 this.Core.CreateSimpleReference(childSourceLineNumbers, "Dialog", actionName);
13334 } 13330 }
13335 else 13331 else
13336 { 13332 {
13337 this.Core.UnexpectedAttribute(child, attrib); 13333 this.Core.UnexpectedAttribute(child, attrib);
13338 } 13334 }
13339 break; 13335 break;
13340 case "OnExit": 13336 case "OnExit":
13341 if (customAction || showDialog || specialAction) 13337 if (customAction || showDialog || specialAction)
13342 { 13338 {
13343 Wix.ExitType exitValue = this.Core.GetAttributeExitValue(childSourceLineNumbers, attrib); 13339 var exitValue = this.Core.GetAttributeExitValue(childSourceLineNumbers, attrib);
13344 switch (exitValue) 13340 switch (exitValue)
13345 {
13346 case Wix.ExitType.success:
13347 exitSequence = -1;
13348 break;
13349 case Wix.ExitType.cancel:
13350 exitSequence = -2;
13351 break;
13352 case Wix.ExitType.error:
13353 exitSequence = -3;
13354 break;
13355 case Wix.ExitType.suspend:
13356 exitSequence = -4;
13357 break;
13358 }
13359 }
13360 else
13361 { 13341 {
13362 this.Core.UnexpectedAttribute(child, attrib); 13342 case Wix.ExitType.success:
13343 exitSequence = -1;
13344 break;
13345 case Wix.ExitType.cancel:
13346 exitSequence = -2;
13347 break;
13348 case Wix.ExitType.error:
13349 exitSequence = -3;
13350 break;
13351 case Wix.ExitType.suspend:
13352 exitSequence = -4;
13353 break;
13363 } 13354 }
13364 break; 13355 }
13365 case "Overridable": 13356 else
13366 overridable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, attrib); 13357 {
13367 break; 13358 this.Core.UnexpectedAttribute(child, attrib);
13368 case "Sequence": 13359 }
13369 sequence = this.Core.GetAttributeIntegerValue(childSourceLineNumbers, attrib, 1, short.MaxValue); 13360 break;
13370 break; 13361 case "Overridable":
13371 case "Suppress": 13362 overridable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, attrib);
13372 suppress = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, attrib); 13363 break;
13373 break; 13364 case "Sequence":
13374 default: 13365 sequence = this.Core.GetAttributeIntegerValue(childSourceLineNumbers, attrib, 1, Int16.MaxValue);
13375 this.Core.UnexpectedAttribute(node, attrib); 13366 break;
13376 break; 13367 case "Suppress":
13368 suppress = YesNoType.Yes == this.Core.GetAttributeYesNoValue(childSourceLineNumbers, attrib);
13369 break;
13370 default:
13371 this.Core.UnexpectedAttribute(node, attrib);
13372 break;
13377 } 13373 }
13378 } 13374 }
13379 else 13375 else
@@ -13480,119 +13476,119 @@ namespace WixToolset.Core
13480 /// <param name="serviceName">Optional element containing parent's service name.</param> 13476 /// <param name="serviceName">Optional element containing parent's service name.</param>
13481 private void ParseServiceConfigElement(XElement node, string componentId, string serviceName) 13477 private void ParseServiceConfigElement(XElement node, string componentId, string serviceName)
13482 { 13478 {
13483 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 13479 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
13484 Identifier id = null; 13480 Identifier id = null;
13485 string delayedAutoStart = null; 13481 string delayedAutoStart = null;
13486 string failureActionsWhen = null; 13482 string failureActionsWhen = null;
13487 int events = 0; 13483 var events = 0;
13488 string name = serviceName; 13484 var name = serviceName;
13489 string preShutdownDelay = null; 13485 string preShutdownDelay = null;
13490 string requiredPrivileges = null; 13486 string requiredPrivileges = null;
13491 string sid = null; 13487 string sid = null;
13492 13488
13493 this.Core.Write(WarningMessages.ServiceConfigFamilyNotSupported(sourceLineNumbers, node.Name.LocalName)); 13489 this.Core.Write(WarningMessages.ServiceConfigFamilyNotSupported(sourceLineNumbers, node.Name.LocalName));
13494 13490
13495 foreach (XAttribute attrib in node.Attributes()) 13491 foreach (var attrib in node.Attributes())
13496 { 13492 {
13497 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 13493 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
13498 { 13494 {
13499 switch (attrib.Name.LocalName) 13495 switch (attrib.Name.LocalName)
13500 { 13496 {
13501 case "Id": 13497 case "Id":
13502 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 13498 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
13503 break; 13499 break;
13504 case "DelayedAutoStart": 13500 case "DelayedAutoStart":
13505 delayedAutoStart = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 13501 delayedAutoStart = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
13506 if (0 < delayedAutoStart.Length) 13502 if (0 < delayedAutoStart.Length)
13507 { 13503 {
13508 switch (delayedAutoStart) 13504 switch (delayedAutoStart)
13509 {
13510 case "no":
13511 delayedAutoStart = "0";
13512 break;
13513 case "yes":
13514 delayedAutoStart = "1";
13515 break;
13516 default:
13517 // allow everything else to pass through that are hopefully "formatted" Properties.
13518 break;
13519 }
13520 }
13521 break;
13522 case "FailureActionsWhen":
13523 failureActionsWhen = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
13524 if (0 < failureActionsWhen.Length)
13525 {
13526 switch (failureActionsWhen)
13527 {
13528 case "failedToStop":
13529 failureActionsWhen = "0";
13530 break;
13531 case "failedToStopOrReturnedError":
13532 failureActionsWhen = "1";
13533 break;
13534 default:
13535 // allow everything else to pass through that are hopefully "formatted" Properties.
13536 break;
13537 }
13538 }
13539 break;
13540 case "OnInstall":
13541 YesNoType install = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
13542 if (YesNoType.Yes == install)
13543 {
13544 events |= MsiInterop.MsidbServiceConfigEventInstall;
13545 }
13546 break;
13547 case "OnReinstall":
13548 YesNoType reinstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
13549 if (YesNoType.Yes == reinstall)
13550 {
13551 events |= MsiInterop.MsidbServiceConfigEventReinstall;
13552 }
13553 break;
13554 case "OnUninstall":
13555 YesNoType uninstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
13556 if (YesNoType.Yes == uninstall)
13557 { 13505 {
13558 events |= MsiInterop.MsidbServiceConfigEventUninstall; 13506 case "no":
13507 delayedAutoStart = "0";
13508 break;
13509 case "yes":
13510 delayedAutoStart = "1";
13511 break;
13512 default:
13513 // allow everything else to pass through that are hopefully "formatted" Properties.
13514 break;
13559 } 13515 }
13560 break; 13516 }
13561 default: 13517 break;
13562 this.Core.UnexpectedAttribute(node, attrib); 13518 case "FailureActionsWhen":
13563 break; 13519 failureActionsWhen = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
13564 case "PreShutdownDelay": 13520 if (0 < failureActionsWhen.Length)
13565 preShutdownDelay = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 13521 {
13566 break; 13522 switch (failureActionsWhen)
13567 case "ServiceName":
13568 if (!String.IsNullOrEmpty(serviceName))
13569 { 13523 {
13570 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ServiceInstall")); 13524 case "failedToStop":
13525 failureActionsWhen = "0";
13526 break;
13527 case "failedToStopOrReturnedError":
13528 failureActionsWhen = "1";
13529 break;
13530 default:
13531 // allow everything else to pass through that are hopefully "formatted" Properties.
13532 break;
13571 } 13533 }
13534 }
13535 break;
13536 case "OnInstall":
13537 var install = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
13538 if (YesNoType.Yes == install)
13539 {
13540 events |= MsiInterop.MsidbServiceConfigEventInstall;
13541 }
13542 break;
13543 case "OnReinstall":
13544 var reinstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
13545 if (YesNoType.Yes == reinstall)
13546 {
13547 events |= MsiInterop.MsidbServiceConfigEventReinstall;
13548 }
13549 break;
13550 case "OnUninstall":
13551 var uninstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
13552 if (YesNoType.Yes == uninstall)
13553 {
13554 events |= MsiInterop.MsidbServiceConfigEventUninstall;
13555 }
13556 break;
13557 default:
13558 this.Core.UnexpectedAttribute(node, attrib);
13559 break;
13560 case "PreShutdownDelay":
13561 preShutdownDelay = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
13562 break;
13563 case "ServiceName":
13564 if (!String.IsNullOrEmpty(serviceName))
13565 {
13566 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ServiceInstall"));
13567 }
13572 13568
13573 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 13569 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
13574 break; 13570 break;
13575 case "ServiceSid": 13571 case "ServiceSid":
13576 sid = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 13572 sid = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
13577 if (0 < sid.Length) 13573 if (0 < sid.Length)
13574 {
13575 switch (sid)
13578 { 13576 {
13579 switch (sid) 13577 case "none":
13580 { 13578 sid = "0";
13581 case "none": 13579 break;
13582 sid = "0"; 13580 case "restricted":
13583 break; 13581 sid = "3";
13584 case "restricted": 13582 break;
13585 sid = "3"; 13583 case "unrestricted":
13586 break; 13584 sid = "1";
13587 case "unrestricted": 13585 break;
13588 sid = "1"; 13586 default:
13589 break; 13587 // allow everything else to pass through that are hopefully "formatted" Properties.
13590 default: 13588 break;
13591 // allow everything else to pass through that are hopefully "formatted" Properties.
13592 break;
13593 }
13594 } 13589 }
13595 break; 13590 }
13591 break;
13596 } 13592 }
13597 } 13593 }
13598 else 13594 else
@@ -13602,139 +13598,139 @@ namespace WixToolset.Core
13602 } 13598 }
13603 13599
13604 // Get the ServiceConfig required privilegs. 13600 // Get the ServiceConfig required privilegs.
13605 foreach (XElement child in node.Elements()) 13601 foreach (var child in node.Elements())
13606 { 13602 {
13607 if (CompilerCore.WixNamespace == child.Name.Namespace) 13603 if (CompilerCore.WixNamespace == child.Name.Namespace)
13608 { 13604 {
13609 switch (child.Name.LocalName) 13605 switch (child.Name.LocalName)
13610 { 13606 {
13611 case "RequiredPrivilege": 13607 case "RequiredPrivilege":
13612 string privilege = this.Core.GetTrimmedInnerText(child); 13608 var privilege = this.Core.GetTrimmedInnerText(child);
13613 switch (privilege) 13609 switch (privilege)
13614 { 13610 {
13615 case "assignPrimaryToken": 13611 case "assignPrimaryToken":
13616 privilege = "SeAssignPrimaryTokenPrivilege"; 13612 privilege = "SeAssignPrimaryTokenPrivilege";
13617 break; 13613 break;
13618 case "audit": 13614 case "audit":
13619 privilege = "SeAuditPrivilege"; 13615 privilege = "SeAuditPrivilege";
13620 break; 13616 break;
13621 case "backup": 13617 case "backup":
13622 privilege = "SeBackupPrivilege"; 13618 privilege = "SeBackupPrivilege";
13623 break; 13619 break;
13624 case "changeNotify": 13620 case "changeNotify":
13625 privilege = "SeChangeNotifyPrivilege"; 13621 privilege = "SeChangeNotifyPrivilege";
13626 break; 13622 break;
13627 case "createGlobal": 13623 case "createGlobal":
13628 privilege = "SeCreateGlobalPrivilege"; 13624 privilege = "SeCreateGlobalPrivilege";
13629 break; 13625 break;
13630 case "createPagefile": 13626 case "createPagefile":
13631 privilege = "SeCreatePagefilePrivilege"; 13627 privilege = "SeCreatePagefilePrivilege";
13632 break; 13628 break;
13633 case "createPermanent": 13629 case "createPermanent":
13634 privilege = "SeCreatePermanentPrivilege"; 13630 privilege = "SeCreatePermanentPrivilege";
13635 break; 13631 break;
13636 case "createSymbolicLink": 13632 case "createSymbolicLink":
13637 privilege = "SeCreateSymbolicLinkPrivilege"; 13633 privilege = "SeCreateSymbolicLinkPrivilege";
13638 break; 13634 break;
13639 case "createToken": 13635 case "createToken":
13640 privilege = "SeCreateTokenPrivilege"; 13636 privilege = "SeCreateTokenPrivilege";
13641 break; 13637 break;
13642 case "debug": 13638 case "debug":
13643 privilege = "SeDebugPrivilege"; 13639 privilege = "SeDebugPrivilege";
13644 break; 13640 break;
13645 case "enableDelegation": 13641 case "enableDelegation":
13646 privilege = "SeEnableDelegationPrivilege"; 13642 privilege = "SeEnableDelegationPrivilege";
13647 break; 13643 break;
13648 case "impersonate": 13644 case "impersonate":
13649 privilege = "SeImpersonatePrivilege"; 13645 privilege = "SeImpersonatePrivilege";
13650 break; 13646 break;
13651 case "increaseBasePriority": 13647 case "increaseBasePriority":
13652 privilege = "SeIncreaseBasePriorityPrivilege"; 13648 privilege = "SeIncreaseBasePriorityPrivilege";
13653 break; 13649 break;
13654 case "increaseQuota": 13650 case "increaseQuota":
13655 privilege = "SeIncreaseQuotaPrivilege"; 13651 privilege = "SeIncreaseQuotaPrivilege";
13656 break; 13652 break;
13657 case "increaseWorkingSet": 13653 case "increaseWorkingSet":
13658 privilege = "SeIncreaseWorkingSetPrivilege"; 13654 privilege = "SeIncreaseWorkingSetPrivilege";
13659 break; 13655 break;
13660 case "loadDriver": 13656 case "loadDriver":
13661 privilege = "SeLoadDriverPrivilege"; 13657 privilege = "SeLoadDriverPrivilege";
13662 break; 13658 break;
13663 case "lockMemory": 13659 case "lockMemory":
13664 privilege = "SeLockMemoryPrivilege"; 13660 privilege = "SeLockMemoryPrivilege";
13665 break; 13661 break;
13666 case "machineAccount": 13662 case "machineAccount":
13667 privilege = "SeMachineAccountPrivilege"; 13663 privilege = "SeMachineAccountPrivilege";
13668 break; 13664 break;
13669 case "manageVolume": 13665 case "manageVolume":
13670 privilege = "SeManageVolumePrivilege"; 13666 privilege = "SeManageVolumePrivilege";
13671 break; 13667 break;
13672 case "profileSingleProcess": 13668 case "profileSingleProcess":
13673 privilege = "SeProfileSingleProcessPrivilege"; 13669 privilege = "SeProfileSingleProcessPrivilege";
13674 break; 13670 break;
13675 case "relabel": 13671 case "relabel":
13676 privilege = "SeRelabelPrivilege"; 13672 privilege = "SeRelabelPrivilege";
13677 break; 13673 break;
13678 case "remoteShutdown": 13674 case "remoteShutdown":
13679 privilege = "SeRemoteShutdownPrivilege"; 13675 privilege = "SeRemoteShutdownPrivilege";
13680 break; 13676 break;
13681 case "restore": 13677 case "restore":
13682 privilege = "SeRestorePrivilege"; 13678 privilege = "SeRestorePrivilege";
13683 break; 13679 break;
13684 case "security": 13680 case "security":
13685 privilege = "SeSecurityPrivilege"; 13681 privilege = "SeSecurityPrivilege";
13686 break; 13682 break;
13687 case "shutdown": 13683 case "shutdown":
13688 privilege = "SeShutdownPrivilege"; 13684 privilege = "SeShutdownPrivilege";
13689 break; 13685 break;
13690 case "syncAgent": 13686 case "syncAgent":
13691 privilege = "SeSyncAgentPrivilege"; 13687 privilege = "SeSyncAgentPrivilege";
13692 break; 13688 break;
13693 case "systemEnvironment": 13689 case "systemEnvironment":
13694 privilege = "SeSystemEnvironmentPrivilege"; 13690 privilege = "SeSystemEnvironmentPrivilege";
13695 break; 13691 break;
13696 case "systemProfile": 13692 case "systemProfile":
13697 privilege = "SeSystemProfilePrivilege"; 13693 privilege = "SeSystemProfilePrivilege";
13698 break; 13694 break;
13699 case "systemTime": 13695 case "systemTime":
13700 case "modifySystemTime": 13696 case "modifySystemTime":
13701 privilege = "SeSystemtimePrivilege"; 13697 privilege = "SeSystemtimePrivilege";
13702 break; 13698 break;
13703 case "takeOwnership": 13699 case "takeOwnership":
13704 privilege = "SeTakeOwnershipPrivilege"; 13700 privilege = "SeTakeOwnershipPrivilege";
13705 break; 13701 break;
13706 case "tcb": 13702 case "tcb":
13707 case "trustedComputerBase": 13703 case "trustedComputerBase":
13708 privilege = "SeTcbPrivilege"; 13704 privilege = "SeTcbPrivilege";
13709 break; 13705 break;
13710 case "timeZone": 13706 case "timeZone":
13711 case "modifyTimeZone": 13707 case "modifyTimeZone":
13712 privilege = "SeTimeZonePrivilege"; 13708 privilege = "SeTimeZonePrivilege";
13713 break; 13709 break;
13714 case "trustedCredManAccess": 13710 case "trustedCredManAccess":
13715 case "trustedCredentialManagerAccess": 13711 case "trustedCredentialManagerAccess":
13716 privilege = "SeTrustedCredManAccessPrivilege"; 13712 privilege = "SeTrustedCredManAccessPrivilege";
13717 break; 13713 break;
13718 case "undock": 13714 case "undock":
13719 privilege = "SeUndockPrivilege"; 13715 privilege = "SeUndockPrivilege";
13720 break; 13716 break;
13721 case "unsolicitedInput": 13717 case "unsolicitedInput":
13722 privilege = "SeUnsolicitedInputPrivilege"; 13718 privilege = "SeUnsolicitedInputPrivilege";
13723 break;
13724 default:
13725 // allow everything else to pass through that are hopefully "formatted" Properties.
13726 break;
13727 }
13728
13729 if (null != requiredPrivileges)
13730 {
13731 requiredPrivileges = String.Concat(requiredPrivileges, "[~]");
13732 }
13733 requiredPrivileges = String.Concat(requiredPrivileges, privilege);
13734 break; 13719 break;
13735 default: 13720 default:
13736 this.Core.UnexpectedElement(node, child); 13721 // allow everything else to pass through that are hopefully "formatted" Properties.
13737 break; 13722 break;
13723 }
13724
13725 if (null != requiredPrivileges)
13726 {
13727 requiredPrivileges = String.Concat(requiredPrivileges, "[~]");
13728 }
13729 requiredPrivileges = String.Concat(requiredPrivileges, privilege);
13730 break;
13731 default:
13732 this.Core.UnexpectedElement(node, child);
13733 break;
13738 } 13734 }
13739 } 13735 }
13740 else 13736 else
@@ -13824,11 +13820,11 @@ namespace WixToolset.Core
13824 /// <param name="serviceName">Optional element containing parent's service name.</param> 13820 /// <param name="serviceName">Optional element containing parent's service name.</param>
13825 private void ParseServiceConfigFailureActionsElement(XElement node, string componentId, string serviceName) 13821 private void ParseServiceConfigFailureActionsElement(XElement node, string componentId, string serviceName)
13826 { 13822 {
13827 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 13823 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
13828 Identifier id = null; 13824 Identifier id = null;
13829 int events = 0; 13825 var events = 0;
13830 string name = serviceName; 13826 var name = serviceName;
13831 int resetPeriod = CompilerConstants.IntegerNotSet; 13827 var resetPeriod = CompilerConstants.IntegerNotSet;
13832 string rebootMessage = null; 13828 string rebootMessage = null;
13833 string command = null; 13829 string command = null;
13834 string actions = null; 13830 string actions = null;
@@ -13836,56 +13832,56 @@ namespace WixToolset.Core
13836 13832
13837 this.Core.Write(WarningMessages.ServiceConfigFamilyNotSupported(sourceLineNumbers, node.Name.LocalName)); 13833 this.Core.Write(WarningMessages.ServiceConfigFamilyNotSupported(sourceLineNumbers, node.Name.LocalName));
13838 13834
13839 foreach (XAttribute attrib in node.Attributes()) 13835 foreach (var attrib in node.Attributes())
13840 { 13836 {
13841 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 13837 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
13842 { 13838 {
13843 switch (attrib.Name.LocalName) 13839 switch (attrib.Name.LocalName)
13844 { 13840 {
13845 case "Id": 13841 case "Id":
13846 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 13842 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
13847 break; 13843 break;
13848 case "Command": 13844 case "Command":
13849 command = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 13845 command = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
13850 break; 13846 break;
13851 case "OnInstall": 13847 case "OnInstall":
13852 YesNoType install = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 13848 var install = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
13853 if (YesNoType.Yes == install) 13849 if (YesNoType.Yes == install)
13854 { 13850 {
13855 events |= MsiInterop.MsidbServiceConfigEventInstall; 13851 events |= MsiInterop.MsidbServiceConfigEventInstall;
13856 } 13852 }
13857 break; 13853 break;
13858 case "OnReinstall": 13854 case "OnReinstall":
13859 YesNoType reinstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 13855 var reinstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
13860 if (YesNoType.Yes == reinstall) 13856 if (YesNoType.Yes == reinstall)
13861 { 13857 {
13862 events |= MsiInterop.MsidbServiceConfigEventReinstall; 13858 events |= MsiInterop.MsidbServiceConfigEventReinstall;
13863 } 13859 }
13864 break; 13860 break;
13865 case "OnUninstall": 13861 case "OnUninstall":
13866 YesNoType uninstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 13862 var uninstall = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
13867 if (YesNoType.Yes == uninstall) 13863 if (YesNoType.Yes == uninstall)
13868 { 13864 {
13869 events |= MsiInterop.MsidbServiceConfigEventUninstall; 13865 events |= MsiInterop.MsidbServiceConfigEventUninstall;
13870 } 13866 }
13871 break; 13867 break;
13872 case "RebootMessage": 13868 case "RebootMessage":
13873 rebootMessage = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 13869 rebootMessage = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
13874 break; 13870 break;
13875 case "ResetPeriod": 13871 case "ResetPeriod":
13876 resetPeriod = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 13872 resetPeriod = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
13877 break; 13873 break;
13878 case "ServiceName": 13874 case "ServiceName":
13879 if (!String.IsNullOrEmpty(serviceName)) 13875 if (!String.IsNullOrEmpty(serviceName))
13880 { 13876 {
13881 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ServiceInstall")); 13877 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ServiceInstall"));
13882 } 13878 }
13883 13879
13884 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 13880 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
13885 break; 13881 break;
13886 default: 13882 default:
13887 this.Core.UnexpectedAttribute(node, attrib); 13883 this.Core.UnexpectedAttribute(node, attrib);
13888 break; 13884 break;
13889 } 13885 }
13890 } 13886 }
13891 else 13887 else
@@ -13895,79 +13891,79 @@ namespace WixToolset.Core
13895 } 13891 }
13896 13892
13897 // Get the ServiceConfigFailureActions actions. 13893 // Get the ServiceConfigFailureActions actions.
13898 foreach (XElement child in node.Elements()) 13894 foreach (var child in node.Elements())
13899 { 13895 {
13900 if (CompilerCore.WixNamespace == child.Name.Namespace) 13896 if (CompilerCore.WixNamespace == child.Name.Namespace)
13901 { 13897 {
13902 switch (child.Name.LocalName) 13898 switch (child.Name.LocalName)
13903 { 13899 {
13904 case "Failure": 13900 case "Failure":
13905 string action = null; 13901 string action = null;
13906 string delay = null; 13902 string delay = null;
13907 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 13903 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
13908 13904
13909 foreach (XAttribute childAttrib in child.Attributes()) 13905 foreach (var childAttrib in child.Attributes())
13906 {
13907 if (String.IsNullOrEmpty(childAttrib.Name.NamespaceName) || CompilerCore.WixNamespace == childAttrib.Name.Namespace)
13910 { 13908 {
13911 if (String.IsNullOrEmpty(childAttrib.Name.NamespaceName) || CompilerCore.WixNamespace == childAttrib.Name.Namespace) 13909 switch (childAttrib.Name.LocalName)
13912 { 13910 {
13913 switch (childAttrib.Name.LocalName) 13911 case "Action":
13912 action = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
13913 switch (action)
13914 { 13914 {
13915 case "Action": 13915 case "none":
13916 action = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib); 13916 action = "0";
13917 switch (action) 13917 break;
13918 { 13918 case "restartComputer":
13919 case "none": 13919 action = "2";
13920 action = "0"; 13920 break;
13921 break; 13921 case "restartService":
13922 case "restartComputer": 13922 action = "1";
13923 action = "2"; 13923 break;
13924 break; 13924 case "runCommand":
13925 case "restartService": 13925 action = "3";
13926 action = "1"; 13926 break;
13927 break; 13927 default:
13928 case "runCommand": 13928 // allow everything else to pass through that are hopefully "formatted" Properties.
13929 action = "3"; 13929 break;
13930 break;
13931 default:
13932 // allow everything else to pass through that are hopefully "formatted" Properties.
13933 break;
13934 }
13935 break;
13936 case "Delay":
13937 delay = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
13938 break;
13939 default:
13940 this.Core.UnexpectedAttribute(child, childAttrib);
13941 break;
13942 } 13930 }
13931 break;
13932 case "Delay":
13933 delay = this.Core.GetAttributeValue(childSourceLineNumbers, childAttrib);
13934 break;
13935 default:
13936 this.Core.UnexpectedAttribute(child, childAttrib);
13937 break;
13943 } 13938 }
13944 } 13939 }
13940 }
13945 13941
13946 if (String.IsNullOrEmpty(action)) 13942 if (String.IsNullOrEmpty(action))
13947 { 13943 {
13948 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, child.Name.LocalName, "Action")); 13944 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, child.Name.LocalName, "Action"));
13949 } 13945 }
13950 13946
13951 if (String.IsNullOrEmpty(delay)) 13947 if (String.IsNullOrEmpty(delay))
13952 { 13948 {
13953 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, child.Name.LocalName, "Delay")); 13949 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, child.Name.LocalName, "Delay"));
13954 } 13950 }
13955 13951
13956 if (!String.IsNullOrEmpty(actions)) 13952 if (!String.IsNullOrEmpty(actions))
13957 { 13953 {
13958 actions = String.Concat(actions, "[~]"); 13954 actions = String.Concat(actions, "[~]");
13959 } 13955 }
13960 actions = String.Concat(actions, action); 13956 actions = String.Concat(actions, action);
13961 13957
13962 if (!String.IsNullOrEmpty(actionsDelays)) 13958 if (!String.IsNullOrEmpty(actionsDelays))
13963 { 13959 {
13964 actionsDelays = String.Concat(actionsDelays, "[~]"); 13960 actionsDelays = String.Concat(actionsDelays, "[~]");
13965 } 13961 }
13966 actionsDelays = String.Concat(actionsDelays, delay); 13962 actionsDelays = String.Concat(actionsDelays, delay);
13967 break; 13963 break;
13968 default: 13964 default:
13969 this.Core.UnexpectedElement(node, child); 13965 this.Core.UnexpectedElement(node, child);
13970 break; 13966 break;
13971 } 13967 }
13972 } 13968 }
13973 else 13969 else
@@ -14014,76 +14010,76 @@ namespace WixToolset.Core
14014 /// <param name="componentId">Identifier of parent component.</param> 14010 /// <param name="componentId">Identifier of parent component.</param>
14015 private void ParseServiceControlElement(XElement node, string componentId) 14011 private void ParseServiceControlElement(XElement node, string componentId)
14016 { 14012 {
14017 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 14013 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
14018 string arguments = null; 14014 string arguments = null;
14019 int events = 0; // default is to do nothing 14015 var events = 0; // default is to do nothing
14020 Identifier id = null; 14016 Identifier id = null;
14021 string name = null; 14017 string name = null;
14022 YesNoType wait = YesNoType.NotSet; 14018 var wait = YesNoType.NotSet;
14023 14019
14024 foreach (XAttribute attrib in node.Attributes()) 14020 foreach (var attrib in node.Attributes())
14025 { 14021 {
14026 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 14022 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
14027 { 14023 {
14028 switch (attrib.Name.LocalName) 14024 switch (attrib.Name.LocalName)
14029 { 14025 {
14030 case "Id": 14026 case "Id":
14031 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 14027 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
14028 break;
14029 case "Name":
14030 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14031 break;
14032 case "Remove":
14033 var removeValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib);
14034 switch (removeValue)
14035 {
14036 case Wix.InstallUninstallType.install:
14037 events |= MsiInterop.MsidbServiceControlEventDelete;
14032 break; 14038 break;
14033 case "Name": 14039 case Wix.InstallUninstallType.uninstall:
14034 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14040 events |= MsiInterop.MsidbServiceControlEventUninstallDelete;
14035 break; 14041 break;
14036 case "Remove": 14042 case Wix.InstallUninstallType.both:
14037 Wix.InstallUninstallType removeValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); 14043 events |= MsiInterop.MsidbServiceControlEventDelete | MsiInterop.MsidbServiceControlEventUninstallDelete;
14038 switch (removeValue)
14039 {
14040 case Wix.InstallUninstallType.install:
14041 events |= MsiInterop.MsidbServiceControlEventDelete;
14042 break;
14043 case Wix.InstallUninstallType.uninstall:
14044 events |= MsiInterop.MsidbServiceControlEventUninstallDelete;
14045 break;
14046 case Wix.InstallUninstallType.both:
14047 events |= MsiInterop.MsidbServiceControlEventDelete | MsiInterop.MsidbServiceControlEventUninstallDelete;
14048 break;
14049 }
14050 break; 14044 break;
14051 case "Start": 14045 }
14052 Wix.InstallUninstallType startValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); 14046 break;
14053 switch (startValue) 14047 case "Start":
14054 { 14048 var startValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib);
14055 case Wix.InstallUninstallType.install: 14049 switch (startValue)
14056 events |= MsiInterop.MsidbServiceControlEventStart; 14050 {
14057 break; 14051 case Wix.InstallUninstallType.install:
14058 case Wix.InstallUninstallType.uninstall: 14052 events |= MsiInterop.MsidbServiceControlEventStart;
14059 events |= MsiInterop.MsidbServiceControlEventUninstallStart;
14060 break;
14061 case Wix.InstallUninstallType.both:
14062 events |= MsiInterop.MsidbServiceControlEventStart | MsiInterop.MsidbServiceControlEventUninstallStart;
14063 break;
14064 }
14065 break; 14053 break;
14066 case "Stop": 14054 case Wix.InstallUninstallType.uninstall:
14067 Wix.InstallUninstallType stopValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib); 14055 events |= MsiInterop.MsidbServiceControlEventUninstallStart;
14068 switch (stopValue)
14069 {
14070 case Wix.InstallUninstallType.install:
14071 events |= MsiInterop.MsidbServiceControlEventStop;
14072 break;
14073 case Wix.InstallUninstallType.uninstall:
14074 events |= MsiInterop.MsidbServiceControlEventUninstallStop;
14075 break;
14076 case Wix.InstallUninstallType.both:
14077 events |= MsiInterop.MsidbServiceControlEventStop | MsiInterop.MsidbServiceControlEventUninstallStop;
14078 break;
14079 }
14080 break; 14056 break;
14081 case "Wait": 14057 case Wix.InstallUninstallType.both:
14082 wait = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 14058 events |= MsiInterop.MsidbServiceControlEventStart | MsiInterop.MsidbServiceControlEventUninstallStart;
14083 break; 14059 break;
14084 default: 14060 }
14085 this.Core.UnexpectedAttribute(node, attrib); 14061 break;
14062 case "Stop":
14063 var stopValue = this.Core.GetAttributeInstallUninstallValue(sourceLineNumbers, attrib);
14064 switch (stopValue)
14065 {
14066 case Wix.InstallUninstallType.install:
14067 events |= MsiInterop.MsidbServiceControlEventStop;
14068 break;
14069 case Wix.InstallUninstallType.uninstall:
14070 events |= MsiInterop.MsidbServiceControlEventUninstallStop;
14071 break;
14072 case Wix.InstallUninstallType.both:
14073 events |= MsiInterop.MsidbServiceControlEventStop | MsiInterop.MsidbServiceControlEventUninstallStop;
14086 break; 14074 break;
14075 }
14076 break;
14077 case "Wait":
14078 wait = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
14079 break;
14080 default:
14081 this.Core.UnexpectedAttribute(node, attrib);
14082 break;
14087 } 14083 }
14088 } 14084 }
14089 else 14085 else
@@ -14103,22 +14099,22 @@ namespace WixToolset.Core
14103 } 14099 }
14104 14100
14105 // get the ServiceControl arguments 14101 // get the ServiceControl arguments
14106 foreach (XElement child in node.Elements()) 14102 foreach (var child in node.Elements())
14107 { 14103 {
14108 if (CompilerCore.WixNamespace == child.Name.Namespace) 14104 if (CompilerCore.WixNamespace == child.Name.Namespace)
14109 { 14105 {
14110 switch (child.Name.LocalName) 14106 switch (child.Name.LocalName)
14111 { 14107 {
14112 case "ServiceArgument": 14108 case "ServiceArgument":
14113 if (null != arguments) 14109 if (null != arguments)
14114 { 14110 {
14115 arguments = String.Concat(arguments, "[~]"); 14111 arguments = String.Concat(arguments, "[~]");
14116 } 14112 }
14117 arguments = String.Concat(arguments, this.Core.GetTrimmedInnerText(child)); 14113 arguments = String.Concat(arguments, this.Core.GetTrimmedInnerText(child));
14118 break; 14114 break;
14119 default: 14115 default:
14120 this.Core.UnexpectedElement(node, child); 14116 this.Core.UnexpectedElement(node, child);
14121 break; 14117 break;
14122 } 14118 }
14123 } 14119 }
14124 else 14120 else
@@ -14148,25 +14144,25 @@ namespace WixToolset.Core
14148 /// <returns>Parsed sevice dependency name.</returns> 14144 /// <returns>Parsed sevice dependency name.</returns>
14149 private string ParseServiceDependencyElement(XElement node) 14145 private string ParseServiceDependencyElement(XElement node)
14150 { 14146 {
14151 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 14147 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
14152 string dependency = null; 14148 string dependency = null;
14153 bool group = false; 14149 var group = false;
14154 14150
14155 foreach (XAttribute attrib in node.Attributes()) 14151 foreach (var attrib in node.Attributes())
14156 { 14152 {
14157 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 14153 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
14158 { 14154 {
14159 switch (attrib.Name.LocalName) 14155 switch (attrib.Name.LocalName)
14160 { 14156 {
14161 case "Id": 14157 case "Id":
14162 dependency = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14158 dependency = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14163 break; 14159 break;
14164 case "Group": 14160 case "Group":
14165 group = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 14161 group = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
14166 break; 14162 break;
14167 default: 14163 default:
14168 this.Core.UnexpectedAttribute(node, attrib); 14164 this.Core.UnexpectedAttribute(node, attrib);
14169 break; 14165 break;
14170 } 14166 }
14171 } 14167 }
14172 else 14168 else
@@ -14192,140 +14188,140 @@ namespace WixToolset.Core
14192 /// <param name="componentId">Identifier of parent component.</param> 14188 /// <param name="componentId">Identifier of parent component.</param>
14193 private void ParseServiceInstallElement(XElement node, string componentId, bool win64Component) 14189 private void ParseServiceInstallElement(XElement node, string componentId, bool win64Component)
14194 { 14190 {
14195 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 14191 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
14196 Identifier id = null; 14192 Identifier id = null;
14197 string account = null; 14193 string account = null;
14198 string arguments = null; 14194 string arguments = null;
14199 string dependencies = null; 14195 string dependencies = null;
14200 string description = null; 14196 string description = null;
14201 string displayName = null; 14197 string displayName = null;
14202 bool eraseDescription = false; 14198 var eraseDescription = false;
14203 int errorbits = 0; 14199 var errorbits = 0;
14204 string loadOrderGroup = null; 14200 string loadOrderGroup = null;
14205 string name = null; 14201 string name = null;
14206 string password = null; 14202 string password = null;
14207 int startType = 0; 14203 var startType = 0;
14208 int typebits = 0; 14204 var typebits = 0;
14209 14205
14210 foreach (XAttribute attrib in node.Attributes()) 14206 foreach (var attrib in node.Attributes())
14211 { 14207 {
14212 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 14208 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
14213 { 14209 {
14214 switch (attrib.Name.LocalName) 14210 switch (attrib.Name.LocalName)
14215 { 14211 {
14216 case "Id": 14212 case "Id":
14217 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 14213 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
14218 break; 14214 break;
14219 case "Account": 14215 case "Account":
14220 account = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14216 account = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14221 break; 14217 break;
14222 case "Arguments": 14218 case "Arguments":
14223 arguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14219 arguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14224 break; 14220 break;
14225 case "Description": 14221 case "Description":
14226 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14222 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14227 break; 14223 break;
14228 case "DisplayName": 14224 case "DisplayName":
14229 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14225 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14230 break; 14226 break;
14231 case "EraseDescription": 14227 case "EraseDescription":
14232 eraseDescription = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 14228 eraseDescription = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
14233 break; 14229 break;
14234 case "ErrorControl": 14230 case "ErrorControl":
14235 string errorControlValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14231 var errorControlValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14236 if (0 < errorControlValue.Length) 14232 if (0 < errorControlValue.Length)
14237 { 14233 {
14238 Wix.ServiceInstall.ErrorControlType errorControlType = Wix.ServiceInstall.ParseErrorControlType(errorControlValue); 14234 var errorControlType = Wix.ServiceInstall.ParseErrorControlType(errorControlValue);
14239 switch (errorControlType) 14235 switch (errorControlType)
14240 {
14241 case Wix.ServiceInstall.ErrorControlType.ignore:
14242 errorbits |= MsiInterop.MsidbServiceInstallErrorIgnore;
14243 break;
14244 case Wix.ServiceInstall.ErrorControlType.normal:
14245 errorbits |= MsiInterop.MsidbServiceInstallErrorNormal;
14246 break;
14247 case Wix.ServiceInstall.ErrorControlType.critical:
14248 errorbits |= MsiInterop.MsidbServiceInstallErrorCritical;
14249 break;
14250 default:
14251 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, errorControlValue, "ignore", "normal", "critical"));
14252 break;
14253 }
14254 }
14255 break;
14256 case "Interactive":
14257 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
14258 {
14259 typebits |= MsiInterop.MsidbServiceInstallInteractive;
14260 }
14261 break;
14262 case "LoadOrderGroup":
14263 loadOrderGroup = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14264 break;
14265 case "Name":
14266 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14267 break;
14268 case "Password":
14269 password = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14270 break;
14271 case "Start":
14272 string startValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14273 if (0 < startValue.Length)
14274 { 14236 {
14275 Wix.ServiceInstall.StartType start = Wix.ServiceInstall.ParseStartType(startValue); 14237 case Wix.ServiceInstall.ErrorControlType.ignore:
14276 switch (start) 14238 errorbits |= MsiInterop.MsidbServiceInstallErrorIgnore;
14277 { 14239 break;
14278 case Wix.ServiceInstall.StartType.auto: 14240 case Wix.ServiceInstall.ErrorControlType.normal:
14279 startType = MsiInterop.MsidbServiceInstallAutoStart; 14241 errorbits |= MsiInterop.MsidbServiceInstallErrorNormal;
14280 break; 14242 break;
14281 case Wix.ServiceInstall.StartType.demand: 14243 case Wix.ServiceInstall.ErrorControlType.critical:
14282 startType = MsiInterop.MsidbServiceInstallDemandStart; 14244 errorbits |= MsiInterop.MsidbServiceInstallErrorCritical;
14283 break; 14245 break;
14284 case Wix.ServiceInstall.StartType.disabled: 14246 default:
14285 startType = MsiInterop.MsidbServiceInstallDisabled; 14247 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, errorControlValue, "ignore", "normal", "critical"));
14286 break; 14248 break;
14287 case Wix.ServiceInstall.StartType.boot:
14288 case Wix.ServiceInstall.StartType.system:
14289 this.Core.Write(ErrorMessages.ValueNotSupported(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, startValue));
14290 break;
14291 default:
14292 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, startValue, "auto", "demand", "disabled"));
14293 break;
14294 }
14295 } 14249 }
14296 break; 14250 }
14297 case "Type": 14251 break;
14298 string typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14252 case "Interactive":
14299 if (0 < typeValue.Length) 14253 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
14254 {
14255 typebits |= MsiInterop.MsidbServiceInstallInteractive;
14256 }
14257 break;
14258 case "LoadOrderGroup":
14259 loadOrderGroup = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14260 break;
14261 case "Name":
14262 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14263 break;
14264 case "Password":
14265 password = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14266 break;
14267 case "Start":
14268 var startValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14269 if (0 < startValue.Length)
14270 {
14271 var start = Wix.ServiceInstall.ParseStartType(startValue);
14272 switch (start)
14300 { 14273 {
14301 Wix.ServiceInstall.TypeType typeType = Wix.ServiceInstall.ParseTypeType(typeValue); 14274 case Wix.ServiceInstall.StartType.auto:
14302 switch (typeType) 14275 startType = MsiInterop.MsidbServiceInstallAutoStart;
14303 { 14276 break;
14304 case Wix.ServiceInstall.TypeType.ownProcess: 14277 case Wix.ServiceInstall.StartType.demand:
14305 typebits |= MsiInterop.MsidbServiceInstallOwnProcess; 14278 startType = MsiInterop.MsidbServiceInstallDemandStart;
14306 break; 14279 break;
14307 case Wix.ServiceInstall.TypeType.shareProcess: 14280 case Wix.ServiceInstall.StartType.disabled:
14308 typebits |= MsiInterop.MsidbServiceInstallShareProcess; 14281 startType = MsiInterop.MsidbServiceInstallDisabled;
14309 break; 14282 break;
14310 case Wix.ServiceInstall.TypeType.kernelDriver: 14283 case Wix.ServiceInstall.StartType.boot:
14311 case Wix.ServiceInstall.TypeType.systemDriver: 14284 case Wix.ServiceInstall.StartType.system:
14312 this.Core.Write(ErrorMessages.ValueNotSupported(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typeValue)); 14285 this.Core.Write(ErrorMessages.ValueNotSupported(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, startValue));
14313 break; 14286 break;
14314 default: 14287 default:
14315 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, node.Name.LocalName, typeValue, "ownProcess", "shareProcess")); 14288 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, startValue, "auto", "demand", "disabled"));
14316 break; 14289 break;
14317 }
14318 } 14290 }
14319 break; 14291 }
14320 case "Vital": 14292 break;
14321 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 14293 case "Type":
14294 var typeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14295 if (0 < typeValue.Length)
14296 {
14297 var typeType = Wix.ServiceInstall.ParseTypeType(typeValue);
14298 switch (typeType)
14322 { 14299 {
14323 errorbits |= MsiInterop.MsidbServiceInstallErrorControlVital; 14300 case Wix.ServiceInstall.TypeType.ownProcess:
14301 typebits |= MsiInterop.MsidbServiceInstallOwnProcess;
14302 break;
14303 case Wix.ServiceInstall.TypeType.shareProcess:
14304 typebits |= MsiInterop.MsidbServiceInstallShareProcess;
14305 break;
14306 case Wix.ServiceInstall.TypeType.kernelDriver:
14307 case Wix.ServiceInstall.TypeType.systemDriver:
14308 this.Core.Write(ErrorMessages.ValueNotSupported(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, typeValue));
14309 break;
14310 default:
14311 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, node.Name.LocalName, typeValue, "ownProcess", "shareProcess"));
14312 break;
14324 } 14313 }
14325 break; 14314 }
14326 default: 14315 break;
14327 this.Core.UnexpectedAttribute(node, attrib); 14316 case "Vital":
14328 break; 14317 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
14318 {
14319 errorbits |= MsiInterop.MsidbServiceInstallErrorControlVital;
14320 }
14321 break;
14322 default:
14323 this.Core.UnexpectedAttribute(node, attrib);
14324 break;
14329 } 14325 }
14330 } 14326 }
14331 else 14327 else
@@ -14354,32 +14350,32 @@ namespace WixToolset.Core
14354 } 14350 }
14355 14351
14356 // get the ServiceInstall dependencies and config 14352 // get the ServiceInstall dependencies and config
14357 foreach (XElement child in node.Elements()) 14353 foreach (var child in node.Elements())
14358 { 14354 {
14359 if (CompilerCore.WixNamespace == child.Name.Namespace) 14355 if (CompilerCore.WixNamespace == child.Name.Namespace)
14360 { 14356 {
14361 switch (child.Name.LocalName) 14357 switch (child.Name.LocalName)
14362 { 14358 {
14363 case "PermissionEx": 14359 case "PermissionEx":
14364 this.ParsePermissionExElement(child, id.Id, "ServiceInstall"); 14360 this.ParsePermissionExElement(child, id.Id, "ServiceInstall");
14365 break; 14361 break;
14366 case "ServiceConfig": 14362 case "ServiceConfig":
14367 this.ParseServiceConfigElement(child, componentId, name); 14363 this.ParseServiceConfigElement(child, componentId, name);
14368 break; 14364 break;
14369 case "ServiceConfigFailureActions": 14365 case "ServiceConfigFailureActions":
14370 this.ParseServiceConfigFailureActionsElement(child, componentId, name); 14366 this.ParseServiceConfigFailureActionsElement(child, componentId, name);
14371 break; 14367 break;
14372 case "ServiceDependency": 14368 case "ServiceDependency":
14373 dependencies = String.Concat(dependencies, this.ParseServiceDependencyElement(child), "[~]"); 14369 dependencies = String.Concat(dependencies, this.ParseServiceDependencyElement(child), "[~]");
14374 break; 14370 break;
14375 default: 14371 default:
14376 this.Core.UnexpectedElement(node, child); 14372 this.Core.UnexpectedElement(node, child);
14377 break; 14373 break;
14378 } 14374 }
14379 } 14375 }
14380 else 14376 else
14381 { 14377 {
14382 Dictionary<string, string> context = new Dictionary<string, string>() { { "ServiceInstallId", id.Id }, { "ServiceInstallName", name }, { "ServiceInstallComponentId", componentId }, { "Win64", win64Component.ToString() } }; 14378 var context = new Dictionary<string, string>() { { "ServiceInstallId", id.Id }, { "ServiceInstallName", name }, { "ServiceInstallComponentId", componentId }, { "Win64", win64Component.ToString() } };
14383 this.Core.ParseExtensionElement(node, child, context); 14379 this.Core.ParseExtensionElement(node, child, context);
14384 } 14380 }
14385 } 14381 }
@@ -14413,59 +14409,59 @@ namespace WixToolset.Core
14413 /// <param name="node">Element to parse.</param> 14409 /// <param name="node">Element to parse.</param>
14414 private void ParseSetDirectoryElement(XElement node) 14410 private void ParseSetDirectoryElement(XElement node)
14415 { 14411 {
14416 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 14412 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
14417 string actionName = null; 14413 string actionName = null;
14418 string id = null; 14414 string id = null;
14419 string condition = null; 14415 string condition = null;
14420 string[] sequences = new string[] { "InstallUISequence", "InstallExecuteSequence" }; // default to "both" 14416 var sequences = new string[] { "InstallUISequence", "InstallExecuteSequence" }; // default to "both"
14421 int extraBits = 0; 14417 var extraBits = 0;
14422 string value = null; 14418 string value = null;
14423 14419
14424 foreach (XAttribute attrib in node.Attributes()) 14420 foreach (var attrib in node.Attributes())
14425 { 14421 {
14426 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 14422 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
14427 { 14423 {
14428 switch (attrib.Name.LocalName) 14424 switch (attrib.Name.LocalName)
14429 { 14425 {
14430 case "Action": 14426 case "Action":
14431 actionName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 14427 actionName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14432 break; 14428 break;
14433 case "Id": 14429 case "Id":
14434 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 14430 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14435 this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id); 14431 this.Core.CreateSimpleReference(sourceLineNumbers, "Directory", id);
14436 break; 14432 break;
14437 case "Sequence": 14433 case "Sequence":
14438 string sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14434 var sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14439 if (0 < sequenceValue.Length) 14435 if (0 < sequenceValue.Length)
14436 {
14437 var sequenceType = Wix.Enums.ParseSequenceType(sequenceValue);
14438 switch (sequenceType)
14440 { 14439 {
14441 Wix.SequenceType sequenceType = Wix.Enums.ParseSequenceType(sequenceValue); 14440 case Wix.SequenceType.execute:
14442 switch (sequenceType) 14441 sequences = new string[] { "InstallExecuteSequence" };
14443 { 14442 break;
14444 case Wix.SequenceType.execute: 14443 case Wix.SequenceType.ui:
14445 sequences = new string[] { "InstallExecuteSequence" }; 14444 sequences = new string[] { "InstallUISequence" };
14446 break; 14445 break;
14447 case Wix.SequenceType.ui: 14446 case Wix.SequenceType.first:
14448 sequences = new string[] { "InstallUISequence" }; 14447 extraBits = MsiInterop.MsidbCustomActionTypeFirstSequence;
14449 break; 14448 // default puts it in both sequence which is what we want
14450 case Wix.SequenceType.first: 14449 break;
14451 extraBits = MsiInterop.MsidbCustomActionTypeFirstSequence; 14450 case Wix.SequenceType.both:
14452 // default puts it in both sequence which is what we want 14451 // default so no work necessary.
14453 break; 14452 break;
14454 case Wix.SequenceType.both: 14453 default:
14455 // default so no work necessary. 14454 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, sequenceValue, "execute", "ui", "both"));
14456 break; 14455 break;
14457 default:
14458 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, sequenceValue, "execute", "ui", "both"));
14459 break;
14460 }
14461 } 14456 }
14462 break; 14457 }
14463 case "Value": 14458 break;
14464 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14459 case "Value":
14465 break; 14460 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14466 default: 14461 break;
14467 this.Core.UnexpectedAttribute(node, attrib); 14462 default:
14468 break; 14463 this.Core.UnexpectedAttribute(node, attrib);
14464 break;
14469 } 14465 }
14470 } 14466 }
14471 else 14467 else
@@ -14500,7 +14496,7 @@ namespace WixToolset.Core
14500 row.Set(2, id); 14496 row.Set(2, id);
14501 row.Set(3, value); 14497 row.Set(3, value);
14502 14498
14503 foreach (string sequence in sequences) 14499 foreach (var sequence in sequences)
14504 { 14500 {
14505 var sequenceRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixAction); 14501 var sequenceRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixAction);
14506 sequenceRow.Set(0, sequence); 14502 sequenceRow.Set(0, sequence);
@@ -14520,66 +14516,66 @@ namespace WixToolset.Core
14520 /// <param name="node">Element to parse.</param> 14516 /// <param name="node">Element to parse.</param>
14521 private void ParseSetPropertyElement(XElement node) 14517 private void ParseSetPropertyElement(XElement node)
14522 { 14518 {
14523 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 14519 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
14524 string actionName = null; 14520 string actionName = null;
14525 string id = null; 14521 string id = null;
14526 string afterAction = null; 14522 string afterAction = null;
14527 string beforeAction = null; 14523 string beforeAction = null;
14528 string condition = null; 14524 string condition = null;
14529 string[] sequences = new string[] { "InstallUISequence", "InstallExecuteSequence" }; // default to "both" 14525 var sequences = new string[] { "InstallUISequence", "InstallExecuteSequence" }; // default to "both"
14530 int extraBits = 0; 14526 var extraBits = 0;
14531 string value = null; 14527 string value = null;
14532 14528
14533 foreach (XAttribute attrib in node.Attributes()) 14529 foreach (var attrib in node.Attributes())
14534 { 14530 {
14535 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 14531 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
14536 { 14532 {
14537 switch (attrib.Name.LocalName) 14533 switch (attrib.Name.LocalName)
14538 { 14534 {
14539 case "Action": 14535 case "Action":
14540 actionName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 14536 actionName = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14541 break; 14537 break;
14542 case "Id": 14538 case "Id":
14543 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 14539 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14544 break; 14540 break;
14545 case "After": 14541 case "After":
14546 afterAction = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 14542 afterAction = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14547 break; 14543 break;
14548 case "Before": 14544 case "Before":
14549 beforeAction = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 14545 beforeAction = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14550 break; 14546 break;
14551 case "Sequence": 14547 case "Sequence":
14552 string sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14548 var sequenceValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14553 if (0 < sequenceValue.Length) 14549 if (0 < sequenceValue.Length)
14550 {
14551 var sequenceType = Wix.Enums.ParseSequenceType(sequenceValue);
14552 switch (sequenceType)
14554 { 14553 {
14555 Wix.SequenceType sequenceType = Wix.Enums.ParseSequenceType(sequenceValue); 14554 case Wix.SequenceType.execute:
14556 switch (sequenceType) 14555 sequences = new string[] { "InstallExecuteSequence" };
14557 { 14556 break;
14558 case Wix.SequenceType.execute: 14557 case Wix.SequenceType.ui:
14559 sequences = new string[] { "InstallExecuteSequence" }; 14558 sequences = new string[] { "InstallUISequence" };
14560 break; 14559 break;
14561 case Wix.SequenceType.ui: 14560 case Wix.SequenceType.first:
14562 sequences = new string[] { "InstallUISequence" }; 14561 extraBits = MsiInterop.MsidbCustomActionTypeFirstSequence;
14563 break; 14562 // default puts it in both sequence which is what we want
14564 case Wix.SequenceType.first: 14563 break;
14565 extraBits = MsiInterop.MsidbCustomActionTypeFirstSequence; 14564 case Wix.SequenceType.both:
14566 // default puts it in both sequence which is what we want 14565 // default so no work necessary.
14567 break; 14566 break;
14568 case Wix.SequenceType.both: 14567 default:
14569 // default so no work necessary. 14568 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, sequenceValue, "execute", "ui", "both"));
14570 break; 14569 break;
14571 default:
14572 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, sequenceValue, "execute", "ui", "both"));
14573 break;
14574 }
14575 } 14570 }
14576 break; 14571 }
14577 case "Value": 14572 break;
14578 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 14573 case "Value":
14579 break; 14574 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
14580 default: 14575 break;
14581 this.Core.UnexpectedAttribute(node, attrib); 14576 default:
14582 break; 14577 this.Core.UnexpectedAttribute(node, attrib);
14578 break;
14583 } 14579 }
14584 } 14580 }
14585 else 14581 else
@@ -14633,7 +14629,7 @@ namespace WixToolset.Core
14633 row.Set(2, id); 14629 row.Set(2, id);
14634 row.Set(3, value); 14630 row.Set(3, value);
14635 14631
14636 foreach (string sequence in sequences) 14632 foreach (var sequence in sequences)
14637 { 14633 {
14638 var sequenceRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixAction, new Identifier(AccessModifier.Public, sequence, actionName)); 14634 var sequenceRow = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixAction, new Identifier(AccessModifier.Public, sequence, actionName));
14639 sequenceRow.Set(0, sequence); 14635 sequenceRow.Set(0, sequence);
@@ -14678,21 +14674,21 @@ namespace WixToolset.Core
14678 /// <param name="parentSFPCatalog">Parent SFPCatalog.</param> 14674 /// <param name="parentSFPCatalog">Parent SFPCatalog.</param>
14679 private void ParseSFPFileElement(XElement node, string parentSFPCatalog) 14675 private void ParseSFPFileElement(XElement node, string parentSFPCatalog)
14680 { 14676 {
14681 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 14677 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
14682 string id = null; 14678 string id = null;
14683 14679
14684 foreach (XAttribute attrib in node.Attributes()) 14680 foreach (var attrib in node.Attributes())
14685 { 14681 {
14686 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 14682 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
14687 { 14683 {
14688 switch (attrib.Name.LocalName) 14684 switch (attrib.Name.LocalName)
14689 { 14685 {
14690 case "Id": 14686 case "Id":
14691 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 14687 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14692 break; 14688 break;
14693 default: 14689 default:
14694 this.Core.UnexpectedAttribute(node, attrib); 14690 this.Core.UnexpectedAttribute(node, attrib);
14695 break; 14691 break;
14696 } 14692 }
14697 } 14693 }
14698 else 14694 else
@@ -14723,31 +14719,31 @@ namespace WixToolset.Core
14723 /// <param name="parentSFPCatalog">Parent SFPCatalog.</param> 14719 /// <param name="parentSFPCatalog">Parent SFPCatalog.</param>
14724 private void ParseSFPCatalogElement(XElement node, ref string parentSFPCatalog) 14720 private void ParseSFPCatalogElement(XElement node, ref string parentSFPCatalog)
14725 { 14721 {
14726 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 14722 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
14727 string parentName = null; 14723 string parentName = null;
14728 string dependency = null; 14724 string dependency = null;
14729 string name = null; 14725 string name = null;
14730 string sourceFile = null; 14726 string sourceFile = null;
14731 14727
14732 foreach (XAttribute attrib in node.Attributes()) 14728 foreach (var attrib in node.Attributes())
14733 { 14729 {
14734 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 14730 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
14735 { 14731 {
14736 switch (attrib.Name.LocalName) 14732 switch (attrib.Name.LocalName)
14737 { 14733 {
14738 case "Dependency": 14734 case "Dependency":
14739 dependency = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14735 dependency = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14740 break; 14736 break;
14741 case "Name": 14737 case "Name":
14742 name = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); 14738 name = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
14743 parentSFPCatalog = name; 14739 parentSFPCatalog = name;
14744 break; 14740 break;
14745 case "SourceFile": 14741 case "SourceFile":
14746 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14742 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14747 break; 14743 break;
14748 default: 14744 default:
14749 this.Core.UnexpectedAttribute(node, attrib); 14745 this.Core.UnexpectedAttribute(node, attrib);
14750 break; 14746 break;
14751 } 14747 }
14752 } 14748 }
14753 else 14749 else
@@ -14766,26 +14762,26 @@ namespace WixToolset.Core
14766 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile")); 14762 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SourceFile"));
14767 } 14763 }
14768 14764
14769 foreach (XElement child in node.Elements()) 14765 foreach (var child in node.Elements())
14770 { 14766 {
14771 if (CompilerCore.WixNamespace == child.Name.Namespace) 14767 if (CompilerCore.WixNamespace == child.Name.Namespace)
14772 { 14768 {
14773 switch (child.Name.LocalName) 14769 switch (child.Name.LocalName)
14774 { 14770 {
14775 case "SFPCatalog": 14771 case "SFPCatalog":
14776 this.ParseSFPCatalogElement(child, ref parentName); 14772 this.ParseSFPCatalogElement(child, ref parentName);
14777 if (null != dependency && parentName == dependency) 14773 if (null != dependency && parentName == dependency)
14778 { 14774 {
14779 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Dependency")); 14775 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Dependency"));
14780 } 14776 }
14781 dependency = parentName; 14777 dependency = parentName;
14782 break; 14778 break;
14783 case "SFPFile": 14779 case "SFPFile":
14784 this.ParseSFPFileElement(child, name); 14780 this.ParseSFPFileElement(child, name);
14785 break; 14781 break;
14786 default: 14782 default:
14787 this.Core.UnexpectedElement(node, child); 14783 this.Core.UnexpectedElement(node, child);
14788 break; 14784 break;
14789 } 14785 }
14790 } 14786 }
14791 else 14787 else
@@ -14818,110 +14814,110 @@ namespace WixToolset.Core
14818 /// <param name="parentKeyPath">Flag to indicate whether the parent element is the keypath of a component or not (will only be true for file parent elements).</param> 14814 /// <param name="parentKeyPath">Flag to indicate whether the parent element is the keypath of a component or not (will only be true for file parent elements).</param>
14819 private void ParseShortcutElement(XElement node, string componentId, string parentElementLocalName, string defaultTarget, YesNoType parentKeyPath) 14815 private void ParseShortcutElement(XElement node, string componentId, string parentElementLocalName, string defaultTarget, YesNoType parentKeyPath)
14820 { 14816 {
14821 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 14817 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
14822 Identifier id = null; 14818 Identifier id = null;
14823 bool advertise = false; 14819 var advertise = false;
14824 string arguments = null; 14820 string arguments = null;
14825 string description = null; 14821 string description = null;
14826 string descriptionResourceDll = null; 14822 string descriptionResourceDll = null;
14827 int descriptionResourceId = CompilerConstants.IntegerNotSet; 14823 var descriptionResourceId = CompilerConstants.IntegerNotSet;
14828 string directory = null; 14824 string directory = null;
14829 string displayResourceDll = null; 14825 string displayResourceDll = null;
14830 int displayResourceId = CompilerConstants.IntegerNotSet; 14826 var displayResourceId = CompilerConstants.IntegerNotSet;
14831 int hotkey = CompilerConstants.IntegerNotSet; 14827 var hotkey = CompilerConstants.IntegerNotSet;
14832 string icon = null; 14828 string icon = null;
14833 int iconIndex = CompilerConstants.IntegerNotSet; 14829 var iconIndex = CompilerConstants.IntegerNotSet;
14834 string name = null; 14830 string name = null;
14835 string shortName = null; 14831 string shortName = null;
14836 int show = CompilerConstants.IntegerNotSet; 14832 var show = CompilerConstants.IntegerNotSet;
14837 string target = null; 14833 string target = null;
14838 string workingDirectory = null; 14834 string workingDirectory = null;
14839 14835
14840 foreach (XAttribute attrib in node.Attributes()) 14836 foreach (var attrib in node.Attributes())
14841 { 14837 {
14842 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 14838 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
14843 { 14839 {
14844 switch (attrib.Name.LocalName) 14840 switch (attrib.Name.LocalName)
14845 { 14841 {
14846 case "Id": 14842 case "Id":
14847 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 14843 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
14848 break; 14844 break;
14849 case "Advertise": 14845 case "Advertise":
14850 advertise = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 14846 advertise = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
14851 break; 14847 break;
14852 case "Arguments": 14848 case "Arguments":
14853 arguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14849 arguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14854 break; 14850 break;
14855 case "Description": 14851 case "Description":
14856 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14852 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14857 break; 14853 break;
14858 case "DescriptionResourceDll": 14854 case "DescriptionResourceDll":
14859 descriptionResourceDll = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14855 descriptionResourceDll = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14860 break; 14856 break;
14861 case "DescriptionResourceId": 14857 case "DescriptionResourceId":
14862 descriptionResourceId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 14858 descriptionResourceId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
14863 break; 14859 break;
14864 case "Directory": 14860 case "Directory":
14865 directory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); 14861 directory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null);
14866 break; 14862 break;
14867 case "DisplayResourceDll": 14863 case "DisplayResourceDll":
14868 displayResourceDll = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14864 displayResourceDll = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14869 break; 14865 break;
14870 case "DisplayResourceId": 14866 case "DisplayResourceId":
14871 displayResourceId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 14867 displayResourceId = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
14872 break; 14868 break;
14873 case "Hotkey": 14869 case "Hotkey":
14874 hotkey = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 14870 hotkey = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
14875 break; 14871 break;
14876 case "Icon": 14872 case "Icon":
14877 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 14873 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14878 this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon); 14874 this.Core.CreateSimpleReference(sourceLineNumbers, "Icon", icon);
14879 break; 14875 break;
14880 case "IconIndex": 14876 case "IconIndex":
14881 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, short.MinValue + 1, short.MaxValue); 14877 iconIndex = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int16.MinValue + 1, Int16.MaxValue);
14882 break; 14878 break;
14883 case "Name": 14879 case "Name":
14884 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); 14880 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
14885 break; 14881 break;
14886 case "ShortName": 14882 case "ShortName":
14887 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false); 14883 shortName = this.Core.GetAttributeShortFilename(sourceLineNumbers, attrib, false);
14888 break; 14884 break;
14889 case "Show": 14885 case "Show":
14890 string showValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 14886 var showValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14891 if (showValue.Length == 0) 14887 if (showValue.Length == 0)
14888 {
14889 show = CompilerConstants.IllegalInteger;
14890 }
14891 else
14892 {
14893 var showType = Wix.Shortcut.ParseShowType(showValue);
14894 switch (showType)
14892 { 14895 {
14896 case Wix.Shortcut.ShowType.normal:
14897 show = 1;
14898 break;
14899 case Wix.Shortcut.ShowType.maximized:
14900 show = 3;
14901 break;
14902 case Wix.Shortcut.ShowType.minimized:
14903 show = 7;
14904 break;
14905 default:
14906 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Show", showValue, "normal", "maximized", "minimized"));
14893 show = CompilerConstants.IllegalInteger; 14907 show = CompilerConstants.IllegalInteger;
14908 break;
14894 } 14909 }
14895 else 14910 }
14896 { 14911 break;
14897 Wix.Shortcut.ShowType showType = Wix.Shortcut.ParseShowType(showValue); 14912 case "Target":
14898 switch (showType) 14913 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14899 { 14914 break;
14900 case Wix.Shortcut.ShowType.normal: 14915 case "WorkingDirectory":
14901 show = 1; 14916 workingDirectory = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14902 break; 14917 break;
14903 case Wix.Shortcut.ShowType.maximized: 14918 default:
14904 show = 3; 14919 this.Core.UnexpectedAttribute(node, attrib);
14905 break; 14920 break;
14906 case Wix.Shortcut.ShowType.minimized:
14907 show = 7;
14908 break;
14909 default:
14910 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Show", showValue, "normal", "maximized", "minimized"));
14911 show = CompilerConstants.IllegalInteger;
14912 break;
14913 }
14914 }
14915 break;
14916 case "Target":
14917 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
14918 break;
14919 case "WorkingDirectory":
14920 workingDirectory = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
14921 break;
14922 default:
14923 this.Core.UnexpectedAttribute(node, attrib);
14924 break;
14925 } 14921 }
14926 } 14922 }
14927 else 14923 else
@@ -15011,21 +15007,21 @@ namespace WixToolset.Core
15011 id = this.Core.CreateIdentifier("sct", directory, LowercaseOrNull(name) ?? LowercaseOrNull(shortName)); 15007 id = this.Core.CreateIdentifier("sct", directory, LowercaseOrNull(name) ?? LowercaseOrNull(shortName));
15012 } 15008 }
15013 15009
15014 foreach (XElement child in node.Elements()) 15010 foreach (var child in node.Elements())
15015 { 15011 {
15016 if (CompilerCore.WixNamespace == child.Name.Namespace) 15012 if (CompilerCore.WixNamespace == child.Name.Namespace)
15017 { 15013 {
15018 switch (child.Name.LocalName) 15014 switch (child.Name.LocalName)
15019 { 15015 {
15020 case "Icon": 15016 case "Icon":
15021 icon = this.ParseIconElement(child); 15017 icon = this.ParseIconElement(child);
15022 break; 15018 break;
15023 case "ShortcutProperty": 15019 case "ShortcutProperty":
15024 this.ParseShortcutPropertyElement(child, id.Id); 15020 this.ParseShortcutPropertyElement(child, id.Id);
15025 break; 15021 break;
15026 default: 15022 default:
15027 this.Core.UnexpectedElement(node, child); 15023 this.Core.UnexpectedElement(node, child);
15028 break; 15024 break;
15029 } 15025 }
15030 } 15026 }
15031 else 15027 else
@@ -15038,7 +15034,7 @@ namespace WixToolset.Core
15038 { 15034 {
15039 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Shortcut, id); 15035 var row = this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.Shortcut, id);
15040 row.Set(1, directory); 15036 row.Set(1, directory);
15041 row.Set(2, GetMsiFilenameValue(shortName, name)); 15037 row.Set(2, this.GetMsiFilenameValue(shortName, name));
15042 row.Set(3, componentId); 15038 row.Set(3, componentId);
15043 if (advertise) 15039 if (advertise)
15044 { 15040 {
@@ -15096,29 +15092,29 @@ namespace WixToolset.Core
15096 /// <param name="node">Element to parse.</param> 15092 /// <param name="node">Element to parse.</param>
15097 private void ParseShortcutPropertyElement(XElement node, string shortcutId) 15093 private void ParseShortcutPropertyElement(XElement node, string shortcutId)
15098 { 15094 {
15099 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 15095 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
15100 Identifier id = null; 15096 Identifier id = null;
15101 string key = null; 15097 string key = null;
15102 string value = null; 15098 string value = null;
15103 15099
15104 foreach (XAttribute attrib in node.Attributes()) 15100 foreach (var attrib in node.Attributes())
15105 { 15101 {
15106 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 15102 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
15107 { 15103 {
15108 switch (attrib.Name.LocalName) 15104 switch (attrib.Name.LocalName)
15109 { 15105 {
15110 case "Id": 15106 case "Id":
15111 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 15107 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
15112 break; 15108 break;
15113 case "Key": 15109 case "Key":
15114 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15110 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15115 break; 15111 break;
15116 case "Value": 15112 case "Value":
15117 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15113 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15118 break; 15114 break;
15119 default: 15115 default:
15120 this.Core.UnexpectedAttribute(node, attrib); 15116 this.Core.UnexpectedAttribute(node, attrib);
15121 break; 15117 break;
15122 } 15118 }
15123 } 15119 }
15124 else 15120 else
@@ -15136,7 +15132,7 @@ namespace WixToolset.Core
15136 id = this.Core.CreateIdentifier("scp", shortcutId, key.ToUpperInvariant()); 15132 id = this.Core.CreateIdentifier("scp", shortcutId, key.ToUpperInvariant());
15137 } 15133 }
15138 15134
15139 string innerText = this.Core.GetTrimmedInnerText(node); 15135 var innerText = this.Core.GetTrimmedInnerText(node);
15140 if (!String.IsNullOrEmpty(innerText)) 15136 if (!String.IsNullOrEmpty(innerText))
15141 { 15137 {
15142 if (String.IsNullOrEmpty(value)) 15138 if (String.IsNullOrEmpty(value))
@@ -15174,78 +15170,78 @@ namespace WixToolset.Core
15174 /// <param name="win64Component">true if the component is 64-bit.</param> 15170 /// <param name="win64Component">true if the component is 64-bit.</param>
15175 private void ParseTypeLibElement(XElement node, string componentId, string fileServer, bool win64Component) 15171 private void ParseTypeLibElement(XElement node, string componentId, string fileServer, bool win64Component)
15176 { 15172 {
15177 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 15173 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
15178 string id = null; 15174 string id = null;
15179 YesNoType advertise = YesNoType.NotSet; 15175 var advertise = YesNoType.NotSet;
15180 int cost = CompilerConstants.IntegerNotSet; 15176 var cost = CompilerConstants.IntegerNotSet;
15181 string description = null; 15177 string description = null;
15182 int flags = 0; 15178 var flags = 0;
15183 string helpDirectory = null; 15179 string helpDirectory = null;
15184 int language = CompilerConstants.IntegerNotSet; 15180 var language = CompilerConstants.IntegerNotSet;
15185 int majorVersion = CompilerConstants.IntegerNotSet; 15181 var majorVersion = CompilerConstants.IntegerNotSet;
15186 int minorVersion = CompilerConstants.IntegerNotSet; 15182 var minorVersion = CompilerConstants.IntegerNotSet;
15187 long resourceId = CompilerConstants.LongNotSet; 15183 var resourceId = CompilerConstants.LongNotSet;
15188 15184
15189 foreach (XAttribute attrib in node.Attributes()) 15185 foreach (var attrib in node.Attributes())
15190 { 15186 {
15191 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 15187 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
15192 { 15188 {
15193 switch (attrib.Name.LocalName) 15189 switch (attrib.Name.LocalName)
15194 { 15190 {
15195 case "Id": 15191 case "Id":
15196 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 15192 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
15197 break; 15193 break;
15198 case "Advertise": 15194 case "Advertise":
15199 advertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 15195 advertise = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
15200 break; 15196 break;
15201 case "Control": 15197 case "Control":
15202 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 15198 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
15203 { 15199 {
15204 flags |= 2; 15200 flags |= 2;
15205 } 15201 }
15206 break; 15202 break;
15207 case "Cost": 15203 case "Cost":
15208 cost = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 15204 cost = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
15209 break; 15205 break;
15210 case "Description": 15206 case "Description":
15211 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15207 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15212 break; 15208 break;
15213 case "HasDiskImage": 15209 case "HasDiskImage":
15214 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 15210 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
15215 { 15211 {
15216 flags |= 8; 15212 flags |= 8;
15217 } 15213 }
15218 break; 15214 break;
15219 case "HelpDirectory": 15215 case "HelpDirectory":
15220 helpDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null); 15216 helpDirectory = this.Core.CreateDirectoryReferenceFromInlineSyntax(sourceLineNumbers, attrib, null);
15221 break; 15217 break;
15222 case "Hidden": 15218 case "Hidden":
15223 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 15219 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
15224 { 15220 {
15225 flags |= 4; 15221 flags |= 4;
15226 } 15222 }
15227 break; 15223 break;
15228 case "Language": 15224 case "Language":
15229 language = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 15225 language = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
15230 break; 15226 break;
15231 case "MajorVersion": 15227 case "MajorVersion":
15232 majorVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, ushort.MaxValue); 15228 majorVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, UInt16.MaxValue);
15233 break; 15229 break;
15234 case "MinorVersion": 15230 case "MinorVersion":
15235 minorVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); 15231 minorVersion = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Byte.MaxValue);
15236 break; 15232 break;
15237 case "ResourceId": 15233 case "ResourceId":
15238 resourceId = this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, int.MinValue, int.MaxValue); 15234 resourceId = this.Core.GetAttributeLongValue(sourceLineNumbers, attrib, Int32.MinValue, Int32.MaxValue);
15239 break; 15235 break;
15240 case "Restricted": 15236 case "Restricted":
15241 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 15237 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
15242 { 15238 {
15243 flags |= 1; 15239 flags |= 1;
15244 } 15240 }
15245 break; 15241 break;
15246 default: 15242 default:
15247 this.Core.UnexpectedAttribute(node, attrib); 15243 this.Core.UnexpectedAttribute(node, attrib);
15248 break; 15244 break;
15249 } 15245 }
15250 } 15246 }
15251 else 15247 else
@@ -15294,24 +15290,24 @@ namespace WixToolset.Core
15294 advertise = YesNoType.No; 15290 advertise = YesNoType.No;
15295 } 15291 }
15296 15292
15297 foreach (XElement child in node.Elements()) 15293 foreach (var child in node.Elements())
15298 { 15294 {
15299 if (CompilerCore.WixNamespace == child.Name.Namespace) 15295 if (CompilerCore.WixNamespace == child.Name.Namespace)
15300 { 15296 {
15301 switch (child.Name.LocalName) 15297 switch (child.Name.LocalName)
15302 { 15298 {
15303 case "AppId": 15299 case "AppId":
15304 this.ParseAppIdElement(child, componentId, YesNoType.NotSet, fileServer, id, registryVersion); 15300 this.ParseAppIdElement(child, componentId, YesNoType.NotSet, fileServer, id, registryVersion);
15305 break; 15301 break;
15306 case "Class": 15302 case "Class":
15307 this.ParseClassElement(child, componentId, YesNoType.NotSet, fileServer, id, registryVersion, null); 15303 this.ParseClassElement(child, componentId, YesNoType.NotSet, fileServer, id, registryVersion, null);
15308 break; 15304 break;
15309 case "Interface": 15305 case "Interface":
15310 this.ParseInterfaceElement(child, componentId, null, null, id, registryVersion); 15306 this.ParseInterfaceElement(child, componentId, null, null, id, registryVersion);
15311 break; 15307 break;
15312 default: 15308 default:
15313 this.Core.UnexpectedElement(node, child); 15309 this.Core.UnexpectedElement(node, child);
15314 break; 15310 break;
15315 } 15311 }
15316 } 15312 }
15317 else 15313 else
@@ -15391,7 +15387,7 @@ namespace WixToolset.Core
15391 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}", id, registryVersion), null, description, componentId); 15387 this.Core.CreateRegistryRow(sourceLineNumbers, MsiInterop.MsidbRegistryRootClassesRoot, String.Format(CultureInfo.InvariantCulture, @"TypeLib\{0}\{1}", id, registryVersion), null, description, componentId);
15392 15388
15393 // HKCR\TypeLib\[ID]\[MajorVersion].[MinorVersion]\[Language]\[win16|win32|win64], (Default) = [TypeLibPath]\[ResourceId] 15389 // HKCR\TypeLib\[ID]\[MajorVersion].[MinorVersion]\[Language]\[win16|win32|win64], (Default) = [TypeLibPath]\[ResourceId]
15394 string path = String.Concat("[#", fileServer, "]"); 15390 var path = String.Concat("[#", fileServer, "]");
15395 if (CompilerConstants.LongNotSet != resourceId) 15391 if (CompilerConstants.LongNotSet != resourceId)
15396 { 15392 {
15397 path = String.Concat(path, Path.DirectorySeparatorChar, resourceId.ToString(CultureInfo.InvariantCulture.NumberFormat)); 15393 path = String.Concat(path, Path.DirectorySeparatorChar, resourceId.ToString(CultureInfo.InvariantCulture.NumberFormat));
@@ -15415,55 +15411,55 @@ namespace WixToolset.Core
15415 /// <param name="node">Element to parse.</param> 15411 /// <param name="node">Element to parse.</param>
15416 private void ParseEmbeddedChainerElement(XElement node) 15412 private void ParseEmbeddedChainerElement(XElement node)
15417 { 15413 {
15418 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 15414 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
15419 Identifier id = null; 15415 Identifier id = null;
15420 string commandLine = null; 15416 string commandLine = null;
15421 string condition = null; 15417 string condition = null;
15422 string source = null; 15418 string source = null;
15423 int type = 0; 15419 var type = 0;
15424 15420
15425 foreach (XAttribute attrib in node.Attributes()) 15421 foreach (var attrib in node.Attributes())
15426 { 15422 {
15427 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 15423 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
15428 { 15424 {
15429 switch (attrib.Name.LocalName) 15425 switch (attrib.Name.LocalName)
15430 { 15426 {
15431 case "Id": 15427 case "Id":
15432 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 15428 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
15433 break; 15429 break;
15434 case "BinarySource": 15430 case "BinarySource":
15435 if (null != source) 15431 if (null != source)
15436 { 15432 {
15437 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "FileSource", "PropertySource")); 15433 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "FileSource", "PropertySource"));
15438 } 15434 }
15439 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 15435 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
15440 type = MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeBinaryData; 15436 type = MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeBinaryData;
15441 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary 15437 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", source); // add a reference to the appropriate Binary
15442 break; 15438 break;
15443 case "CommandLine": 15439 case "CommandLine":
15444 commandLine = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15440 commandLine = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15445 break; 15441 break;
15446 case "FileSource": 15442 case "FileSource":
15447 if (null != source) 15443 if (null != source)
15448 { 15444 {
15449 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinarySource", "PropertySource")); 15445 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinarySource", "PropertySource"));
15450 } 15446 }
15451 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 15447 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
15452 type = MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeSourceFile; 15448 type = MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeSourceFile;
15453 this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File 15449 this.Core.CreateSimpleReference(sourceLineNumbers, "File", source); // add a reference to the appropriate File
15454 break; 15450 break;
15455 case "PropertySource": 15451 case "PropertySource":
15456 if (null != source) 15452 if (null != source)
15457 { 15453 {
15458 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinarySource", "FileSource")); 15454 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "BinarySource", "FileSource"));
15459 } 15455 }
15460 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 15456 source = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
15461 type = MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeProperty; 15457 type = MsiInterop.MsidbCustomActionTypeExe + MsiInterop.MsidbCustomActionTypeProperty;
15462 // cannot add a reference to a Property because it may be created at runtime. 15458 // cannot add a reference to a Property because it may be created at runtime.
15463 break; 15459 break;
15464 default: 15460 default:
15465 this.Core.UnexpectedAttribute(node, attrib); 15461 this.Core.UnexpectedAttribute(node, attrib);
15466 break; 15462 break;
15467 } 15463 }
15468 } 15464 }
15469 else 15465 else
@@ -15501,22 +15497,22 @@ namespace WixToolset.Core
15501 /// <param name="node">Element to parse.</param> 15497 /// <param name="node">Element to parse.</param>
15502 private void ParseUIElement(XElement node) 15498 private void ParseUIElement(XElement node)
15503 { 15499 {
15504 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 15500 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
15505 Identifier id = null; 15501 Identifier id = null;
15506 int embeddedUICount = 0; 15502 var embeddedUICount = 0;
15507 15503
15508 foreach (XAttribute attrib in node.Attributes()) 15504 foreach (var attrib in node.Attributes())
15509 { 15505 {
15510 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 15506 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
15511 { 15507 {
15512 switch (attrib.Name.LocalName) 15508 switch (attrib.Name.LocalName)
15513 { 15509 {
15514 case "Id": 15510 case "Id":
15515 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 15511 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
15516 break; 15512 break;
15517 default: 15513 default:
15518 this.Core.UnexpectedAttribute(node, attrib); 15514 this.Core.UnexpectedAttribute(node, attrib);
15519 break; 15515 break;
15520 } 15516 }
15521 } 15517 }
15522 else 15518 else
@@ -15525,85 +15521,85 @@ namespace WixToolset.Core
15525 } 15521 }
15526 } 15522 }
15527 15523
15528 foreach (XElement child in node.Elements()) 15524 foreach (var child in node.Elements())
15529 { 15525 {
15530 if (CompilerCore.WixNamespace == child.Name.Namespace) 15526 if (CompilerCore.WixNamespace == child.Name.Namespace)
15531 { 15527 {
15532 switch (child.Name.LocalName) 15528 switch (child.Name.LocalName)
15533 { 15529 {
15534 case "BillboardAction": 15530 case "BillboardAction":
15535 this.ParseBillboardActionElement(child); 15531 this.ParseBillboardActionElement(child);
15536 break; 15532 break;
15537 case "ComboBox": 15533 case "ComboBox":
15538 this.ParseControlGroupElement(child, TupleDefinitionType.ComboBox, "ListItem"); 15534 this.ParseControlGroupElement(child, TupleDefinitionType.ComboBox, "ListItem");
15539 break; 15535 break;
15540 case "Dialog": 15536 case "Dialog":
15541 this.ParseDialogElement(child); 15537 this.ParseDialogElement(child);
15542 break; 15538 break;
15543 case "DialogRef": 15539 case "DialogRef":
15544 this.ParseSimpleRefElement(child, "Dialog"); 15540 this.ParseSimpleRefElement(child, "Dialog");
15545 break; 15541 break;
15546 case "EmbeddedUI": 15542 case "EmbeddedUI":
15547 if (0 < embeddedUICount) // there can be only one embedded UI 15543 if (0 < embeddedUICount) // there can be only one embedded UI
15548 { 15544 {
15549 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 15545 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
15550 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); 15546 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName));
15551 } 15547 }
15552 this.ParseEmbeddedUIElement(child); 15548 this.ParseEmbeddedUIElement(child);
15553 ++embeddedUICount; 15549 ++embeddedUICount;
15554 break; 15550 break;
15555 case "Error": 15551 case "Error":
15556 this.ParseErrorElement(child); 15552 this.ParseErrorElement(child);
15557 break; 15553 break;
15558 case "ListBox": 15554 case "ListBox":
15559 this.ParseControlGroupElement(child, TupleDefinitionType.ListBox, "ListItem"); 15555 this.ParseControlGroupElement(child, TupleDefinitionType.ListBox, "ListItem");
15560 break; 15556 break;
15561 case "ListView": 15557 case "ListView":
15562 this.ParseControlGroupElement(child, TupleDefinitionType.ListView, "ListItem"); 15558 this.ParseControlGroupElement(child, TupleDefinitionType.ListView, "ListItem");
15563 break; 15559 break;
15564 case "ProgressText": 15560 case "ProgressText":
15565 this.ParseActionTextElement(child); 15561 this.ParseActionTextElement(child);
15566 break; 15562 break;
15567 case "Publish": 15563 case "Publish":
15568 int order = 0; 15564 var order = 0;
15569 this.ParsePublishElement(child, null, null, ref order); 15565 this.ParsePublishElement(child, null, null, ref order);
15570 break; 15566 break;
15571 case "RadioButtonGroup": 15567 case "RadioButtonGroup":
15572 RadioButtonType radioButtonType = this.ParseRadioButtonGroupElement(child, null, RadioButtonType.NotSet); 15568 var radioButtonType = this.ParseRadioButtonGroupElement(child, null, RadioButtonType.NotSet);
15573 if (RadioButtonType.Bitmap == radioButtonType || RadioButtonType.Icon == radioButtonType) 15569 if (RadioButtonType.Bitmap == radioButtonType || RadioButtonType.Icon == radioButtonType)
15574 { 15570 {
15575 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 15571 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
15576 this.Core.Write(ErrorMessages.RadioButtonBitmapAndIconDisallowed(childSourceLineNumbers)); 15572 this.Core.Write(ErrorMessages.RadioButtonBitmapAndIconDisallowed(childSourceLineNumbers));
15577 } 15573 }
15578 break; 15574 break;
15579 case "TextStyle": 15575 case "TextStyle":
15580 this.ParseTextStyleElement(child); 15576 this.ParseTextStyleElement(child);
15581 break; 15577 break;
15582 case "UIText": 15578 case "UIText":
15583 this.ParseUITextElement(child); 15579 this.ParseUITextElement(child);
15584 break; 15580 break;
15585 15581
15586 // the following are available indentically under the UI and Product elements for document organization use only 15582 // the following are available indentically under the UI and Product elements for document organization use only
15587 case "AdminUISequence": 15583 case "AdminUISequence":
15588 case "InstallUISequence": 15584 case "InstallUISequence":
15589 this.ParseSequenceElement(child, child.Name.LocalName); 15585 this.ParseSequenceElement(child, child.Name.LocalName);
15590 break; 15586 break;
15591 case "Binary": 15587 case "Binary":
15592 this.ParseBinaryElement(child); 15588 this.ParseBinaryElement(child);
15593 break; 15589 break;
15594 case "Property": 15590 case "Property":
15595 this.ParsePropertyElement(child); 15591 this.ParsePropertyElement(child);
15596 break; 15592 break;
15597 case "PropertyRef": 15593 case "PropertyRef":
15598 this.ParseSimpleRefElement(child, "Property"); 15594 this.ParseSimpleRefElement(child, "Property");
15599 break; 15595 break;
15600 case "UIRef": 15596 case "UIRef":
15601 this.ParseSimpleRefElement(child, "WixUI"); 15597 this.ParseSimpleRefElement(child, "WixUI");
15602 break; 15598 break;
15603 15599
15604 default: 15600 default:
15605 this.Core.UnexpectedElement(node, child); 15601 this.Core.UnexpectedElement(node, child);
15606 break; 15602 break;
15607 } 15603 }
15608 } 15604 }
15609 else 15605 else
@@ -15627,37 +15623,37 @@ namespace WixToolset.Core
15627 /// <param name="order">Relative order of list items.</param> 15623 /// <param name="order">Relative order of list items.</param>
15628 private void ParseListItemElement(XElement node, TupleDefinitionType tableName, string property, ref int order) 15624 private void ParseListItemElement(XElement node, TupleDefinitionType tableName, string property, ref int order)
15629 { 15625 {
15630 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 15626 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
15631 string icon = null; 15627 string icon = null;
15632 string text = null; 15628 string text = null;
15633 string value = null; 15629 string value = null;
15634 15630
15635 foreach (XAttribute attrib in node.Attributes()) 15631 foreach (var attrib in node.Attributes())
15636 { 15632 {
15637 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 15633 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
15638 { 15634 {
15639 switch (attrib.Name.LocalName) 15635 switch (attrib.Name.LocalName)
15640 { 15636 {
15641 case "Icon": 15637 case "Icon":
15642 if (TupleDefinitionType.ListView == tableName) 15638 if (TupleDefinitionType.ListView == tableName)
15643 { 15639 {
15644 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 15640 icon = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
15645 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", icon); 15641 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", icon);
15646 } 15642 }
15647 else 15643 else
15648 { 15644 {
15649 this.Core.Write(ErrorMessages.IllegalAttributeExceptOnElement(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ListView")); 15645 this.Core.Write(ErrorMessages.IllegalAttributeExceptOnElement(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ListView"));
15650 } 15646 }
15651 break; 15647 break;
15652 case "Text": 15648 case "Text":
15653 text = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15649 text = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15654 break; 15650 break;
15655 case "Value": 15651 case "Value":
15656 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15652 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15657 break; 15653 break;
15658 default: 15654 default:
15659 this.Core.UnexpectedAttribute(node, attrib); 15655 this.Core.UnexpectedAttribute(node, attrib);
15660 break; 15656 break;
15661 } 15657 }
15662 } 15658 }
15663 else 15659 else
@@ -15696,8 +15692,8 @@ namespace WixToolset.Core
15696 /// <returns>Type of this radio button.</returns> 15692 /// <returns>Type of this radio button.</returns>
15697 private RadioButtonType ParseRadioButtonElement(XElement node, string property, ref int order) 15693 private RadioButtonType ParseRadioButtonElement(XElement node, string property, ref int order)
15698 { 15694 {
15699 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 15695 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
15700 RadioButtonType type = RadioButtonType.NotSet; 15696 var type = RadioButtonType.NotSet;
15701 string value = null; 15697 string value = null;
15702 string x = null; 15698 string x = null;
15703 string y = null; 15699 string y = null;
@@ -15707,62 +15703,62 @@ namespace WixToolset.Core
15707 string tooltip = null; 15703 string tooltip = null;
15708 string help = null; 15704 string help = null;
15709 15705
15710 foreach (XAttribute attrib in node.Attributes()) 15706 foreach (var attrib in node.Attributes())
15711 { 15707 {
15712 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 15708 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
15713 { 15709 {
15714 switch (attrib.Name.LocalName) 15710 switch (attrib.Name.LocalName)
15715 { 15711 {
15716 case "Bitmap": 15712 case "Bitmap":
15717 if (RadioButtonType.NotSet != type) 15713 if (RadioButtonType.NotSet != type)
15718 { 15714 {
15719 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Icon", "Text")); 15715 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Icon", "Text"));
15720 } 15716 }
15721 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 15717 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
15722 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text); 15718 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text);
15723 type = RadioButtonType.Bitmap; 15719 type = RadioButtonType.Bitmap;
15724 break; 15720 break;
15725 case "Height": 15721 case "Height":
15726 height = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 15722 height = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
15727 break; 15723 break;
15728 case "Help": 15724 case "Help":
15729 help = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15725 help = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15730 break; 15726 break;
15731 case "Icon": 15727 case "Icon":
15732 if (RadioButtonType.NotSet != type) 15728 if (RadioButtonType.NotSet != type)
15733 { 15729 {
15734 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Text")); 15730 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Text"));
15735 } 15731 }
15736 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 15732 text = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
15737 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text); 15733 this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", text);
15738 type = RadioButtonType.Icon; 15734 type = RadioButtonType.Icon;
15739 break; 15735 break;
15740 case "Text": 15736 case "Text":
15741 if (RadioButtonType.NotSet != type) 15737 if (RadioButtonType.NotSet != type)
15742 { 15738 {
15743 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Icon")); 15739 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "Bitmap", "Icon"));
15744 } 15740 }
15745 text = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15741 text = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15746 type = RadioButtonType.Text; 15742 type = RadioButtonType.Text;
15747 break; 15743 break;
15748 case "ToolTip": 15744 case "ToolTip":
15749 tooltip = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15745 tooltip = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15750 break; 15746 break;
15751 case "Value": 15747 case "Value":
15752 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 15748 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
15753 break; 15749 break;
15754 case "Width": 15750 case "Width":
15755 width = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 15751 width = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
15756 break; 15752 break;
15757 case "X": 15753 case "X":
15758 x = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 15754 x = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
15759 break; 15755 break;
15760 case "Y": 15756 case "Y":
15761 y = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 15757 y = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
15762 break; 15758 break;
15763 default: 15759 default:
15764 this.Core.UnexpectedAttribute(node, attrib); 15760 this.Core.UnexpectedAttribute(node, attrib);
15765 break; 15761 break;
15766 } 15762 }
15767 } 15763 }
15768 else 15764 else
@@ -15824,23 +15820,23 @@ namespace WixToolset.Core
15824 /// <param name="node">Element to parse.</param> 15820 /// <param name="node">Element to parse.</param>
15825 private void ParseBillboardActionElement(XElement node) 15821 private void ParseBillboardActionElement(XElement node)
15826 { 15822 {
15827 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 15823 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
15828 string action = null; 15824 string action = null;
15829 int order = 0; 15825 var order = 0;
15830 15826
15831 foreach (XAttribute attrib in node.Attributes()) 15827 foreach (var attrib in node.Attributes())
15832 { 15828 {
15833 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 15829 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
15834 { 15830 {
15835 switch (attrib.Name.LocalName) 15831 switch (attrib.Name.LocalName)
15836 { 15832 {
15837 case "Id": 15833 case "Id":
15838 action = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 15834 action = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
15839 this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", action); 15835 this.Core.CreateSimpleReference(sourceLineNumbers, "WixAction", "InstallExecuteSequence", action);
15840 break; 15836 break;
15841 default: 15837 default:
15842 this.Core.UnexpectedAttribute(node, attrib); 15838 this.Core.UnexpectedAttribute(node, attrib);
15843 break; 15839 break;
15844 } 15840 }
15845 } 15841 }
15846 else 15842 else
@@ -15854,19 +15850,19 @@ namespace WixToolset.Core
15854 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); 15850 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
15855 } 15851 }
15856 15852
15857 foreach (XElement child in node.Elements()) 15853 foreach (var child in node.Elements())
15858 { 15854 {
15859 if (CompilerCore.WixNamespace == child.Name.Namespace) 15855 if (CompilerCore.WixNamespace == child.Name.Namespace)
15860 { 15856 {
15861 switch (child.Name.LocalName) 15857 switch (child.Name.LocalName)
15862 { 15858 {
15863 case "Billboard": 15859 case "Billboard":
15864 order = order + 1; 15860 order = order + 1;
15865 this.ParseBillboardElement(child, action, order); 15861 this.ParseBillboardElement(child, action, order);
15866 break; 15862 break;
15867 default: 15863 default:
15868 this.Core.UnexpectedElement(node, child); 15864 this.Core.UnexpectedElement(node, child);
15869 break; 15865 break;
15870 } 15866 }
15871 } 15867 }
15872 else 15868 else
@@ -15884,26 +15880,26 @@ namespace WixToolset.Core
15884 /// <param name="order">Order of the billboard.</param> 15880 /// <param name="order">Order of the billboard.</param>
15885 private void ParseBillboardElement(XElement node, string action, int order) 15881 private void ParseBillboardElement(XElement node, string action, int order)
15886 { 15882 {
15887 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 15883 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
15888 Identifier id = null; 15884 Identifier id = null;
15889 string feature = null; 15885 string feature = null;
15890 15886
15891 foreach (XAttribute attrib in node.Attributes()) 15887 foreach (var attrib in node.Attributes())
15892 { 15888 {
15893 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 15889 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
15894 { 15890 {
15895 switch (attrib.Name.LocalName) 15891 switch (attrib.Name.LocalName)
15896 { 15892 {
15897 case "Id": 15893 case "Id":
15898 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 15894 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
15899 break; 15895 break;
15900 case "Feature": 15896 case "Feature":
15901 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 15897 feature = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
15902 this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature); 15898 this.Core.CreateSimpleReference(sourceLineNumbers, "Feature", feature);
15903 break; 15899 break;
15904 default: 15900 default:
15905 this.Core.UnexpectedAttribute(node, attrib); 15901 this.Core.UnexpectedAttribute(node, attrib);
15906 break; 15902 break;
15907 } 15903 }
15908 } 15904 }
15909 else 15905 else
@@ -15917,24 +15913,24 @@ namespace WixToolset.Core
15917 id = this.Core.CreateIdentifier("bil", action, order.ToString(), feature); 15913 id = this.Core.CreateIdentifier("bil", action, order.ToString(), feature);
15918 } 15914 }
15919 15915
15920 foreach (XElement child in node.Elements()) 15916 foreach (var child in node.Elements())
15921 { 15917 {
15922 if (CompilerCore.WixNamespace == child.Name.Namespace) 15918 if (CompilerCore.WixNamespace == child.Name.Namespace)
15923 { 15919 {
15924 switch (child.Name.LocalName) 15920 switch (child.Name.LocalName)
15925 { 15921 {
15926 case "Control": 15922 case "Control":
15927 // These are all thrown away. 15923 // These are all thrown away.
15928 IntermediateTuple lastTabRow = null; 15924 IntermediateTuple lastTabRow = null;
15929 string firstControl = null; 15925 string firstControl = null;
15930 string defaultControl = null; 15926 string defaultControl = null;
15931 string cancelControl = null; 15927 string cancelControl = null;
15932 15928
15933 this.ParseControlElement(child, id.Id, TupleDefinitionType.BBControl, ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl, false); 15929 this.ParseControlElement(child, id.Id, TupleDefinitionType.BBControl, ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl, false);
15934 break; 15930 break;
15935 default: 15931 default:
15936 this.Core.UnexpectedElement(node, child); 15932 this.Core.UnexpectedElement(node, child);
15937 break; 15933 break;
15938 } 15934 }
15939 } 15935 }
15940 else 15936 else
@@ -15961,22 +15957,22 @@ namespace WixToolset.Core
15961 /// <param name="childTag">Expected child elements.</param> 15957 /// <param name="childTag">Expected child elements.</param>
15962 private void ParseControlGroupElement(XElement node, TupleDefinitionType tableName, string childTag) 15958 private void ParseControlGroupElement(XElement node, TupleDefinitionType tableName, string childTag)
15963 { 15959 {
15964 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 15960 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
15965 int order = 0; 15961 var order = 0;
15966 string property = null; 15962 string property = null;
15967 15963
15968 foreach (XAttribute attrib in node.Attributes()) 15964 foreach (var attrib in node.Attributes())
15969 { 15965 {
15970 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 15966 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
15971 { 15967 {
15972 switch (attrib.Name.LocalName) 15968 switch (attrib.Name.LocalName)
15973 { 15969 {
15974 case "Property": 15970 case "Property":
15975 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 15971 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
15976 break; 15972 break;
15977 default: 15973 default:
15978 this.Core.UnexpectedAttribute(node, attrib); 15974 this.Core.UnexpectedAttribute(node, attrib);
15979 break; 15975 break;
15980 } 15976 }
15981 } 15977 }
15982 else 15978 else
@@ -15990,7 +15986,7 @@ namespace WixToolset.Core
15990 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); 15986 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property"));
15991 } 15987 }
15992 15988
15993 foreach (XElement child in node.Elements()) 15989 foreach (var child in node.Elements())
15994 { 15990 {
15995 if (CompilerCore.WixNamespace == child.Name.Namespace) 15991 if (CompilerCore.WixNamespace == child.Name.Namespace)
15996 { 15992 {
@@ -16001,15 +15997,15 @@ namespace WixToolset.Core
16001 15997
16002 switch (child.Name.LocalName) 15998 switch (child.Name.LocalName)
16003 { 15999 {
16004 case "ListItem": 16000 case "ListItem":
16005 this.ParseListItemElement(child, tableName, property, ref order); 16001 this.ParseListItemElement(child, tableName, property, ref order);
16006 break; 16002 break;
16007 case "Property": 16003 case "Property":
16008 this.ParsePropertyElement(child); 16004 this.ParsePropertyElement(child);
16009 break; 16005 break;
16010 default: 16006 default:
16011 this.Core.UnexpectedElement(node, child); 16007 this.Core.UnexpectedElement(node, child);
16012 break; 16008 break;
16013 } 16009 }
16014 } 16010 }
16015 else 16011 else
@@ -16029,22 +16025,22 @@ namespace WixToolset.Core
16029 /// <returns>The current type of radio buttons in the group.</returns> 16025 /// <returns>The current type of radio buttons in the group.</returns>
16030 private RadioButtonType ParseRadioButtonGroupElement(XElement node, string property, RadioButtonType groupType) 16026 private RadioButtonType ParseRadioButtonGroupElement(XElement node, string property, RadioButtonType groupType)
16031 { 16027 {
16032 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 16028 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
16033 int order = 0; 16029 var order = 0;
16034 16030
16035 foreach (XAttribute attrib in node.Attributes()) 16031 foreach (var attrib in node.Attributes())
16036 { 16032 {
16037 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 16033 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
16038 { 16034 {
16039 switch (attrib.Name.LocalName) 16035 switch (attrib.Name.LocalName)
16040 { 16036 {
16041 case "Property": 16037 case "Property":
16042 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 16038 property = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
16043 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property); 16039 this.Core.CreateSimpleReference(sourceLineNumbers, "Property", property);
16044 break; 16040 break;
16045 default: 16041 default:
16046 this.Core.UnexpectedAttribute(node, attrib); 16042 this.Core.UnexpectedAttribute(node, attrib);
16047 break; 16043 break;
16048 } 16044 }
16049 } 16045 }
16050 else 16046 else
@@ -16058,27 +16054,27 @@ namespace WixToolset.Core
16058 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property")); 16054 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Property"));
16059 } 16055 }
16060 16056
16061 foreach (XElement child in node.Elements()) 16057 foreach (var child in node.Elements())
16062 { 16058 {
16063 if (CompilerCore.WixNamespace == child.Name.Namespace) 16059 if (CompilerCore.WixNamespace == child.Name.Namespace)
16064 { 16060 {
16065 switch (child.Name.LocalName) 16061 switch (child.Name.LocalName)
16066 { 16062 {
16067 case "RadioButton": 16063 case "RadioButton":
16068 RadioButtonType type = this.ParseRadioButtonElement(child, property, ref order); 16064 var type = this.ParseRadioButtonElement(child, property, ref order);
16069 if (RadioButtonType.NotSet == groupType) 16065 if (RadioButtonType.NotSet == groupType)
16070 { 16066 {
16071 groupType = type; 16067 groupType = type;
16072 } 16068 }
16073 else if (groupType != type) 16069 else if (groupType != type)
16074 { 16070 {
16075 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 16071 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
16076 this.Core.Write(ErrorMessages.RadioButtonTypeInconsistent(childSourceLineNumbers)); 16072 this.Core.Write(ErrorMessages.RadioButtonTypeInconsistent(childSourceLineNumbers));
16077 } 16073 }
16078 break; 16074 break;
16079 default: 16075 default:
16080 this.Core.UnexpectedElement(node, child); 16076 this.Core.UnexpectedElement(node, child);
16081 break; 16077 break;
16082 } 16078 }
16083 } 16079 }
16084 else 16080 else
@@ -16097,25 +16093,25 @@ namespace WixToolset.Core
16097 /// <param name="node">Element to parse.</param> 16093 /// <param name="node">Element to parse.</param>
16098 private void ParseActionTextElement(XElement node) 16094 private void ParseActionTextElement(XElement node)
16099 { 16095 {
16100 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 16096 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
16101 string action = null; 16097 string action = null;
16102 string template = null; 16098 string template = null;
16103 16099
16104 foreach (XAttribute attrib in node.Attributes()) 16100 foreach (var attrib in node.Attributes())
16105 { 16101 {
16106 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 16102 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
16107 { 16103 {
16108 switch (attrib.Name.LocalName) 16104 switch (attrib.Name.LocalName)
16109 { 16105 {
16110 case "Action": 16106 case "Action":
16111 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16107 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16112 break; 16108 break;
16113 case "Template": 16109 case "Template":
16114 template = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16110 template = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16115 break; 16111 break;
16116 default: 16112 default:
16117 this.Core.UnexpectedAttribute(node, attrib); 16113 this.Core.UnexpectedAttribute(node, attrib);
16118 break; 16114 break;
16119 } 16115 }
16120 } 16116 }
16121 else 16117 else
@@ -16146,22 +16142,22 @@ namespace WixToolset.Core
16146 /// <param name="node">Element to parse.</param> 16142 /// <param name="node">Element to parse.</param>
16147 private void ParseUITextElement(XElement node) 16143 private void ParseUITextElement(XElement node)
16148 { 16144 {
16149 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 16145 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
16150 Identifier id = null; 16146 Identifier id = null;
16151 string text = null; 16147 string text = null;
16152 16148
16153 foreach (XAttribute attrib in node.Attributes()) 16149 foreach (var attrib in node.Attributes())
16154 { 16150 {
16155 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 16151 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
16156 { 16152 {
16157 switch (attrib.Name.LocalName) 16153 switch (attrib.Name.LocalName)
16158 { 16154 {
16159 case "Id": 16155 case "Id":
16160 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 16156 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
16161 break; 16157 break;
16162 default: 16158 default:
16163 this.Core.UnexpectedAttribute(node, attrib); 16159 this.Core.UnexpectedAttribute(node, attrib);
16164 break; 16160 break;
16165 } 16161 }
16166 } 16162 }
16167 else 16163 else
@@ -16192,104 +16188,104 @@ namespace WixToolset.Core
16192 /// <param name="node">Element to parse.</param> 16188 /// <param name="node">Element to parse.</param>
16193 private void ParseTextStyleElement(XElement node) 16189 private void ParseTextStyleElement(XElement node)
16194 { 16190 {
16195 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 16191 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
16196 Identifier id = null; 16192 Identifier id = null;
16197 int bits = 0; 16193 var bits = 0;
16198 int color = CompilerConstants.IntegerNotSet; 16194 var color = CompilerConstants.IntegerNotSet;
16199 string faceName = null; 16195 string faceName = null;
16200 string size = "0"; 16196 var size = "0";
16201 16197
16202 foreach (XAttribute attrib in node.Attributes()) 16198 foreach (var attrib in node.Attributes())
16203 { 16199 {
16204 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 16200 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
16205 { 16201 {
16206 switch (attrib.Name.LocalName) 16202 switch (attrib.Name.LocalName)
16207 { 16203 {
16208 case "Id": 16204 case "Id":
16209 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 16205 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
16210 break; 16206 break;
16211 16207
16212 // RGB Values 16208 // RGB Values
16213 case "Red": 16209 case "Red":
16214 int redColor = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue); 16210 var redColor = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Byte.MaxValue);
16215 if (CompilerConstants.IllegalInteger != redColor) 16211 if (CompilerConstants.IllegalInteger != redColor)
16212 {
16213 if (CompilerConstants.IntegerNotSet == color)
16216 { 16214 {
16217 if (CompilerConstants.IntegerNotSet == color) 16215 color = redColor;
16218 {
16219 color = redColor;
16220 }
16221 else
16222 {
16223 color += redColor;
16224 }
16225 } 16216 }
16226 break; 16217 else
16227 case "Green":
16228 int greenColor = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue);
16229 if (CompilerConstants.IllegalInteger != greenColor)
16230 {
16231 if (CompilerConstants.IntegerNotSet == color)
16232 {
16233 color = greenColor * 256;
16234 }
16235 else
16236 {
16237 color += greenColor * 256;
16238 }
16239 }
16240 break;
16241 case "Blue":
16242 int blueColor = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, byte.MaxValue);
16243 if (CompilerConstants.IllegalInteger != blueColor)
16244 { 16218 {
16245 if (CompilerConstants.IntegerNotSet == color) 16219 color += redColor;
16246 {
16247 color = blueColor * 65536;
16248 }
16249 else
16250 {
16251 color += blueColor * 65536;
16252 }
16253 } 16220 }
16254 break; 16221 }
16255 16222 break;
16256 // Style values 16223 case "Green":
16257 case "Bold": 16224 var greenColor = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Byte.MaxValue);
16258 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16225 if (CompilerConstants.IllegalInteger != greenColor)
16226 {
16227 if (CompilerConstants.IntegerNotSet == color)
16259 { 16228 {
16260 bits |= MsiInterop.MsidbTextStyleStyleBitsBold; 16229 color = greenColor * 256;
16261 } 16230 }
16262 break; 16231 else
16263 case "Italic":
16264 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16265 { 16232 {
16266 bits |= MsiInterop.MsidbTextStyleStyleBitsItalic; 16233 color += greenColor * 256;
16267 } 16234 }
16268 break; 16235 }
16269 case "Strike": 16236 break;
16270 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16237 case "Blue":
16238 var blueColor = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Byte.MaxValue);
16239 if (CompilerConstants.IllegalInteger != blueColor)
16240 {
16241 if (CompilerConstants.IntegerNotSet == color)
16271 { 16242 {
16272 bits |= MsiInterop.MsidbTextStyleStyleBitsStrike; 16243 color = blueColor * 65536;
16273 } 16244 }
16274 break; 16245 else
16275 case "Underline":
16276 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16277 { 16246 {
16278 bits |= MsiInterop.MsidbTextStyleStyleBitsUnderline; 16247 color += blueColor * 65536;
16279 } 16248 }
16280 break; 16249 }
16250 break;
16281 16251
16282 // Font values 16252 // Style values
16283 case "FaceName": 16253 case "Bold":
16284 faceName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16254 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16285 break; 16255 {
16286 case "Size": 16256 bits |= MsiInterop.MsidbTextStyleStyleBitsBold;
16287 size = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16257 }
16288 break; 16258 break;
16259 case "Italic":
16260 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16261 {
16262 bits |= MsiInterop.MsidbTextStyleStyleBitsItalic;
16263 }
16264 break;
16265 case "Strike":
16266 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16267 {
16268 bits |= MsiInterop.MsidbTextStyleStyleBitsStrike;
16269 }
16270 break;
16271 case "Underline":
16272 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16273 {
16274 bits |= MsiInterop.MsidbTextStyleStyleBitsUnderline;
16275 }
16276 break;
16289 16277
16290 default: 16278 // Font values
16291 this.Core.UnexpectedAttribute(node, attrib); 16279 case "FaceName":
16292 break; 16280 faceName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16281 break;
16282 case "Size":
16283 size = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16284 break;
16285
16286 default:
16287 this.Core.UnexpectedAttribute(node, attrib);
16288 break;
16293 } 16289 }
16294 } 16290 }
16295 else 16291 else
@@ -16333,112 +16329,112 @@ namespace WixToolset.Core
16333 /// <param name="node">Element to parse.</param> 16329 /// <param name="node">Element to parse.</param>
16334 private void ParseDialogElement(XElement node) 16330 private void ParseDialogElement(XElement node)
16335 { 16331 {
16336 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 16332 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
16337 Identifier id = null; 16333 Identifier id = null;
16338 int bits = MsiInterop.MsidbDialogAttributesVisible | MsiInterop.MsidbDialogAttributesModal | MsiInterop.MsidbDialogAttributesMinimize; 16334 var bits = MsiInterop.MsidbDialogAttributesVisible | MsiInterop.MsidbDialogAttributesModal | MsiInterop.MsidbDialogAttributesMinimize;
16339 int height = 0; 16335 var height = 0;
16340 string title = null; 16336 string title = null;
16341 bool trackDiskSpace = false; 16337 var trackDiskSpace = false;
16342 int width = 0; 16338 var width = 0;
16343 int x = 50; 16339 var x = 50;
16344 int y = 50; 16340 var y = 50;
16345 16341
16346 foreach (XAttribute attrib in node.Attributes()) 16342 foreach (var attrib in node.Attributes())
16347 { 16343 {
16348 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 16344 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
16349 { 16345 {
16350 switch (attrib.Name.LocalName) 16346 switch (attrib.Name.LocalName)
16351 { 16347 {
16352 case "Id": 16348 case "Id":
16353 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 16349 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
16354 break; 16350 break;
16355 case "Height": 16351 case "Height":
16356 height = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 16352 height = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
16357 break; 16353 break;
16358 case "Title": 16354 case "Title":
16359 title = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16355 title = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16360 break; 16356 break;
16361 case "Width": 16357 case "Width":
16362 width = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 16358 width = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
16363 break; 16359 break;
16364 case "X": 16360 case "X":
16365 x = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 100); 16361 x = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 100);
16366 break; 16362 break;
16367 case "Y": 16363 case "Y":
16368 y = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 100); 16364 y = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 100);
16369 break; 16365 break;
16370 16366
16371 case "CustomPalette": 16367 case "CustomPalette":
16372 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16368 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16373 { 16369 {
16374 bits ^= MsiInterop.MsidbDialogAttributesUseCustomPalette; 16370 bits ^= MsiInterop.MsidbDialogAttributesUseCustomPalette;
16375 } 16371 }
16376 break; 16372 break;
16377 case "ErrorDialog": 16373 case "ErrorDialog":
16378 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16374 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16379 { 16375 {
16380 bits ^= MsiInterop.MsidbDialogAttributesError; 16376 bits ^= MsiInterop.MsidbDialogAttributesError;
16381 } 16377 }
16382 break; 16378 break;
16383 case "Hidden": 16379 case "Hidden":
16384 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16380 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16385 { 16381 {
16386 bits ^= MsiInterop.MsidbDialogAttributesVisible; 16382 bits ^= MsiInterop.MsidbDialogAttributesVisible;
16387 } 16383 }
16388 break; 16384 break;
16389 case "KeepModeless": 16385 case "KeepModeless":
16390 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16386 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16391 { 16387 {
16392 bits ^= MsiInterop.MsidbDialogAttributesKeepModeless; 16388 bits ^= MsiInterop.MsidbDialogAttributesKeepModeless;
16393 } 16389 }
16394 break; 16390 break;
16395 case "LeftScroll": 16391 case "LeftScroll":
16396 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16392 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16397 { 16393 {
16398 bits ^= MsiInterop.MsidbDialogAttributesLeftScroll; 16394 bits ^= MsiInterop.MsidbDialogAttributesLeftScroll;
16399 } 16395 }
16400 break; 16396 break;
16401 case "Modeless": 16397 case "Modeless":
16402 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16398 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16403 { 16399 {
16404 bits ^= MsiInterop.MsidbDialogAttributesModal; 16400 bits ^= MsiInterop.MsidbDialogAttributesModal;
16405 } 16401 }
16406 break; 16402 break;
16407 case "NoMinimize": 16403 case "NoMinimize":
16408 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16404 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16409 { 16405 {
16410 bits ^= MsiInterop.MsidbDialogAttributesMinimize; 16406 bits ^= MsiInterop.MsidbDialogAttributesMinimize;
16411 } 16407 }
16412 break; 16408 break;
16413 case "RightAligned": 16409 case "RightAligned":
16414 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16410 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16415 { 16411 {
16416 bits ^= MsiInterop.MsidbDialogAttributesRightAligned; 16412 bits ^= MsiInterop.MsidbDialogAttributesRightAligned;
16417 } 16413 }
16418 break; 16414 break;
16419 case "RightToLeft": 16415 case "RightToLeft":
16420 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16416 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16421 { 16417 {
16422 bits ^= MsiInterop.MsidbDialogAttributesRTLRO; 16418 bits ^= MsiInterop.MsidbDialogAttributesRTLRO;
16423 } 16419 }
16424 break; 16420 break;
16425 case "SystemModal": 16421 case "SystemModal":
16426 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16422 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16427 { 16423 {
16428 bits ^= MsiInterop.MsidbDialogAttributesSysModal; 16424 bits ^= MsiInterop.MsidbDialogAttributesSysModal;
16429 } 16425 }
16430 break; 16426 break;
16431 case "TrackDiskSpace": 16427 case "TrackDiskSpace":
16432 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16428 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16433 { 16429 {
16434 bits ^= MsiInterop.MsidbDialogAttributesTrackDiskSpace; 16430 bits ^= MsiInterop.MsidbDialogAttributesTrackDiskSpace;
16435 trackDiskSpace = true; 16431 trackDiskSpace = true;
16436 } 16432 }
16437 break; 16433 break;
16438 16434
16439 default: 16435 default:
16440 this.Core.UnexpectedAttribute(node, attrib); 16436 this.Core.UnexpectedAttribute(node, attrib);
16441 break; 16437 break;
16442 } 16438 }
16443 } 16439 }
16444 else 16440 else
@@ -16458,18 +16454,18 @@ namespace WixToolset.Core
16458 string defaultControl = null; 16454 string defaultControl = null;
16459 string firstControl = null; 16455 string firstControl = null;
16460 16456
16461 foreach (XElement child in node.Elements()) 16457 foreach (var child in node.Elements())
16462 { 16458 {
16463 if (CompilerCore.WixNamespace == child.Name.Namespace) 16459 if (CompilerCore.WixNamespace == child.Name.Namespace)
16464 { 16460 {
16465 switch (child.Name.LocalName) 16461 switch (child.Name.LocalName)
16466 { 16462 {
16467 case "Control": 16463 case "Control":
16468 this.ParseControlElement(child, id.Id, TupleDefinitionType.Control, ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl, trackDiskSpace); 16464 this.ParseControlElement(child, id.Id, TupleDefinitionType.Control, ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl, trackDiskSpace);
16469 break; 16465 break;
16470 default: 16466 default:
16471 this.Core.UnexpectedElement(node, child); 16467 this.Core.UnexpectedElement(node, child);
16472 break; 16468 break;
16473 } 16469 }
16474 } 16470 }
16475 else 16471 else
@@ -16513,11 +16509,11 @@ namespace WixToolset.Core
16513 /// <param name="node">Element to parse.</param> 16509 /// <param name="node">Element to parse.</param>
16514 private void ParseEmbeddedUIElement(XElement node) 16510 private void ParseEmbeddedUIElement(XElement node)
16515 { 16511 {
16516 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 16512 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
16517 Identifier id = null; 16513 Identifier id = null;
16518 string name = null; 16514 string name = null;
16519 int attributes = MsiInterop.MsidbEmbeddedUI; // by default this is the primary DLL that does not support basic UI. 16515 var attributes = MsiInterop.MsidbEmbeddedUI; // by default this is the primary DLL that does not support basic UI.
16520 int messageFilter = MsiInterop.INSTALLLOGMODE_FATALEXIT | MsiInterop.INSTALLLOGMODE_ERROR | MsiInterop.INSTALLLOGMODE_WARNING | MsiInterop.INSTALLLOGMODE_USER 16516 var messageFilter = MsiInterop.INSTALLLOGMODE_FATALEXIT | MsiInterop.INSTALLLOGMODE_ERROR | MsiInterop.INSTALLLOGMODE_WARNING | MsiInterop.INSTALLLOGMODE_USER
16521 | MsiInterop.INSTALLLOGMODE_INFO | MsiInterop.INSTALLLOGMODE_FILESINUSE | MsiInterop.INSTALLLOGMODE_RESOLVESOURCE 16517 | MsiInterop.INSTALLLOGMODE_INFO | MsiInterop.INSTALLLOGMODE_FILESINUSE | MsiInterop.INSTALLLOGMODE_RESOLVESOURCE
16522 | MsiInterop.INSTALLLOGMODE_OUTOFDISKSPACE | MsiInterop.INSTALLLOGMODE_ACTIONSTART | MsiInterop.INSTALLLOGMODE_ACTIONDATA 16518 | MsiInterop.INSTALLLOGMODE_OUTOFDISKSPACE | MsiInterop.INSTALLLOGMODE_ACTIONSTART | MsiInterop.INSTALLLOGMODE_ACTIONDATA
16523 | MsiInterop.INSTALLLOGMODE_PROGRESS | MsiInterop.INSTALLLOGMODE_COMMONDATA | MsiInterop.INSTALLLOGMODE_INITIALIZE 16519 | MsiInterop.INSTALLLOGMODE_PROGRESS | MsiInterop.INSTALLLOGMODE_COMMONDATA | MsiInterop.INSTALLLOGMODE_INITIALIZE
@@ -16525,138 +16521,138 @@ namespace WixToolset.Core
16525 | MsiInterop.INSTALLLOGMODE_INSTALLSTART | MsiInterop.INSTALLLOGMODE_INSTALLEND; 16521 | MsiInterop.INSTALLLOGMODE_INSTALLSTART | MsiInterop.INSTALLLOGMODE_INSTALLEND;
16526 string sourceFile = null; 16522 string sourceFile = null;
16527 16523
16528 foreach (XAttribute attrib in node.Attributes()) 16524 foreach (var attrib in node.Attributes())
16529 { 16525 {
16530 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 16526 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
16531 { 16527 {
16532 switch (attrib.Name.LocalName) 16528 switch (attrib.Name.LocalName)
16533 { 16529 {
16534 case "Id": 16530 case "Id":
16535 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 16531 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
16536 break; 16532 break;
16537 case "Name": 16533 case "Name":
16538 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); 16534 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
16539 break; 16535 break;
16540 case "IgnoreFatalExit": 16536 case "IgnoreFatalExit":
16541 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16537 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16542 { 16538 {
16543 messageFilter ^= MsiInterop.INSTALLLOGMODE_FATALEXIT; 16539 messageFilter ^= MsiInterop.INSTALLLOGMODE_FATALEXIT;
16544 } 16540 }
16545 break; 16541 break;
16546 case "IgnoreError": 16542 case "IgnoreError":
16547 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16543 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16548 { 16544 {
16549 messageFilter ^= MsiInterop.INSTALLLOGMODE_ERROR; 16545 messageFilter ^= MsiInterop.INSTALLLOGMODE_ERROR;
16550 } 16546 }
16551 break; 16547 break;
16552 case "IgnoreWarning": 16548 case "IgnoreWarning":
16553 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16549 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16554 { 16550 {
16555 messageFilter ^= MsiInterop.INSTALLLOGMODE_WARNING; 16551 messageFilter ^= MsiInterop.INSTALLLOGMODE_WARNING;
16556 } 16552 }
16557 break; 16553 break;
16558 case "IgnoreUser": 16554 case "IgnoreUser":
16559 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16555 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16560 { 16556 {
16561 messageFilter ^= MsiInterop.INSTALLLOGMODE_USER; 16557 messageFilter ^= MsiInterop.INSTALLLOGMODE_USER;
16562 } 16558 }
16563 break; 16559 break;
16564 case "IgnoreInfo": 16560 case "IgnoreInfo":
16565 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16561 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16566 { 16562 {
16567 messageFilter ^= MsiInterop.INSTALLLOGMODE_INFO; 16563 messageFilter ^= MsiInterop.INSTALLLOGMODE_INFO;
16568 } 16564 }
16569 break; 16565 break;
16570 case "IgnoreFilesInUse": 16566 case "IgnoreFilesInUse":
16571 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16567 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16572 { 16568 {
16573 messageFilter ^= MsiInterop.INSTALLLOGMODE_FILESINUSE; 16569 messageFilter ^= MsiInterop.INSTALLLOGMODE_FILESINUSE;
16574 } 16570 }
16575 break; 16571 break;
16576 case "IgnoreResolveSource": 16572 case "IgnoreResolveSource":
16577 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16573 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16578 { 16574 {
16579 messageFilter ^= MsiInterop.INSTALLLOGMODE_RESOLVESOURCE; 16575 messageFilter ^= MsiInterop.INSTALLLOGMODE_RESOLVESOURCE;
16580 } 16576 }
16581 break; 16577 break;
16582 case "IgnoreOutOfDiskSpace": 16578 case "IgnoreOutOfDiskSpace":
16583 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16579 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16584 { 16580 {
16585 messageFilter ^= MsiInterop.INSTALLLOGMODE_OUTOFDISKSPACE; 16581 messageFilter ^= MsiInterop.INSTALLLOGMODE_OUTOFDISKSPACE;
16586 } 16582 }
16587 break; 16583 break;
16588 case "IgnoreActionStart": 16584 case "IgnoreActionStart":
16589 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16585 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16590 { 16586 {
16591 messageFilter ^= MsiInterop.INSTALLLOGMODE_ACTIONSTART; 16587 messageFilter ^= MsiInterop.INSTALLLOGMODE_ACTIONSTART;
16592 } 16588 }
16593 break; 16589 break;
16594 case "IgnoreActionData": 16590 case "IgnoreActionData":
16595 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16591 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16596 { 16592 {
16597 messageFilter ^= MsiInterop.INSTALLLOGMODE_ACTIONDATA; 16593 messageFilter ^= MsiInterop.INSTALLLOGMODE_ACTIONDATA;
16598 } 16594 }
16599 break; 16595 break;
16600 case "IgnoreProgress": 16596 case "IgnoreProgress":
16601 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16597 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16602 { 16598 {
16603 messageFilter ^= MsiInterop.INSTALLLOGMODE_PROGRESS; 16599 messageFilter ^= MsiInterop.INSTALLLOGMODE_PROGRESS;
16604 } 16600 }
16605 break; 16601 break;
16606 case "IgnoreCommonData": 16602 case "IgnoreCommonData":
16607 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16603 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16608 { 16604 {
16609 messageFilter ^= MsiInterop.INSTALLLOGMODE_COMMONDATA; 16605 messageFilter ^= MsiInterop.INSTALLLOGMODE_COMMONDATA;
16610 } 16606 }
16611 break; 16607 break;
16612 case "IgnoreInitialize": 16608 case "IgnoreInitialize":
16613 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16609 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16614 { 16610 {
16615 messageFilter ^= MsiInterop.INSTALLLOGMODE_INITIALIZE; 16611 messageFilter ^= MsiInterop.INSTALLLOGMODE_INITIALIZE;
16616 } 16612 }
16617 break; 16613 break;
16618 case "IgnoreTerminate": 16614 case "IgnoreTerminate":
16619 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16615 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16620 { 16616 {
16621 messageFilter ^= MsiInterop.INSTALLLOGMODE_TERMINATE; 16617 messageFilter ^= MsiInterop.INSTALLLOGMODE_TERMINATE;
16622 } 16618 }
16623 break; 16619 break;
16624 case "IgnoreShowDialog": 16620 case "IgnoreShowDialog":
16625 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16621 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16626 { 16622 {
16627 messageFilter ^= MsiInterop.INSTALLLOGMODE_SHOWDIALOG; 16623 messageFilter ^= MsiInterop.INSTALLLOGMODE_SHOWDIALOG;
16628 } 16624 }
16629 break; 16625 break;
16630 case "IgnoreRMFilesInUse": 16626 case "IgnoreRMFilesInUse":
16631 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16627 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16632 { 16628 {
16633 messageFilter ^= MsiInterop.INSTALLLOGMODE_RMFILESINUSE; 16629 messageFilter ^= MsiInterop.INSTALLLOGMODE_RMFILESINUSE;
16634 } 16630 }
16635 break; 16631 break;
16636 case "IgnoreInstallStart": 16632 case "IgnoreInstallStart":
16637 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16633 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16638 { 16634 {
16639 messageFilter ^= MsiInterop.INSTALLLOGMODE_INSTALLSTART; 16635 messageFilter ^= MsiInterop.INSTALLLOGMODE_INSTALLSTART;
16640 } 16636 }
16641 break; 16637 break;
16642 case "IgnoreInstallEnd": 16638 case "IgnoreInstallEnd":
16643 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16639 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16644 { 16640 {
16645 messageFilter ^= MsiInterop.INSTALLLOGMODE_INSTALLEND; 16641 messageFilter ^= MsiInterop.INSTALLLOGMODE_INSTALLEND;
16646 } 16642 }
16647 break; 16643 break;
16648 case "SourceFile": 16644 case "SourceFile":
16649 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16645 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16650 break; 16646 break;
16651 case "SupportBasicUI": 16647 case "SupportBasicUI":
16652 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 16648 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
16653 { 16649 {
16654 attributes |= MsiInterop.MsidbEmbeddedHandlesBasic; 16650 attributes |= MsiInterop.MsidbEmbeddedHandlesBasic;
16655 } 16651 }
16656 break; 16652 break;
16657 default: 16653 default:
16658 this.Core.UnexpectedAttribute(node, attrib); 16654 this.Core.UnexpectedAttribute(node, attrib);
16659 break; 16655 break;
16660 } 16656 }
16661 } 16657 }
16662 else 16658 else
@@ -16704,18 +16700,18 @@ namespace WixToolset.Core
16704 this.Core.Write(ErrorMessages.InvalidEmbeddedUIFileName(sourceLineNumbers, name)); 16700 this.Core.Write(ErrorMessages.InvalidEmbeddedUIFileName(sourceLineNumbers, name));
16705 } 16701 }
16706 16702
16707 foreach (XElement child in node.Elements()) 16703 foreach (var child in node.Elements())
16708 { 16704 {
16709 if (CompilerCore.WixNamespace == child.Name.Namespace) 16705 if (CompilerCore.WixNamespace == child.Name.Namespace)
16710 { 16706 {
16711 switch (child.Name.LocalName) 16707 switch (child.Name.LocalName)
16712 { 16708 {
16713 case "EmbeddedUIResource": 16709 case "EmbeddedUIResource":
16714 this.ParseEmbeddedUIResourceElement(child); 16710 this.ParseEmbeddedUIResourceElement(child);
16715 break; 16711 break;
16716 default: 16712 default:
16717 this.Core.UnexpectedElement(node, child); 16713 this.Core.UnexpectedElement(node, child);
16718 break; 16714 break;
16719 } 16715 }
16720 } 16716 }
16721 else 16717 else
@@ -16741,29 +16737,29 @@ namespace WixToolset.Core
16741 /// <param name="parentId">Identifier of parent EmbeddedUI element.</param> 16737 /// <param name="parentId">Identifier of parent EmbeddedUI element.</param>
16742 private void ParseEmbeddedUIResourceElement(XElement node) 16738 private void ParseEmbeddedUIResourceElement(XElement node)
16743 { 16739 {
16744 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 16740 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
16745 Identifier id = null; 16741 Identifier id = null;
16746 string name = null; 16742 string name = null;
16747 string sourceFile = null; 16743 string sourceFile = null;
16748 16744
16749 foreach (XAttribute attrib in node.Attributes()) 16745 foreach (var attrib in node.Attributes())
16750 { 16746 {
16751 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 16747 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
16752 { 16748 {
16753 switch (attrib.Name.LocalName) 16749 switch (attrib.Name.LocalName)
16754 { 16750 {
16755 case "Id": 16751 case "Id":
16756 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 16752 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
16757 break; 16753 break;
16758 case "Name": 16754 case "Name":
16759 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false); 16755 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false);
16760 break; 16756 break;
16761 case "SourceFile": 16757 case "SourceFile":
16762 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16758 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16763 break; 16759 break;
16764 default: 16760 default:
16765 this.Core.UnexpectedAttribute(node, attrib); 16761 this.Core.UnexpectedAttribute(node, attrib);
16766 break; 16762 break;
16767 } 16763 }
16768 } 16764 }
16769 else 16765 else
@@ -16831,32 +16827,32 @@ namespace WixToolset.Core
16831 /// <param name="trackDiskSpace">True if the containing dialog tracks disk space.</param> 16827 /// <param name="trackDiskSpace">True if the containing dialog tracks disk space.</param>
16832 private void ParseControlElement(XElement node, string dialog, TupleDefinitionType tableName, ref IntermediateTuple lastTabRow, ref string firstControl, ref string defaultControl, ref string cancelControl, bool trackDiskSpace) 16828 private void ParseControlElement(XElement node, string dialog, TupleDefinitionType tableName, ref IntermediateTuple lastTabRow, ref string firstControl, ref string defaultControl, ref string cancelControl, bool trackDiskSpace)
16833 { 16829 {
16834 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 16830 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
16835 Identifier id = null; 16831 Identifier id = null;
16836 BitArray bits = new BitArray(32); 16832 var bits = new BitArray(32);
16837 int attributes = 0; 16833 var attributes = 0;
16838 string checkBoxPropertyRef = null; 16834 string checkBoxPropertyRef = null;
16839 string checkboxValue = null; 16835 string checkboxValue = null;
16840 string controlType = null; 16836 string controlType = null;
16841 bool disabled = false; 16837 var disabled = false;
16842 string height = null; 16838 string height = null;
16843 string help = null; 16839 string help = null;
16844 bool isCancel = false; 16840 var isCancel = false;
16845 bool isDefault = false; 16841 var isDefault = false;
16846 bool notTabbable = false; 16842 var notTabbable = false;
16847 string property = null; 16843 string property = null;
16848 int publishOrder = 0; 16844 var publishOrder = 0;
16849 string[] specialAttributes = null; 16845 string[] specialAttributes = null;
16850 string sourceFile = null; 16846 string sourceFile = null;
16851 string text = null; 16847 string text = null;
16852 string tooltip = null; 16848 string tooltip = null;
16853 RadioButtonType radioButtonsType = RadioButtonType.NotSet; 16849 var radioButtonsType = RadioButtonType.NotSet;
16854 string width = null; 16850 string width = null;
16855 string x = null; 16851 string x = null;
16856 string y = null; 16852 string y = null;
16857 16853
16858 // The rest of the method relies on the control's Type, so we have to get that first. 16854 // The rest of the method relies on the control's Type, so we have to get that first.
16859 XAttribute typeAttribute = node.Attribute("Type"); 16855 var typeAttribute = node.Attribute("Type");
16860 if (null == typeAttribute) 16856 if (null == typeAttribute)
16861 { 16857 {
16862 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type")); 16858 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Type"));
@@ -16868,186 +16864,186 @@ namespace WixToolset.Core
16868 16864
16869 switch (controlType) 16865 switch (controlType)
16870 { 16866 {
16871 case "Billboard": 16867 case "Billboard":
16872 specialAttributes = null; 16868 specialAttributes = null;
16873 notTabbable = true; 16869 notTabbable = true;
16874 disabled = true; 16870 disabled = true;
16875 16871
16876 this.Core.EnsureTable(sourceLineNumbers, "Billboard"); 16872 this.Core.EnsureTable(sourceLineNumbers, "Billboard");
16877 break; 16873 break;
16878 case "Bitmap": 16874 case "Bitmap":
16879 specialAttributes = MsiInterop.BitmapControlAttributes; 16875 specialAttributes = MsiInterop.BitmapControlAttributes;
16880 notTabbable = true; 16876 notTabbable = true;
16881 disabled = true; 16877 disabled = true;
16882 break; 16878 break;
16883 case "CheckBox": 16879 case "CheckBox":
16884 specialAttributes = MsiInterop.CheckboxControlAttributes; 16880 specialAttributes = MsiInterop.CheckboxControlAttributes;
16885 break; 16881 break;
16886 case "ComboBox": 16882 case "ComboBox":
16887 specialAttributes = MsiInterop.ComboboxControlAttributes; 16883 specialAttributes = MsiInterop.ComboboxControlAttributes;
16888 break; 16884 break;
16889 case "DirectoryCombo": 16885 case "DirectoryCombo":
16890 specialAttributes = MsiInterop.VolumeControlAttributes; 16886 specialAttributes = MsiInterop.VolumeControlAttributes;
16891 break; 16887 break;
16892 case "DirectoryList": 16888 case "DirectoryList":
16893 specialAttributes = null; 16889 specialAttributes = null;
16894 break; 16890 break;
16895 case "Edit": 16891 case "Edit":
16896 specialAttributes = MsiInterop.EditControlAttributes; 16892 specialAttributes = MsiInterop.EditControlAttributes;
16897 break; 16893 break;
16898 case "GroupBox": 16894 case "GroupBox":
16899 specialAttributes = null; 16895 specialAttributes = null;
16900 notTabbable = true; 16896 notTabbable = true;
16901 break; 16897 break;
16902 case "Hyperlink": 16898 case "Hyperlink":
16903 specialAttributes = MsiInterop.HyperlinkControlAttributes; 16899 specialAttributes = MsiInterop.HyperlinkControlAttributes;
16904 break; 16900 break;
16905 case "Icon": 16901 case "Icon":
16906 specialAttributes = MsiInterop.IconControlAttributes; 16902 specialAttributes = MsiInterop.IconControlAttributes;
16907 notTabbable = true; 16903 notTabbable = true;
16908 disabled = true; 16904 disabled = true;
16909 break; 16905 break;
16910 case "Line": 16906 case "Line":
16911 specialAttributes = null; 16907 specialAttributes = null;
16912 notTabbable = true; 16908 notTabbable = true;
16913 disabled = true; 16909 disabled = true;
16914 break; 16910 break;
16915 case "ListBox": 16911 case "ListBox":
16916 specialAttributes = MsiInterop.ListboxControlAttributes; 16912 specialAttributes = MsiInterop.ListboxControlAttributes;
16917 break; 16913 break;
16918 case "ListView": 16914 case "ListView":
16919 specialAttributes = MsiInterop.ListviewControlAttributes; 16915 specialAttributes = MsiInterop.ListviewControlAttributes;
16920 break; 16916 break;
16921 case "MaskedEdit": 16917 case "MaskedEdit":
16922 specialAttributes = MsiInterop.EditControlAttributes; 16918 specialAttributes = MsiInterop.EditControlAttributes;
16923 break; 16919 break;
16924 case "PathEdit": 16920 case "PathEdit":
16925 specialAttributes = MsiInterop.EditControlAttributes; 16921 specialAttributes = MsiInterop.EditControlAttributes;
16926 break; 16922 break;
16927 case "ProgressBar": 16923 case "ProgressBar":
16928 specialAttributes = MsiInterop.ProgressControlAttributes; 16924 specialAttributes = MsiInterop.ProgressControlAttributes;
16929 notTabbable = true; 16925 notTabbable = true;
16930 disabled = true; 16926 disabled = true;
16931 break; 16927 break;
16932 case "PushButton": 16928 case "PushButton":
16933 specialAttributes = MsiInterop.ButtonControlAttributes; 16929 specialAttributes = MsiInterop.ButtonControlAttributes;
16934 break; 16930 break;
16935 case "RadioButtonGroup": 16931 case "RadioButtonGroup":
16936 specialAttributes = MsiInterop.RadioControlAttributes; 16932 specialAttributes = MsiInterop.RadioControlAttributes;
16937 break; 16933 break;
16938 case "ScrollableText": 16934 case "ScrollableText":
16939 specialAttributes = null; 16935 specialAttributes = null;
16940 break; 16936 break;
16941 case "SelectionTree": 16937 case "SelectionTree":
16942 specialAttributes = null; 16938 specialAttributes = null;
16943 break; 16939 break;
16944 case "Text": 16940 case "Text":
16945 specialAttributes = MsiInterop.TextControlAttributes; 16941 specialAttributes = MsiInterop.TextControlAttributes;
16946 notTabbable = true; 16942 notTabbable = true;
16947 break; 16943 break;
16948 case "VolumeCostList": 16944 case "VolumeCostList":
16949 specialAttributes = MsiInterop.VolumeControlAttributes; 16945 specialAttributes = MsiInterop.VolumeControlAttributes;
16950 notTabbable = true; 16946 notTabbable = true;
16951 break; 16947 break;
16952 case "VolumeSelectCombo": 16948 case "VolumeSelectCombo":
16953 specialAttributes = MsiInterop.VolumeControlAttributes; 16949 specialAttributes = MsiInterop.VolumeControlAttributes;
16954 break; 16950 break;
16955 default: 16951 default:
16956 specialAttributes = null; 16952 specialAttributes = null;
16957 notTabbable = true; 16953 notTabbable = true;
16958 break; 16954 break;
16959 } 16955 }
16960 16956
16961 foreach (XAttribute attrib in node.Attributes()) 16957 foreach (var attrib in node.Attributes())
16962 { 16958 {
16963 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 16959 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
16964 { 16960 {
16965 switch (attrib.Name.LocalName) 16961 switch (attrib.Name.LocalName)
16966 { 16962 {
16967 case "Id": 16963 case "Id":
16968 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 16964 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
16969 break; 16965 break;
16970 case "Type": // already processed 16966 case "Type": // already processed
16971 break; 16967 break;
16972 case "Cancel": 16968 case "Cancel":
16973 isCancel = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 16969 isCancel = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
16974 break; 16970 break;
16975 case "CheckBoxPropertyRef": 16971 case "CheckBoxPropertyRef":
16976 checkBoxPropertyRef = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16972 checkBoxPropertyRef = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16977 break; 16973 break;
16978 case "CheckBoxValue": 16974 case "CheckBoxValue":
16979 checkboxValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16975 checkboxValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16980 break; 16976 break;
16981 case "Default": 16977 case "Default":
16982 isDefault = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 16978 isDefault = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
16983 break; 16979 break;
16984 case "Height": 16980 case "Height":
16985 height = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 16981 height = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
16986 break; 16982 break;
16987 case "Help": 16983 case "Help":
16988 help = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16984 help = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16989 break; 16985 break;
16990 case "IconSize": 16986 case "IconSize":
16991 string iconSizeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 16987 var iconSizeValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
16992 if (null != specialAttributes) 16988 if (null != specialAttributes)
16989 {
16990 if (0 < iconSizeValue.Length)
16993 { 16991 {
16994 if (0 < iconSizeValue.Length) 16992 var iconsSizeType = Wix.Control.ParseIconSizeType(iconSizeValue);
16993 switch (iconsSizeType)
16995 { 16994 {
16996 Wix.Control.IconSizeType iconsSizeType = Wix.Control.ParseIconSizeType(iconSizeValue); 16995 case Wix.Control.IconSizeType.Item16:
16997 switch (iconsSizeType) 16996 this.Core.TrySetBitFromName(specialAttributes, "Icon16", YesNoType.Yes, bits, 16);
16998 { 16997 break;
16999 case Wix.Control.IconSizeType.Item16: 16998 case Wix.Control.IconSizeType.Item32:
17000 this.Core.TrySetBitFromName(specialAttributes, "Icon16", YesNoType.Yes, bits, 16); 16999 this.Core.TrySetBitFromName(specialAttributes, "Icon32", YesNoType.Yes, bits, 16);
17001 break; 17000 break;
17002 case Wix.Control.IconSizeType.Item32: 17001 case Wix.Control.IconSizeType.Item48:
17003 this.Core.TrySetBitFromName(specialAttributes, "Icon32", YesNoType.Yes, bits, 16); 17002 this.Core.TrySetBitFromName(specialAttributes, "Icon16", YesNoType.Yes, bits, 16);
17004 break; 17003 this.Core.TrySetBitFromName(specialAttributes, "Icon32", YesNoType.Yes, bits, 16);
17005 case Wix.Control.IconSizeType.Item48: 17004 break;
17006 this.Core.TrySetBitFromName(specialAttributes, "Icon16", YesNoType.Yes, bits, 16); 17005 default:
17007 this.Core.TrySetBitFromName(specialAttributes, "Icon32", YesNoType.Yes, bits, 16); 17006 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, iconSizeValue, "16", "32", "48"));
17008 break; 17007 break;
17009 default:
17010 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, iconSizeValue, "16", "32", "48"));
17011 break;
17012 }
17013 } 17008 }
17014 } 17009 }
17015 else 17010 }
17016 { 17011 else
17017 this.Core.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, iconSizeValue, "Type")); 17012 {
17018 } 17013 this.Core.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, iconSizeValue, "Type"));
17019 break; 17014 }
17020 case "Property": 17015 break;
17021 property = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17016 case "Property":
17022 break; 17017 property = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17023 case "TabSkip": 17018 break;
17024 notTabbable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 17019 case "TabSkip":
17025 break; 17020 notTabbable = YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
17026 case "Text": 17021 break;
17027 text = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17022 case "Text":
17028 break; 17023 text = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17029 case "ToolTip": 17024 break;
17030 tooltip = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17025 case "ToolTip":
17031 break; 17026 tooltip = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17032 case "Width": 17027 break;
17033 width = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 17028 case "Width":
17034 break; 17029 width = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
17035 case "X": 17030 break;
17036 x = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 17031 case "X":
17037 break; 17032 x = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
17038 case "Y": 17033 break;
17039 y = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, short.MaxValue); 17034 case "Y":
17040 break; 17035 y = this.Core.GetAttributeLocalizableIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
17041 default: 17036 break;
17042 YesNoType attribValue = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 17037 default:
17043 if (!this.Core.TrySetBitFromName(MsiInterop.CommonControlAttributes, attrib.Name.LocalName, attribValue, bits, 0)) 17038 var attribValue = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
17039 if (!this.Core.TrySetBitFromName(MsiInterop.CommonControlAttributes, attrib.Name.LocalName, attribValue, bits, 0))
17040 {
17041 if (null == specialAttributes || !this.Core.TrySetBitFromName(specialAttributes, attrib.Name.LocalName, attribValue, bits, 16))
17044 { 17042 {
17045 if (null == specialAttributes || !this.Core.TrySetBitFromName(specialAttributes, attrib.Name.LocalName, attribValue, bits, 16)) 17043 this.Core.UnexpectedAttribute(node, attrib);
17046 {
17047 this.Core.UnexpectedAttribute(node, attrib);
17048 }
17049 } 17044 }
17050 break; 17045 }
17046 break;
17051 } 17047 }
17052 } 17048 }
17053 else 17049 else
@@ -17098,70 +17094,70 @@ namespace WixToolset.Core
17098 defaultControl = id.Id; 17094 defaultControl = id.Id;
17099 } 17095 }
17100 17096
17101 foreach (XElement child in node.Elements()) 17097 foreach (var child in node.Elements())
17102 { 17098 {
17103 if (CompilerCore.WixNamespace == child.Name.Namespace) 17099 if (CompilerCore.WixNamespace == child.Name.Namespace)
17104 { 17100 {
17105 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 17101 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
17106 switch (child.Name.LocalName) 17102 switch (child.Name.LocalName)
17107 { 17103 {
17108 case "Binary": 17104 case "Binary":
17109 this.ParseBinaryElement(child); 17105 this.ParseBinaryElement(child);
17110 break; 17106 break;
17111 case "ComboBox": 17107 case "ComboBox":
17112 this.ParseControlGroupElement(child, TupleDefinitionType.ComboBox, "ListItem"); 17108 this.ParseControlGroupElement(child, TupleDefinitionType.ComboBox, "ListItem");
17113 break; 17109 break;
17114 case "Condition": 17110 case "Condition":
17115 this.ParseConditionElement(child, node.Name.LocalName, id.Id, dialog); 17111 this.ParseConditionElement(child, node.Name.LocalName, id.Id, dialog);
17116 break; 17112 break;
17117 case "ListBox": 17113 case "ListBox":
17118 this.ParseControlGroupElement(child, TupleDefinitionType.ListBox, "ListItem"); 17114 this.ParseControlGroupElement(child, TupleDefinitionType.ListBox, "ListItem");
17119 break; 17115 break;
17120 case "ListView": 17116 case "ListView":
17121 this.ParseControlGroupElement(child, TupleDefinitionType.ListView, "ListItem"); 17117 this.ParseControlGroupElement(child, TupleDefinitionType.ListView, "ListItem");
17122 break; 17118 break;
17123 case "Property": 17119 case "Property":
17124 this.ParsePropertyElement(child); 17120 this.ParsePropertyElement(child);
17125 break; 17121 break;
17126 case "Publish": 17122 case "Publish":
17127 this.ParsePublishElement(child, dialog ?? String.Empty, id.Id, ref publishOrder); 17123 this.ParsePublishElement(child, dialog ?? String.Empty, id.Id, ref publishOrder);
17128 break; 17124 break;
17129 case "RadioButtonGroup": 17125 case "RadioButtonGroup":
17130 radioButtonsType = this.ParseRadioButtonGroupElement(child, property, radioButtonsType); 17126 radioButtonsType = this.ParseRadioButtonGroupElement(child, property, radioButtonsType);
17131 break; 17127 break;
17132 case "Subscribe": 17128 case "Subscribe":
17133 this.ParseSubscribeElement(child, dialog, id.Id); 17129 this.ParseSubscribeElement(child, dialog, id.Id);
17134 break; 17130 break;
17135 case "Text": 17131 case "Text":
17136 foreach (XAttribute attrib in child.Attributes()) 17132 foreach (var attrib in child.Attributes())
17133 {
17134 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
17137 { 17135 {
17138 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 17136 switch (attrib.Name.LocalName)
17139 { 17137 {
17140 switch (attrib.Name.LocalName) 17138 case "SourceFile":
17141 { 17139 sourceFile = this.Core.GetAttributeValue(childSourceLineNumbers, attrib);
17142 case "SourceFile": 17140 break;
17143 sourceFile = this.Core.GetAttributeValue(childSourceLineNumbers, attrib); 17141 default:
17144 break; 17142 this.Core.UnexpectedAttribute(child, attrib);
17145 default: 17143 break;
17146 this.Core.UnexpectedAttribute(child, attrib);
17147 break;
17148 }
17149 }
17150 else
17151 {
17152 this.Core.ParseExtensionAttribute(child, attrib);
17153 } 17144 }
17154 } 17145 }
17155 17146 else
17156 text = Common.GetInnerText(child);
17157 if (!String.IsNullOrEmpty(text) && null != sourceFile)
17158 { 17147 {
17159 this.Core.Write(ErrorMessages.IllegalAttributeWithInnerText(childSourceLineNumbers, child.Name.LocalName, "SourceFile")); 17148 this.Core.ParseExtensionAttribute(child, attrib);
17160 } 17149 }
17161 break; 17150 }
17162 default: 17151
17163 this.Core.UnexpectedElement(node, child); 17152 text = Common.GetInnerText(child);
17164 break; 17153 if (!String.IsNullOrEmpty(text) && null != sourceFile)
17154 {
17155 this.Core.Write(ErrorMessages.IllegalAttributeWithInnerText(childSourceLineNumbers, child.Name.LocalName, "SourceFile"));
17156 }
17157 break;
17158 default:
17159 this.Core.UnexpectedElement(node, child);
17160 break;
17165 } 17161 }
17166 } 17162 }
17167 else 17163 else
@@ -17173,15 +17169,15 @@ namespace WixToolset.Core
17173 // If the radio buttons have icons, then we need to add the icon attribute. 17169 // If the radio buttons have icons, then we need to add the icon attribute.
17174 switch (radioButtonsType) 17170 switch (radioButtonsType)
17175 { 17171 {
17176 case RadioButtonType.Bitmap: 17172 case RadioButtonType.Bitmap:
17177 attributes |= MsiInterop.MsidbControlAttributesBitmap; 17173 attributes |= MsiInterop.MsidbControlAttributesBitmap;
17178 break; 17174 break;
17179 case RadioButtonType.Icon: 17175 case RadioButtonType.Icon:
17180 attributes |= MsiInterop.MsidbControlAttributesIcon; 17176 attributes |= MsiInterop.MsidbControlAttributesIcon;
17181 break; 17177 break;
17182 case RadioButtonType.Text: 17178 case RadioButtonType.Text:
17183 // Text is the default so nothing needs to be added bits 17179 // Text is the default so nothing needs to be added bits
17184 break; 17180 break;
17185 } 17181 }
17186 17182
17187 // If we're tracking disk space, and this is a non-FormatSize Text control, and the text attribute starts with 17183 // If we're tracking disk space, and this is a non-FormatSize Text control, and the text attribute starts with
@@ -17295,7 +17291,7 @@ namespace WixToolset.Core
17295 /// <param name="order">Relative order of controls.</param> 17291 /// <param name="order">Relative order of controls.</param>
17296 private void ParsePublishElement(XElement node, string dialog, string control, ref int order) 17292 private void ParsePublishElement(XElement node, string dialog, string control, ref int order)
17297 { 17293 {
17298 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 17294 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
17299 string argument = null; 17295 string argument = null;
17300 string condition = null; 17296 string condition = null;
17301 string controlEvent = null; 17297 string controlEvent = null;
@@ -17304,42 +17300,42 @@ namespace WixToolset.Core
17304 // give this control event a unique ordering 17300 // give this control event a unique ordering
17305 order++; 17301 order++;
17306 17302
17307 foreach (XAttribute attrib in node.Attributes()) 17303 foreach (var attrib in node.Attributes())
17308 { 17304 {
17309 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 17305 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
17310 { 17306 {
17311 switch (attrib.Name.LocalName) 17307 switch (attrib.Name.LocalName)
17312 { 17308 {
17313 case "Control": 17309 case "Control":
17314 if (null != control) 17310 if (null != control)
17315 { 17311 {
17316 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); 17312 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName));
17317 } 17313 }
17318 control = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 17314 control = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
17319 break; 17315 break;
17320 case "Dialog": 17316 case "Dialog":
17321 if (null != dialog) 17317 if (null != dialog)
17322 { 17318 {
17323 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); 17319 this.Core.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName));
17324 } 17320 }
17325 dialog = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 17321 dialog = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
17326 this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", dialog); 17322 this.Core.CreateSimpleReference(sourceLineNumbers, "Dialog", dialog);
17327 break; 17323 break;
17328 case "Event": 17324 case "Event":
17329 controlEvent = Compiler.UppercaseFirstChar(this.Core.GetAttributeValue(sourceLineNumbers, attrib)); 17325 controlEvent = Compiler.UppercaseFirstChar(this.Core.GetAttributeValue(sourceLineNumbers, attrib));
17330 break; 17326 break;
17331 case "Order": 17327 case "Order":
17332 order = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 2147483647); 17328 order = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, 2147483647);
17333 break; 17329 break;
17334 case "Property": 17330 case "Property":
17335 property = String.Concat("[", this.Core.GetAttributeValue(sourceLineNumbers, attrib), "]"); 17331 property = String.Concat("[", this.Core.GetAttributeValue(sourceLineNumbers, attrib), "]");
17336 break; 17332 break;
17337 case "Value": 17333 case "Value":
17338 argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17334 argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17339 break; 17335 break;
17340 default: 17336 default:
17341 this.Core.UnexpectedAttribute(node, attrib); 17337 this.Core.UnexpectedAttribute(node, attrib);
17342 break; 17338 break;
17343 } 17339 }
17344 } 17340 }
17345 else 17341 else
@@ -17420,25 +17416,25 @@ namespace WixToolset.Core
17420 /// <param name="control">Identifier of control.</param> 17416 /// <param name="control">Identifier of control.</param>
17421 private void ParseSubscribeElement(XElement node, string dialog, string control) 17417 private void ParseSubscribeElement(XElement node, string dialog, string control)
17422 { 17418 {
17423 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 17419 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
17424 string controlAttribute = null; 17420 string controlAttribute = null;
17425 string eventMapping = null; 17421 string eventMapping = null;
17426 17422
17427 foreach (XAttribute attrib in node.Attributes()) 17423 foreach (var attrib in node.Attributes())
17428 { 17424 {
17429 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 17425 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
17430 { 17426 {
17431 switch (attrib.Name.LocalName) 17427 switch (attrib.Name.LocalName)
17432 { 17428 {
17433 case "Attribute": 17429 case "Attribute":
17434 controlAttribute = Compiler.UppercaseFirstChar(this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib)); 17430 controlAttribute = Compiler.UppercaseFirstChar(this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib));
17435 break; 17431 break;
17436 case "Event": 17432 case "Event":
17437 eventMapping = Compiler.UppercaseFirstChar(this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib)); 17433 eventMapping = Compiler.UppercaseFirstChar(this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib));
17438 break; 17434 break;
17439 default: 17435 default:
17440 this.Core.UnexpectedAttribute(node, attrib); 17436 this.Core.UnexpectedAttribute(node, attrib);
17441 break; 17437 break;
17442 } 17438 }
17443 } 17439 }
17444 else 17440 else
@@ -17465,21 +17461,21 @@ namespace WixToolset.Core
17465 /// <param name="node">Element to parse.</param> 17461 /// <param name="node">Element to parse.</param>
17466 private void ParseUpgradeElement(XElement node) 17462 private void ParseUpgradeElement(XElement node)
17467 { 17463 {
17468 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 17464 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
17469 string id = null; 17465 string id = null;
17470 17466
17471 foreach (XAttribute attrib in node.Attributes()) 17467 foreach (var attrib in node.Attributes())
17472 { 17468 {
17473 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 17469 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
17474 { 17470 {
17475 switch (attrib.Name.LocalName) 17471 switch (attrib.Name.LocalName)
17476 { 17472 {
17477 case "Id": 17473 case "Id":
17478 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 17474 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
17479 break; 17475 break;
17480 default: 17476 default:
17481 this.Core.UnexpectedAttribute(node, attrib); 17477 this.Core.UnexpectedAttribute(node, attrib);
17482 break; 17478 break;
17483 } 17479 }
17484 } 17480 }
17485 else 17481 else
@@ -17494,24 +17490,24 @@ namespace WixToolset.Core
17494 } 17490 }
17495 17491
17496 // process the UpgradeVersion children here 17492 // process the UpgradeVersion children here
17497 foreach (XElement child in node.Elements()) 17493 foreach (var child in node.Elements())
17498 { 17494 {
17499 if (CompilerCore.WixNamespace == child.Name.Namespace) 17495 if (CompilerCore.WixNamespace == child.Name.Namespace)
17500 { 17496 {
17501 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 17497 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
17502 17498
17503 switch (child.Name.LocalName) 17499 switch (child.Name.LocalName)
17504 { 17500 {
17505 case "Property": 17501 case "Property":
17506 this.ParsePropertyElement(child); 17502 this.ParsePropertyElement(child);
17507 this.Core.Write(WarningMessages.DeprecatedUpgradeProperty(childSourceLineNumbers)); 17503 this.Core.Write(WarningMessages.DeprecatedUpgradeProperty(childSourceLineNumbers));
17508 break; 17504 break;
17509 case "UpgradeVersion": 17505 case "UpgradeVersion":
17510 this.ParseUpgradeVersionElement(child, id); 17506 this.ParseUpgradeVersionElement(child, id);
17511 break; 17507 break;
17512 default: 17508 default:
17513 this.Core.UnexpectedElement(node, child); 17509 this.Core.UnexpectedElement(node, child);
17514 break; 17510 break;
17515 } 17511 }
17516 } 17512 }
17517 else 17513 else
@@ -17530,75 +17526,75 @@ namespace WixToolset.Core
17530 /// <param name="upgradeId">Upgrade code.</param> 17526 /// <param name="upgradeId">Upgrade code.</param>
17531 private void ParseUpgradeVersionElement(XElement node, string upgradeId) 17527 private void ParseUpgradeVersionElement(XElement node, string upgradeId)
17532 { 17528 {
17533 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 17529 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
17534 17530
17535 string actionProperty = null; 17531 string actionProperty = null;
17536 string language = null; 17532 string language = null;
17537 string maximum = null; 17533 string maximum = null;
17538 string minimum = null; 17534 string minimum = null;
17539 int options = 256; 17535 var options = 256;
17540 string removeFeatures = null; 17536 string removeFeatures = null;
17541 17537
17542 foreach (XAttribute attrib in node.Attributes()) 17538 foreach (var attrib in node.Attributes())
17543 { 17539 {
17544 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 17540 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
17545 { 17541 {
17546 switch (attrib.Name.LocalName) 17542 switch (attrib.Name.LocalName)
17547 { 17543 {
17548 case "ExcludeLanguages": 17544 case "ExcludeLanguages":
17549 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 17545 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
17550 { 17546 {
17551 options |= MsiInterop.MsidbUpgradeAttributesLanguagesExclusive; 17547 options |= MsiInterop.MsidbUpgradeAttributesLanguagesExclusive;
17552 } 17548 }
17553 break; 17549 break;
17554 case "IgnoreRemoveFailure": 17550 case "IgnoreRemoveFailure":
17555 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 17551 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
17556 { 17552 {
17557 options |= MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure; 17553 options |= MsiInterop.MsidbUpgradeAttributesIgnoreRemoveFailure;
17558 } 17554 }
17559 break; 17555 break;
17560 case "IncludeMaximum": 17556 case "IncludeMaximum":
17561 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 17557 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
17562 { 17558 {
17563 options |= MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive; 17559 options |= MsiInterop.MsidbUpgradeAttributesVersionMaxInclusive;
17564 } 17560 }
17565 break; 17561 break;
17566 case "IncludeMinimum": // this is "yes" by default 17562 case "IncludeMinimum": // this is "yes" by default
17567 if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 17563 if (YesNoType.No == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
17568 { 17564 {
17569 options &= ~MsiInterop.MsidbUpgradeAttributesVersionMinInclusive; 17565 options &= ~MsiInterop.MsidbUpgradeAttributesVersionMinInclusive;
17570 } 17566 }
17571 break; 17567 break;
17572 case "Language": 17568 case "Language":
17573 language = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17569 language = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17574 break; 17570 break;
17575 case "Minimum": 17571 case "Minimum":
17576 minimum = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); 17572 minimum = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
17577 break; 17573 break;
17578 case "Maximum": 17574 case "Maximum":
17579 maximum = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); 17575 maximum = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
17580 break; 17576 break;
17581 case "MigrateFeatures": 17577 case "MigrateFeatures":
17582 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 17578 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
17583 { 17579 {
17584 options |= MsiInterop.MsidbUpgradeAttributesMigrateFeatures; 17580 options |= MsiInterop.MsidbUpgradeAttributesMigrateFeatures;
17585 } 17581 }
17586 break; 17582 break;
17587 case "OnlyDetect": 17583 case "OnlyDetect":
17588 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 17584 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
17589 { 17585 {
17590 options |= MsiInterop.MsidbUpgradeAttributesOnlyDetect; 17586 options |= MsiInterop.MsidbUpgradeAttributesOnlyDetect;
17591 } 17587 }
17592 break; 17588 break;
17593 case "Property": 17589 case "Property":
17594 actionProperty = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 17590 actionProperty = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
17595 break; 17591 break;
17596 case "RemoveFeatures": 17592 case "RemoveFeatures":
17597 removeFeatures = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17593 removeFeatures = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17598 break; 17594 break;
17599 default: 17595 default:
17600 this.Core.UnexpectedAttribute(node, attrib); 17596 this.Core.UnexpectedAttribute(node, attrib);
17601 break; 17597 break;
17602 } 17598 }
17603 } 17599 }
17604 else 17600 else
@@ -17656,47 +17652,47 @@ namespace WixToolset.Core
17656 /// <param name="advertise">Flag if verb is advertised.</param> 17652 /// <param name="advertise">Flag if verb is advertised.</param>
17657 private void ParseVerbElement(XElement node, string extension, string progId, string componentId, YesNoType advertise) 17653 private void ParseVerbElement(XElement node, string extension, string progId, string componentId, YesNoType advertise)
17658 { 17654 {
17659 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 17655 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
17660 string id = null; 17656 string id = null;
17661 string argument = null; 17657 string argument = null;
17662 string command = null; 17658 string command = null;
17663 int sequence = CompilerConstants.IntegerNotSet; 17659 var sequence = CompilerConstants.IntegerNotSet;
17664 string target = null; 17660 string target = null;
17665 string targetFile = null; 17661 string targetFile = null;
17666 string targetProperty = null; 17662 string targetProperty = null;
17667 17663
17668 foreach (XAttribute attrib in node.Attributes()) 17664 foreach (var attrib in node.Attributes())
17669 { 17665 {
17670 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 17666 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
17671 { 17667 {
17672 switch (attrib.Name.LocalName) 17668 switch (attrib.Name.LocalName)
17673 { 17669 {
17674 case "Id": 17670 case "Id":
17675 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17671 id = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17676 break; 17672 break;
17677 case "Argument": 17673 case "Argument":
17678 argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17674 argument = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17679 break; 17675 break;
17680 case "Command": 17676 case "Command":
17681 command = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17677 command = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17682 break; 17678 break;
17683 case "Sequence": 17679 case "Sequence":
17684 sequence = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue); 17680 sequence = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, Int16.MaxValue);
17685 break; 17681 break;
17686 case "Target": 17682 case "Target":
17687 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17683 target = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17688 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "TargetFile", "TargetProperty")); 17684 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "TargetFile", "TargetProperty"));
17689 break; 17685 break;
17690 case "TargetFile": 17686 case "TargetFile":
17691 targetFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17687 targetFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17692 this.Core.CreateSimpleReference(sourceLineNumbers, "File", targetFile); 17688 this.Core.CreateSimpleReference(sourceLineNumbers, "File", targetFile);
17693 break; 17689 break;
17694 case "TargetProperty": 17690 case "TargetProperty":
17695 targetProperty = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17691 targetProperty = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17696 break; 17692 break;
17697 default: 17693 default:
17698 this.Core.UnexpectedAttribute(node, attrib); 17694 this.Core.UnexpectedAttribute(node, attrib);
17699 break; 17695 break;
17700 } 17696 }
17701 } 17697 }
17702 else 17698 else
@@ -17787,7 +17783,7 @@ namespace WixToolset.Core
17787 target = String.Concat(target, " ", argument); 17783 target = String.Concat(target, " ", argument);
17788 } 17784 }
17789 17785
17790 string prefix = (null != progId ? progId : String.Concat(".", extension)); 17786 var prefix = (null != progId ? progId : String.Concat(".", extension));
17791 17787
17792 if (null != command) 17788 if (null != command)
17793 { 17789 {
@@ -17805,33 +17801,33 @@ namespace WixToolset.Core
17805 /// <param name="node">Element to parse</param> 17801 /// <param name="node">Element to parse</param>
17806 private void ParseApprovedExeForElevation(XElement node) 17802 private void ParseApprovedExeForElevation(XElement node)
17807 { 17803 {
17808 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 17804 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
17809 Identifier id = null; 17805 Identifier id = null;
17810 string key = null; 17806 string key = null;
17811 string valueName = null; 17807 string valueName = null;
17812 YesNoType win64 = YesNoType.NotSet; 17808 var win64 = YesNoType.NotSet;
17813 17809
17814 foreach (XAttribute attrib in node.Attributes()) 17810 foreach (var attrib in node.Attributes())
17815 { 17811 {
17816 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 17812 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
17817 { 17813 {
17818 switch (attrib.Name.LocalName) 17814 switch (attrib.Name.LocalName)
17819 { 17815 {
17820 case "Id": 17816 case "Id":
17821 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 17817 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
17822 break; 17818 break;
17823 case "Key": 17819 case "Key":
17824 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17820 key = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17825 break; 17821 break;
17826 case "Value": 17822 case "Value":
17827 valueName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17823 valueName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17828 break; 17824 break;
17829 case "Win64": 17825 case "Win64":
17830 win64 = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 17826 win64 = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
17831 break; 17827 break;
17832 default: 17828 default:
17833 this.Core.UnexpectedAttribute(node, attrib); 17829 this.Core.UnexpectedAttribute(node, attrib);
17834 break; 17830 break;
17835 } 17831 }
17836 } 17832 }
17837 else 17833 else
@@ -17850,7 +17846,7 @@ namespace WixToolset.Core
17850 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); 17846 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key"));
17851 } 17847 }
17852 17848
17853 BundleApprovedExeForElevationAttributes attributes = BundleApprovedExeForElevationAttributes.None; 17849 var attributes = BundleApprovedExeForElevationAttributes.None;
17854 17850
17855 if (win64 == YesNoType.Yes) 17851 if (win64 == YesNoType.Yes)
17856 { 17852 {
@@ -17874,12 +17870,12 @@ namespace WixToolset.Core
17874 /// <param name="node">Element to parse</param> 17870 /// <param name="node">Element to parse</param>
17875 private void ParseBundleElement(XElement node) 17871 private void ParseBundleElement(XElement node)
17876 { 17872 {
17877 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 17873 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
17878 string copyright = null; 17874 string copyright = null;
17879 string aboutUrl = null; 17875 string aboutUrl = null;
17880 YesNoDefaultType compressed = YesNoDefaultType.Default; 17876 var compressed = YesNoDefaultType.Default;
17881 int disableModify = -1; 17877 var disableModify = -1;
17882 YesNoType disableRemove = YesNoType.NotSet; 17878 var disableRemove = YesNoType.NotSet;
17883 string helpTelephone = null; 17879 string helpTelephone = null;
17884 string helpUrl = null; 17880 string helpUrl = null;
17885 string manufacturer = null; 17881 string manufacturer = null;
@@ -17897,84 +17893,84 @@ namespace WixToolset.Core
17897 string splashScreenSourceFile = null; 17893 string splashScreenSourceFile = null;
17898 17894
17899 // Process only standard attributes until the active section is initialized. 17895 // Process only standard attributes until the active section is initialized.
17900 foreach (XAttribute attrib in node.Attributes()) 17896 foreach (var attrib in node.Attributes())
17901 { 17897 {
17902 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 17898 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
17903 { 17899 {
17904 switch (attrib.Name.LocalName) 17900 switch (attrib.Name.LocalName)
17905 { 17901 {
17906 case "AboutUrl": 17902 case "AboutUrl":
17907 aboutUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17903 aboutUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17908 break; 17904 break;
17909 case "Compressed": 17905 case "Compressed":
17910 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); 17906 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
17911 break; 17907 break;
17912 case "Condition": 17908 case "Condition":
17913 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17909 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17914 break; 17910 break;
17915 case "Copyright": 17911 case "Copyright":
17916 copyright = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17912 copyright = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17917 break; 17913 break;
17918 case "DisableModify": 17914 case "DisableModify":
17919 string value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 17915 var value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17920 switch (value) 17916 switch (value)
17921 { 17917 {
17922 case "button": 17918 case "button":
17923 disableModify = 2; 17919 disableModify = 2;
17924 break;
17925 case "yes":
17926 disableModify = 1;
17927 break;
17928 case "no":
17929 disableModify = 0;
17930 break;
17931 default:
17932 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no"));
17933 break;
17934 }
17935 break;
17936 case "DisableRemove":
17937 disableRemove = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
17938 break;
17939 case "DisableRepair":
17940 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
17941 break;
17942 case "HelpTelephone":
17943 helpTelephone = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17944 break;
17945 case "HelpUrl":
17946 helpUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17947 break;
17948 case "Manufacturer":
17949 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17950 break;
17951 case "IconSourceFile":
17952 iconSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17953 break;
17954 case "Name":
17955 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17956 break;
17957 case "ParentName":
17958 parentName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17959 break;
17960 case "SplashScreenSourceFile":
17961 splashScreenSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17962 break;
17963 case "Tag":
17964 tag = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17965 break;
17966 case "UpdateUrl":
17967 updateUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17968 break; 17920 break;
17969 case "UpgradeCode": 17921 case "yes":
17970 upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 17922 disableModify = 1;
17971 break; 17923 break;
17972 case "Version": 17924 case "no":
17973 version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); 17925 disableModify = 0;
17974 break; 17926 break;
17975 default: 17927 default:
17976 this.Core.UnexpectedAttribute(node, attrib); 17928 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no"));
17977 break; 17929 break;
17930 }
17931 break;
17932 case "DisableRemove":
17933 disableRemove = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
17934 break;
17935 case "DisableRepair":
17936 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
17937 break;
17938 case "HelpTelephone":
17939 helpTelephone = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17940 break;
17941 case "HelpUrl":
17942 helpUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17943 break;
17944 case "Manufacturer":
17945 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17946 break;
17947 case "IconSourceFile":
17948 iconSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17949 break;
17950 case "Name":
17951 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17952 break;
17953 case "ParentName":
17954 parentName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17955 break;
17956 case "SplashScreenSourceFile":
17957 splashScreenSourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17958 break;
17959 case "Tag":
17960 tag = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17961 break;
17962 case "UpdateUrl":
17963 updateUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
17964 break;
17965 case "UpgradeCode":
17966 upgradeCode = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
17967 break;
17968 case "Version":
17969 version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
17970 break;
17971 default:
17972 this.Core.UnexpectedAttribute(node, attrib);
17973 break;
17978 } 17974 }
17979 } 17975 }
17980 } 17976 }
@@ -18020,7 +18016,7 @@ namespace WixToolset.Core
18020 this.Core.CreateActiveSection(this.activeName, SectionType.Bundle, 0, this.Context.CompilationId); 18016 this.Core.CreateActiveSection(this.activeName, SectionType.Bundle, 0, this.Context.CompilationId);
18021 18017
18022 // Now that the active section is initialized, process only extension attributes. 18018 // Now that the active section is initialized, process only extension attributes.
18023 foreach (XAttribute attrib in node.Attributes()) 18019 foreach (var attrib in node.Attributes())
18024 { 18020 {
18025 if (!String.IsNullOrEmpty(attrib.Name.NamespaceName) && CompilerCore.WixNamespace != attrib.Name.Namespace) 18021 if (!String.IsNullOrEmpty(attrib.Name.NamespaceName) && CompilerCore.WixNamespace != attrib.Name.Namespace)
18026 { 18022 {
@@ -18028,82 +18024,82 @@ namespace WixToolset.Core
18028 } 18024 }
18029 } 18025 }
18030 18026
18031 bool baSeen = false; 18027 var baSeen = false;
18032 bool chainSeen = false; 18028 var chainSeen = false;
18033 bool logSeen = false; 18029 var logSeen = false;
18034 18030
18035 foreach (XElement child in node.Elements()) 18031 foreach (var child in node.Elements())
18036 { 18032 {
18037 if (CompilerCore.WixNamespace == child.Name.Namespace) 18033 if (CompilerCore.WixNamespace == child.Name.Namespace)
18038 { 18034 {
18039 switch (child.Name.LocalName) 18035 switch (child.Name.LocalName)
18040 { 18036 {
18041 case "ApprovedExeForElevation": 18037 case "ApprovedExeForElevation":
18042 this.ParseApprovedExeForElevation(child); 18038 this.ParseApprovedExeForElevation(child);
18043 break; 18039 break;
18044 case "BootstrapperApplication": 18040 case "BootstrapperApplication":
18045 if (baSeen) 18041 if (baSeen)
18046 { 18042 {
18047 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 18043 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
18048 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "BootstrapperApplication")); 18044 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "BootstrapperApplication"));
18049 } 18045 }
18050 this.ParseBootstrapperApplicationElement(child); 18046 this.ParseBootstrapperApplicationElement(child);
18051 baSeen = true; 18047 baSeen = true;
18052 break; 18048 break;
18053 case "BootstrapperApplicationRef": 18049 case "BootstrapperApplicationRef":
18054 this.ParseBootstrapperApplicationRefElement(child); 18050 this.ParseBootstrapperApplicationRefElement(child);
18055 break; 18051 break;
18056 case "OptionalUpdateRegistration": 18052 case "OptionalUpdateRegistration":
18057 this.ParseOptionalUpdateRegistrationElement(child, manufacturer, parentName, name); 18053 this.ParseOptionalUpdateRegistrationElement(child, manufacturer, parentName, name);
18058 break; 18054 break;
18059 case "Catalog": 18055 case "Catalog":
18060 this.ParseCatalogElement(child); 18056 this.ParseCatalogElement(child);
18061 break; 18057 break;
18062 case "Chain": 18058 case "Chain":
18063 if (chainSeen) 18059 if (chainSeen)
18064 { 18060 {
18065 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 18061 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
18066 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Chain")); 18062 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Chain"));
18067 } 18063 }
18068 this.ParseChainElement(child); 18064 this.ParseChainElement(child);
18069 chainSeen = true; 18065 chainSeen = true;
18070 break; 18066 break;
18071 case "Container": 18067 case "Container":
18072 this.ParseContainerElement(child); 18068 this.ParseContainerElement(child);
18073 break; 18069 break;
18074 case "ContainerRef": 18070 case "ContainerRef":
18075 this.ParseSimpleRefElement(child, "WixBundleContainer"); 18071 this.ParseSimpleRefElement(child, "WixBundleContainer");
18076 break; 18072 break;
18077 case "Log": 18073 case "Log":
18078 if (logSeen) 18074 if (logSeen)
18079 { 18075 {
18080 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 18076 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
18081 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Log")); 18077 this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, "Log"));
18082 } 18078 }
18083 logVariablePrefixAndExtension = this.ParseLogElement(child, fileSystemSafeBundleName); 18079 logVariablePrefixAndExtension = this.ParseLogElement(child, fileSystemSafeBundleName);
18084 logSeen = true; 18080 logSeen = true;
18085 break; 18081 break;
18086 case "PayloadGroup": 18082 case "PayloadGroup":
18087 this.ParsePayloadGroupElement(child, ComplexReferenceParentType.Layout, "BundleLayoutOnlyPayloads"); 18083 this.ParsePayloadGroupElement(child, ComplexReferenceParentType.Layout, "BundleLayoutOnlyPayloads");
18088 break; 18084 break;
18089 case "PayloadGroupRef": 18085 case "PayloadGroupRef":
18090 this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Layout, "BundleLayoutOnlyPayloads", ComplexReferenceChildType.Unknown, null); 18086 this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Layout, "BundleLayoutOnlyPayloads", ComplexReferenceChildType.Unknown, null);
18091 break; 18087 break;
18092 case "RelatedBundle": 18088 case "RelatedBundle":
18093 this.ParseRelatedBundleElement(child); 18089 this.ParseRelatedBundleElement(child);
18094 break; 18090 break;
18095 case "Update": 18091 case "Update":
18096 this.ParseUpdateElement(child); 18092 this.ParseUpdateElement(child);
18097 break; 18093 break;
18098 case "Variable": 18094 case "Variable":
18099 this.ParseVariableElement(child); 18095 this.ParseVariableElement(child);
18100 break; 18096 break;
18101 case "WixVariable": 18097 case "WixVariable":
18102 this.ParseWixVariableElement(child); 18098 this.ParseWixVariableElement(child);
18103 break; 18099 break;
18104 default: 18100 default:
18105 this.Core.UnexpectedElement(node, child); 18101 this.Core.UnexpectedElement(node, child);
18106 break; 18102 break;
18107 } 18103 }
18108 } 18104 }
18109 else 18105 else
@@ -18193,33 +18189,33 @@ namespace WixToolset.Core
18193 /// <param name="node">Element to parse</param> 18189 /// <param name="node">Element to parse</param>
18194 private string ParseLogElement(XElement node, string fileSystemSafeBundleName) 18190 private string ParseLogElement(XElement node, string fileSystemSafeBundleName)
18195 { 18191 {
18196 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18192 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18197 YesNoType disableLog = YesNoType.NotSet; 18193 var disableLog = YesNoType.NotSet;
18198 string variable = "WixBundleLog"; 18194 var variable = "WixBundleLog";
18199 string logPrefix = fileSystemSafeBundleName ?? "Setup"; 18195 var logPrefix = fileSystemSafeBundleName ?? "Setup";
18200 string logExtension = ".log"; 18196 var logExtension = ".log";
18201 18197
18202 foreach (XAttribute attrib in node.Attributes()) 18198 foreach (var attrib in node.Attributes())
18203 { 18199 {
18204 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 18200 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
18205 { 18201 {
18206 switch (attrib.Name.LocalName) 18202 switch (attrib.Name.LocalName)
18207 { 18203 {
18208 case "Disable": 18204 case "Disable":
18209 disableLog = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 18205 disableLog = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
18210 break; 18206 break;
18211 case "PathVariable": 18207 case "PathVariable":
18212 variable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 18208 variable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
18213 break; 18209 break;
18214 case "Prefix": 18210 case "Prefix":
18215 logPrefix = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18211 logPrefix = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18216 break; 18212 break;
18217 case "Extension": 18213 case "Extension":
18218 logExtension = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18214 logExtension = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18219 break; 18215 break;
18220 default: 18216 default:
18221 this.Core.UnexpectedAttribute(node, attrib); 18217 this.Core.UnexpectedAttribute(node, attrib);
18222 break; 18218 break;
18223 } 18219 }
18224 } 18220 }
18225 else 18221 else
@@ -18244,25 +18240,25 @@ namespace WixToolset.Core
18244 /// <param name="node">Element to parse</param> 18240 /// <param name="node">Element to parse</param>
18245 private void ParseCatalogElement(XElement node) 18241 private void ParseCatalogElement(XElement node)
18246 { 18242 {
18247 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18243 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18248 Identifier id = null; 18244 Identifier id = null;
18249 string sourceFile = null; 18245 string sourceFile = null;
18250 18246
18251 foreach (XAttribute attrib in node.Attributes()) 18247 foreach (var attrib in node.Attributes())
18252 { 18248 {
18253 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 18249 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
18254 { 18250 {
18255 switch (attrib.Name.LocalName) 18251 switch (attrib.Name.LocalName)
18256 { 18252 {
18257 case "Id": 18253 case "Id":
18258 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 18254 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
18259 break; 18255 break;
18260 case "SourceFile": 18256 case "SourceFile":
18261 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18257 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18262 break; 18258 break;
18263 default: 18259 default:
18264 this.Core.UnexpectedAttribute(node, attrib); 18260 this.Core.UnexpectedAttribute(node, attrib);
18265 break; 18261 break;
18266 } 18262 }
18267 } 18263 }
18268 } 18264 }
@@ -18295,37 +18291,37 @@ namespace WixToolset.Core
18295 /// <param name="node">Element to parse</param> 18291 /// <param name="node">Element to parse</param>
18296 private void ParseContainerElement(XElement node) 18292 private void ParseContainerElement(XElement node)
18297 { 18293 {
18298 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18294 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18299 Identifier id = null; 18295 Identifier id = null;
18300 string downloadUrl = null; 18296 string downloadUrl = null;
18301 string name = null; 18297 string name = null;
18302 ContainerType type = ContainerType.Detached; 18298 var type = ContainerType.Detached;
18303 18299
18304 foreach (XAttribute attrib in node.Attributes()) 18300 foreach (var attrib in node.Attributes())
18305 { 18301 {
18306 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 18302 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
18307 { 18303 {
18308 switch (attrib.Name.LocalName) 18304 switch (attrib.Name.LocalName)
18309 { 18305 {
18310 case "Id": 18306 case "Id":
18311 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 18307 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
18312 break; 18308 break;
18313 case "DownloadUrl": 18309 case "DownloadUrl":
18314 downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18310 downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18315 break; 18311 break;
18316 case "Name": 18312 case "Name":
18317 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18313 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18318 break; 18314 break;
18319 case "Type": 18315 case "Type":
18320 string typeString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18316 var typeString = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18321 if (!Enum.TryParse<ContainerType>(typeString, out type)) 18317 if (!Enum.TryParse<ContainerType>(typeString, out type))
18322 { 18318 {
18323 this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Type", typeString, "attached, detached")); 18319 this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Type", typeString, "attached, detached"));
18324 } 18320 }
18325 break; 18321 break;
18326 default: 18322 default:
18327 this.Core.UnexpectedAttribute(node, attrib); 18323 this.Core.UnexpectedAttribute(node, attrib);
18328 break; 18324 break;
18329 } 18325 }
18330 } 18326 }
18331 else 18327 else
@@ -18361,18 +18357,18 @@ namespace WixToolset.Core
18361 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DownloadUrl", "Type", "attached")); 18357 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "DownloadUrl", "Type", "attached"));
18362 } 18358 }
18363 18359
18364 foreach (XElement child in node.Elements()) 18360 foreach (var child in node.Elements())
18365 { 18361 {
18366 if (CompilerCore.WixNamespace == child.Name.Namespace) 18362 if (CompilerCore.WixNamespace == child.Name.Namespace)
18367 { 18363 {
18368 switch (child.Name.LocalName) 18364 switch (child.Name.LocalName)
18369 { 18365 {
18370 case "PackageGroupRef": 18366 case "PackageGroupRef":
18371 this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.Container, id.Id); 18367 this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.Container, id.Id);
18372 break; 18368 break;
18373 default: 18369 default:
18374 this.Core.UnexpectedElement(node, child); 18370 this.Core.UnexpectedElement(node, child);
18375 break; 18371 break;
18376 } 18372 }
18377 } 18373 }
18378 else 18374 else
@@ -18397,10 +18393,10 @@ namespace WixToolset.Core
18397 /// <param name="node">Element to parse</param> 18393 /// <param name="node">Element to parse</param>
18398 private void ParseBootstrapperApplicationElement(XElement node) 18394 private void ParseBootstrapperApplicationElement(XElement node)
18399 { 18395 {
18400 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18396 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18401 string id = null; 18397 string id = null;
18402 string previousId = null; 18398 string previousId = null;
18403 ComplexReferenceChildType previousType = ComplexReferenceChildType.Unknown; 18399 var previousType = ComplexReferenceChildType.Unknown;
18404 18400
18405 // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. 18401 // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry.
18406 id = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false); 18402 id = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false);
@@ -18410,23 +18406,23 @@ namespace WixToolset.Core
18410 previousType = ComplexReferenceChildType.Payload; 18406 previousType = ComplexReferenceChildType.Payload;
18411 } 18407 }
18412 18408
18413 foreach (XElement child in node.Elements()) 18409 foreach (var child in node.Elements())
18414 { 18410 {
18415 if (CompilerCore.WixNamespace == child.Name.Namespace) 18411 if (CompilerCore.WixNamespace == child.Name.Namespace)
18416 { 18412 {
18417 switch (child.Name.LocalName) 18413 switch (child.Name.LocalName)
18418 { 18414 {
18419 case "Payload": 18415 case "Payload":
18420 previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId); 18416 previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId);
18421 previousType = ComplexReferenceChildType.Payload; 18417 previousType = ComplexReferenceChildType.Payload;
18422 break; 18418 break;
18423 case "PayloadGroupRef": 18419 case "PayloadGroupRef":
18424 previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId); 18420 previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId);
18425 previousType = ComplexReferenceChildType.PayloadGroup; 18421 previousType = ComplexReferenceChildType.PayloadGroup;
18426 break; 18422 break;
18427 default: 18423 default:
18428 this.Core.UnexpectedElement(node, child); 18424 this.Core.UnexpectedElement(node, child);
18429 break; 18425 break;
18430 } 18426 }
18431 } 18427 }
18432 else 18428 else
@@ -18465,23 +18461,23 @@ namespace WixToolset.Core
18465 /// <param name="node">Element to parse</param> 18461 /// <param name="node">Element to parse</param>
18466 private void ParseBootstrapperApplicationRefElement(XElement node) 18462 private void ParseBootstrapperApplicationRefElement(XElement node)
18467 { 18463 {
18468 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18464 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18469 string id = null; 18465 string id = null;
18470 string previousId = null; 18466 string previousId = null;
18471 ComplexReferenceChildType previousType = ComplexReferenceChildType.Unknown; 18467 var previousType = ComplexReferenceChildType.Unknown;
18472 18468
18473 foreach (XAttribute attrib in node.Attributes()) 18469 foreach (var attrib in node.Attributes())
18474 { 18470 {
18475 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 18471 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
18476 { 18472 {
18477 switch (attrib.Name.LocalName) 18473 switch (attrib.Name.LocalName)
18478 { 18474 {
18479 case "Id": 18475 case "Id":
18480 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 18476 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
18481 break; 18477 break;
18482 default: 18478 default:
18483 this.Core.UnexpectedAttribute(node, attrib); 18479 this.Core.UnexpectedAttribute(node, attrib);
18484 break; 18480 break;
18485 } 18481 }
18486 } 18482 }
18487 else 18483 else
@@ -18490,23 +18486,23 @@ namespace WixToolset.Core
18490 } 18486 }
18491 } 18487 }
18492 18488
18493 foreach (XElement child in node.Elements()) 18489 foreach (var child in node.Elements())
18494 { 18490 {
18495 if (CompilerCore.WixNamespace == child.Name.Namespace) 18491 if (CompilerCore.WixNamespace == child.Name.Namespace)
18496 { 18492 {
18497 switch (child.Name.LocalName) 18493 switch (child.Name.LocalName)
18498 { 18494 {
18499 case "Payload": 18495 case "Payload":
18500 previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId); 18496 previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId);
18501 previousType = ComplexReferenceChildType.Payload; 18497 previousType = ComplexReferenceChildType.Payload;
18502 break; 18498 break;
18503 case "PayloadGroupRef": 18499 case "PayloadGroupRef":
18504 previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId); 18500 previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId);
18505 previousType = ComplexReferenceChildType.PayloadGroup; 18501 previousType = ComplexReferenceChildType.PayloadGroup;
18506 break; 18502 break;
18507 default: 18503 default:
18508 this.Core.UnexpectedElement(node, child); 18504 this.Core.UnexpectedElement(node, child);
18509 break; 18505 break;
18510 } 18506 }
18511 } 18507 }
18512 else 18508 else
@@ -18537,37 +18533,37 @@ namespace WixToolset.Core
18537 { 18533 {
18538 const string defaultClassification = "Update"; 18534 const string defaultClassification = "Update";
18539 18535
18540 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18536 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18541 string manufacturer = null; 18537 string manufacturer = null;
18542 string department = null; 18538 string department = null;
18543 string productFamily = null; 18539 string productFamily = null;
18544 string name = null; 18540 string name = null;
18545 string classification = defaultClassification; 18541 var classification = defaultClassification;
18546 18542
18547 foreach (XAttribute attrib in node.Attributes()) 18543 foreach (var attrib in node.Attributes())
18548 { 18544 {
18549 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 18545 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
18550 { 18546 {
18551 switch (attrib.Name.LocalName) 18547 switch (attrib.Name.LocalName)
18552 { 18548 {
18553 case "Manufacturer": 18549 case "Manufacturer":
18554 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18550 manufacturer = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18555 break; 18551 break;
18556 case "Department": 18552 case "Department":
18557 department = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18553 department = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18558 break; 18554 break;
18559 case "ProductFamily": 18555 case "ProductFamily":
18560 productFamily = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18556 productFamily = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18561 break; 18557 break;
18562 case "Name": 18558 case "Name":
18563 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18559 name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18564 break; 18560 break;
18565 case "Classification": 18561 case "Classification":
18566 classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18562 classification = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18567 break; 18563 break;
18568 default: 18564 default:
18569 this.Core.UnexpectedAttribute(node, attrib); 18565 this.Core.UnexpectedAttribute(node, attrib);
18570 break; 18566 break;
18571 } 18567 }
18572 } 18568 }
18573 else 18569 else
@@ -18637,19 +18633,21 @@ namespace WixToolset.Core
18637 Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); 18633 Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType);
18638 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType); 18634 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType);
18639 18635
18640 string id = ParsePayloadElementContent(node, parentType, parentId, previousType, previousId, true); 18636 var id = this.ParsePayloadElementContent(node, parentType, parentId, previousType, previousId, true);
18641 Dictionary<string, string> context = new Dictionary<string, string>(); 18637 var context = new Dictionary<string, string>
18642 context["Id"] = id; 18638 {
18639 ["Id"] = id
18640 };
18643 18641
18644 foreach (XElement child in node.Elements()) 18642 foreach (var child in node.Elements())
18645 { 18643 {
18646 if (CompilerCore.WixNamespace == child.Name.Namespace) 18644 if (CompilerCore.WixNamespace == child.Name.Namespace)
18647 { 18645 {
18648 switch (child.Name.LocalName) 18646 switch (child.Name.LocalName)
18649 { 18647 {
18650 default: 18648 default:
18651 this.Core.UnexpectedElement(node, child); 18649 this.Core.UnexpectedElement(node, child);
18652 break; 18650 break;
18653 } 18651 }
18654 } 18652 }
18655 else 18653 else
@@ -18671,9 +18669,9 @@ namespace WixToolset.Core
18671 { 18669 {
18672 Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); 18670 Debug.Assert(ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType);
18673 18671
18674 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18672 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18675 YesNoDefaultType compressed = YesNoDefaultType.Default; 18673 var compressed = YesNoDefaultType.Default;
18676 YesNoType enableSignatureVerification = YesNoType.No; 18674 var enableSignatureVerification = YesNoType.No;
18677 Identifier id = null; 18675 Identifier id = null;
18678 string name = null; 18676 string name = null;
18679 string sourceFile = null; 18677 string sourceFile = null;
@@ -18682,35 +18680,35 @@ namespace WixToolset.Core
18682 18680
18683 // This list lets us evaluate extension attributes *after* all core attributes 18681 // This list lets us evaluate extension attributes *after* all core attributes
18684 // have been parsed and dealt with, regardless of authoring order. 18682 // have been parsed and dealt with, regardless of authoring order.
18685 List<XAttribute> extensionAttributes = new List<XAttribute>(); 18683 var extensionAttributes = new List<XAttribute>();
18686 18684
18687 foreach (XAttribute attrib in node.Attributes()) 18685 foreach (var attrib in node.Attributes())
18688 { 18686 {
18689 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 18687 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
18690 { 18688 {
18691 switch (attrib.Name.LocalName) 18689 switch (attrib.Name.LocalName)
18692 { 18690 {
18693 case "Id": 18691 case "Id":
18694 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 18692 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
18695 break; 18693 break;
18696 case "Compressed": 18694 case "Compressed":
18697 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); 18695 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
18698 break; 18696 break;
18699 case "Name": 18697 case "Name":
18700 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); 18698 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true);
18701 break; 18699 break;
18702 case "SourceFile": 18700 case "SourceFile":
18703 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18701 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18704 break; 18702 break;
18705 case "DownloadUrl": 18703 case "DownloadUrl":
18706 downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18704 downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18707 break; 18705 break;
18708 case "EnableSignatureVerification": 18706 case "EnableSignatureVerification":
18709 enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 18707 enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
18710 break; 18708 break;
18711 default: 18709 default:
18712 this.Core.UnexpectedAttribute(node, attrib); 18710 this.Core.UnexpectedAttribute(node, attrib);
18713 break; 18711 break;
18714 } 18712 }
18715 } 18713 }
18716 else 18714 else
@@ -18731,18 +18729,20 @@ namespace WixToolset.Core
18731 } 18729 }
18732 18730
18733 // Now that the PayloadId is known, we can parse the extension attributes. 18731 // Now that the PayloadId is known, we can parse the extension attributes.
18734 Dictionary<string, string> context = new Dictionary<string, string>(); 18732 var context = new Dictionary<string, string>
18735 context["Id"] = id.Id; 18733 {
18734 ["Id"] = id.Id
18735 };
18736 18736
18737 foreach (XAttribute extensionAttribute in extensionAttributes) 18737 foreach (var extensionAttribute in extensionAttributes)
18738 { 18738 {
18739 this.Core.ParseExtensionAttribute(node, extensionAttribute, context); 18739 this.Core.ParseExtensionAttribute(node, extensionAttribute, context);
18740 } 18740 }
18741 18741
18742 // We only handle the elements we care about. Let caller handle other children. 18742 // We only handle the elements we care about. Let caller handle other children.
18743 foreach (XElement child in node.Elements(CompilerCore.WixNamespace + "RemotePayload")) 18743 foreach (var child in node.Elements(CompilerCore.WixNamespace + "RemotePayload"))
18744 { 18744 {
18745 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 18745 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
18746 18746
18747 if (CompilerCore.WixNamespace == node.Name.Namespace && node.Name.LocalName != "ExePackage") 18747 if (CompilerCore.WixNamespace == node.Name.Namespace && node.Name.LocalName != "ExePackage")
18748 { 18748 {
@@ -18780,7 +18780,7 @@ namespace WixToolset.Core
18780 { 18780 {
18781 if (compressed == YesNoDefaultType.No) 18781 if (compressed == YesNoDefaultType.No)
18782 { 18782 {
18783 Core.Write(WarningMessages.UxPayloadsOnlySupportEmbedding(sourceLineNumbers, sourceFile)); 18783 this.Core.Write(WarningMessages.UxPayloadsOnlySupportEmbedding(sourceLineNumbers, sourceFile));
18784 } 18784 }
18785 18785
18786 compressed = YesNoDefaultType.Yes; 18786 compressed = YesNoDefaultType.Yes;
@@ -18793,39 +18793,39 @@ namespace WixToolset.Core
18793 18793
18794 private Wix.RemotePayload ParseRemotePayloadElement(XElement node) 18794 private Wix.RemotePayload ParseRemotePayloadElement(XElement node)
18795 { 18795 {
18796 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18796 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18797 Wix.RemotePayload remotePayload = new Wix.RemotePayload(); 18797 var remotePayload = new Wix.RemotePayload();
18798 18798
18799 foreach (XAttribute attrib in node.Attributes()) 18799 foreach (var attrib in node.Attributes())
18800 { 18800 {
18801 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 18801 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
18802 { 18802 {
18803 switch (attrib.Name.LocalName) 18803 switch (attrib.Name.LocalName)
18804 { 18804 {
18805 case "CertificatePublicKey": 18805 case "CertificatePublicKey":
18806 remotePayload.CertificatePublicKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18806 remotePayload.CertificatePublicKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18807 break; 18807 break;
18808 case "CertificateThumbprint": 18808 case "CertificateThumbprint":
18809 remotePayload.CertificateThumbprint = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18809 remotePayload.CertificateThumbprint = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18810 break; 18810 break;
18811 case "Description": 18811 case "Description":
18812 remotePayload.Description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18812 remotePayload.Description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18813 break; 18813 break;
18814 case "Hash": 18814 case "Hash":
18815 remotePayload.Hash = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18815 remotePayload.Hash = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18816 break; 18816 break;
18817 case "ProductName": 18817 case "ProductName":
18818 remotePayload.ProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18818 remotePayload.ProductName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18819 break; 18819 break;
18820 case "Size": 18820 case "Size":
18821 remotePayload.Size = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 18821 remotePayload.Size = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
18822 break; 18822 break;
18823 case "Version": 18823 case "Version":
18824 remotePayload.Version = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 18824 remotePayload.Version = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
18825 break; 18825 break;
18826 default: 18826 default:
18827 this.Core.UnexpectedAttribute(node, attrib); 18827 this.Core.UnexpectedAttribute(node, attrib);
18828 break; 18828 break;
18829 } 18829 }
18830 } 18830 }
18831 else 18831 else
@@ -18913,21 +18913,21 @@ namespace WixToolset.Core
18913 { 18913 {
18914 Debug.Assert(ComplexReferenceParentType.Unknown == parentType || ComplexReferenceParentType.Layout == parentType || ComplexReferenceParentType.PayloadGroup == parentType); 18914 Debug.Assert(ComplexReferenceParentType.Unknown == parentType || ComplexReferenceParentType.Layout == parentType || ComplexReferenceParentType.PayloadGroup == parentType);
18915 18915
18916 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18916 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18917 Identifier id = null; 18917 Identifier id = null;
18918 18918
18919 foreach (XAttribute attrib in node.Attributes()) 18919 foreach (var attrib in node.Attributes())
18920 { 18920 {
18921 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 18921 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
18922 { 18922 {
18923 switch (attrib.Name.LocalName) 18923 switch (attrib.Name.LocalName)
18924 { 18924 {
18925 case "Id": 18925 case "Id":
18926 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 18926 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
18927 break; 18927 break;
18928 default: 18928 default:
18929 this.Core.UnexpectedAttribute(node, attrib); 18929 this.Core.UnexpectedAttribute(node, attrib);
18930 break; 18930 break;
18931 } 18931 }
18932 } 18932 }
18933 else 18933 else
@@ -18942,25 +18942,25 @@ namespace WixToolset.Core
18942 id = Identifier.Invalid; 18942 id = Identifier.Invalid;
18943 } 18943 }
18944 18944
18945 ComplexReferenceChildType previousType = ComplexReferenceChildType.Unknown; 18945 var previousType = ComplexReferenceChildType.Unknown;
18946 string previousId = null; 18946 string previousId = null;
18947 foreach (XElement child in node.Elements()) 18947 foreach (var child in node.Elements())
18948 { 18948 {
18949 if (CompilerCore.WixNamespace == child.Name.Namespace) 18949 if (CompilerCore.WixNamespace == child.Name.Namespace)
18950 { 18950 {
18951 switch (child.Name.LocalName) 18951 switch (child.Name.LocalName)
18952 { 18952 {
18953 case "Payload": 18953 case "Payload":
18954 previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.PayloadGroup, id.Id, previousType, previousId); 18954 previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.PayloadGroup, id.Id, previousType, previousId);
18955 previousType = ComplexReferenceChildType.Payload; 18955 previousType = ComplexReferenceChildType.Payload;
18956 break; 18956 break;
18957 case "PayloadGroupRef": 18957 case "PayloadGroupRef":
18958 previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.PayloadGroup, id.Id, previousType, previousId); 18958 previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.PayloadGroup, id.Id, previousType, previousId);
18959 previousType = ComplexReferenceChildType.PayloadGroup; 18959 previousType = ComplexReferenceChildType.PayloadGroup;
18960 break; 18960 break;
18961 default: 18961 default:
18962 this.Core.UnexpectedElement(node, child); 18962 this.Core.UnexpectedElement(node, child);
18963 break; 18963 break;
18964 } 18964 }
18965 } 18965 }
18966 else 18966 else
@@ -18989,22 +18989,22 @@ namespace WixToolset.Core
18989 Debug.Assert(ComplexReferenceParentType.Layout == parentType || ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType); 18989 Debug.Assert(ComplexReferenceParentType.Layout == parentType || ComplexReferenceParentType.PayloadGroup == parentType || ComplexReferenceParentType.Package == parentType || ComplexReferenceParentType.Container == parentType);
18990 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType); 18990 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PayloadGroup == previousType || ComplexReferenceChildType.Payload == previousType);
18991 18991
18992 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 18992 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
18993 string id = null; 18993 string id = null;
18994 18994
18995 foreach (XAttribute attrib in node.Attributes()) 18995 foreach (var attrib in node.Attributes())
18996 { 18996 {
18997 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 18997 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
18998 { 18998 {
18999 switch (attrib.Name.LocalName) 18999 switch (attrib.Name.LocalName)
19000 { 19000 {
19001 case "Id": 19001 case "Id":
19002 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 19002 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
19003 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePayloadGroup", id); 19003 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePayloadGroup", id);
19004 break; 19004 break;
19005 default: 19005 default:
19006 this.Core.UnexpectedAttribute(node, attrib); 19006 this.Core.UnexpectedAttribute(node, attrib);
19007 break; 19007 break;
19008 } 19008 }
19009 } 19009 }
19010 else 19010 else
@@ -19058,29 +19058,29 @@ namespace WixToolset.Core
19058 /// <param name="packageId">Id of parent element</param> 19058 /// <param name="packageId">Id of parent element</param>
19059 private void ParseExitCodeElement(XElement node, string packageId) 19059 private void ParseExitCodeElement(XElement node, string packageId)
19060 { 19060 {
19061 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 19061 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
19062 var value = CompilerConstants.IntegerNotSet; 19062 var value = CompilerConstants.IntegerNotSet;
19063 var behavior = ExitCodeBehaviorType.NotSet; 19063 var behavior = ExitCodeBehaviorType.NotSet;
19064 19064
19065 foreach (XAttribute attrib in node.Attributes()) 19065 foreach (var attrib in node.Attributes())
19066 { 19066 {
19067 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 19067 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
19068 { 19068 {
19069 switch (attrib.Name.LocalName) 19069 switch (attrib.Name.LocalName)
19070 { 19070 {
19071 case "Value": 19071 case "Value":
19072 value = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, int.MinValue + 2, int.MaxValue); 19072 value = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, Int32.MinValue + 2, Int32.MaxValue);
19073 break; 19073 break;
19074 case "Behavior": 19074 case "Behavior":
19075 string behaviorString = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19075 var behaviorString = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19076 if (!Enum.TryParse<ExitCodeBehaviorType>(behaviorString, true, out behavior)) 19076 if (!Enum.TryParse<ExitCodeBehaviorType>(behaviorString, true, out behavior))
19077 { 19077 {
19078 this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Behavior", behaviorString, "success, error, scheduleReboot, forceReboot")); 19078 this.Core.Write(ErrorMessages.IllegalAttributeValueWithLegalList(sourceLineNumbers, node.Name.LocalName, "Behavior", behaviorString, "success, error, scheduleReboot, forceReboot"));
19079 } 19079 }
19080 break; 19080 break;
19081 default: 19081 default:
19082 this.Core.UnexpectedAttribute(node, attrib); 19082 this.Core.UnexpectedAttribute(node, attrib);
19083 break; 19083 break;
19084 } 19084 }
19085 } 19085 }
19086 else 19086 else
@@ -19111,36 +19111,36 @@ namespace WixToolset.Core
19111 /// <param name="node">Element to parse</param> 19111 /// <param name="node">Element to parse</param>
19112 private void ParseChainElement(XElement node) 19112 private void ParseChainElement(XElement node)
19113 { 19113 {
19114 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 19114 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
19115 var attributes = WixChainAttributes.None; 19115 var attributes = WixChainAttributes.None;
19116 19116
19117 foreach (XAttribute attrib in node.Attributes()) 19117 foreach (var attrib in node.Attributes())
19118 { 19118 {
19119 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 19119 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
19120 { 19120 {
19121 switch (attrib.Name.LocalName) 19121 switch (attrib.Name.LocalName)
19122 { 19122 {
19123 case "DisableRollback": 19123 case "DisableRollback":
19124 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 19124 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
19125 { 19125 {
19126 attributes |= WixChainAttributes.DisableRollback; 19126 attributes |= WixChainAttributes.DisableRollback;
19127 } 19127 }
19128 break; 19128 break;
19129 case "DisableSystemRestore": 19129 case "DisableSystemRestore":
19130 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 19130 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
19131 { 19131 {
19132 attributes |= WixChainAttributes.DisableSystemRestore; 19132 attributes |= WixChainAttributes.DisableSystemRestore;
19133 } 19133 }
19134 break; 19134 break;
19135 case "ParallelCache": 19135 case "ParallelCache":
19136 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 19136 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
19137 { 19137 {
19138 attributes |= WixChainAttributes.ParallelCache; 19138 attributes |= WixChainAttributes.ParallelCache;
19139 } 19139 }
19140 break; 19140 break;
19141 default: 19141 default:
19142 this.Core.UnexpectedAttribute(node, attrib); 19142 this.Core.UnexpectedAttribute(node, attrib);
19143 break; 19143 break;
19144 } 19144 }
19145 } 19145 }
19146 else 19146 else
@@ -19152,42 +19152,42 @@ namespace WixToolset.Core
19152 // Ensure there is always a rollback boundary at the beginning of the chain. 19152 // Ensure there is always a rollback boundary at the beginning of the chain.
19153 this.CreateRollbackBoundary(sourceLineNumbers, new Identifier("WixDefaultBoundary", AccessModifier.Public), YesNoType.Yes, YesNoType.No, ComplexReferenceParentType.PackageGroup, "WixChain", ComplexReferenceChildType.Unknown, null); 19153 this.CreateRollbackBoundary(sourceLineNumbers, new Identifier("WixDefaultBoundary", AccessModifier.Public), YesNoType.Yes, YesNoType.No, ComplexReferenceParentType.PackageGroup, "WixChain", ComplexReferenceChildType.Unknown, null);
19154 19154
19155 string previousId = "WixDefaultBoundary"; 19155 var previousId = "WixDefaultBoundary";
19156 ComplexReferenceChildType previousType = ComplexReferenceChildType.Package; 19156 var previousType = ComplexReferenceChildType.Package;
19157 19157
19158 foreach (XElement child in node.Elements()) 19158 foreach (var child in node.Elements())
19159 { 19159 {
19160 if (CompilerCore.WixNamespace == child.Name.Namespace) 19160 if (CompilerCore.WixNamespace == child.Name.Namespace)
19161 { 19161 {
19162 switch (child.Name.LocalName) 19162 switch (child.Name.LocalName)
19163 { 19163 {
19164 case "MsiPackage": 19164 case "MsiPackage":
19165 previousId = this.ParseMsiPackageElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId); 19165 previousId = this.ParseMsiPackageElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId);
19166 previousType = ComplexReferenceChildType.Package; 19166 previousType = ComplexReferenceChildType.Package;
19167 break; 19167 break;
19168 case "MspPackage": 19168 case "MspPackage":
19169 previousId = this.ParseMspPackageElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId); 19169 previousId = this.ParseMspPackageElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId);
19170 previousType = ComplexReferenceChildType.Package; 19170 previousType = ComplexReferenceChildType.Package;
19171 break; 19171 break;
19172 case "MsuPackage": 19172 case "MsuPackage":
19173 previousId = this.ParseMsuPackageElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId); 19173 previousId = this.ParseMsuPackageElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId);
19174 previousType = ComplexReferenceChildType.Package; 19174 previousType = ComplexReferenceChildType.Package;
19175 break; 19175 break;
19176 case "ExePackage": 19176 case "ExePackage":
19177 previousId = this.ParseExePackageElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId); 19177 previousId = this.ParseExePackageElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId);
19178 previousType = ComplexReferenceChildType.Package; 19178 previousType = ComplexReferenceChildType.Package;
19179 break; 19179 break;
19180 case "RollbackBoundary": 19180 case "RollbackBoundary":
19181 previousId = this.ParseRollbackBoundaryElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId); 19181 previousId = this.ParseRollbackBoundaryElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId);
19182 previousType = ComplexReferenceChildType.Package; 19182 previousType = ComplexReferenceChildType.Package;
19183 break; 19183 break;
19184 case "PackageGroupRef": 19184 case "PackageGroupRef":
19185 previousId = this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId); 19185 previousId = this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.PackageGroup, "WixChain", previousType, previousId);
19186 previousType = ComplexReferenceChildType.PackageGroup; 19186 previousType = ComplexReferenceChildType.PackageGroup;
19187 break; 19187 break;
19188 default: 19188 default:
19189 this.Core.UnexpectedElement(node, child); 19189 this.Core.UnexpectedElement(node, child);
19190 break; 19190 break;
19191 } 19191 }
19192 } 19192 }
19193 else 19193 else
@@ -19220,7 +19220,7 @@ namespace WixToolset.Core
19220 /// <returns>Identifier for package element.</returns> 19220 /// <returns>Identifier for package element.</returns>
19221 private string ParseMsiPackageElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId) 19221 private string ParseMsiPackageElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId)
19222 { 19222 {
19223 return ParseChainPackage(node, WixBundlePackageType.Msi, parentType, parentId, previousType, previousId); 19223 return this.ParseChainPackage(node, WixBundlePackageType.Msi, parentType, parentId, previousType, previousId);
19224 } 19224 }
19225 19225
19226 /// <summary> 19226 /// <summary>
@@ -19234,7 +19234,7 @@ namespace WixToolset.Core
19234 /// <returns>Identifier for package element.</returns> 19234 /// <returns>Identifier for package element.</returns>
19235 private string ParseMspPackageElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId) 19235 private string ParseMspPackageElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId)
19236 { 19236 {
19237 return ParseChainPackage(node, WixBundlePackageType.Msp, parentType, parentId, previousType, previousId); 19237 return this.ParseChainPackage(node, WixBundlePackageType.Msp, parentType, parentId, previousType, previousId);
19238 } 19238 }
19239 19239
19240 /// <summary> 19240 /// <summary>
@@ -19248,7 +19248,7 @@ namespace WixToolset.Core
19248 /// <returns>Identifier for package element.</returns> 19248 /// <returns>Identifier for package element.</returns>
19249 private string ParseMsuPackageElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId) 19249 private string ParseMsuPackageElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId)
19250 { 19250 {
19251 return ParseChainPackage(node, WixBundlePackageType.Msu, parentType, parentId, previousType, previousId); 19251 return this.ParseChainPackage(node, WixBundlePackageType.Msu, parentType, parentId, previousType, previousId);
19252 } 19252 }
19253 19253
19254 /// <summary> 19254 /// <summary>
@@ -19262,7 +19262,7 @@ namespace WixToolset.Core
19262 /// <returns>Identifier for package element.</returns> 19262 /// <returns>Identifier for package element.</returns>
19263 private string ParseExePackageElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId) 19263 private string ParseExePackageElement(XElement node, ComplexReferenceParentType parentType, string parentId, ComplexReferenceChildType previousType, string previousId)
19264 { 19264 {
19265 return ParseChainPackage(node, WixBundlePackageType.Exe, parentType, parentId, previousType, previousId); 19265 return this.ParseChainPackage(node, WixBundlePackageType.Exe, parentType, parentId, previousType, previousId);
19266 } 19266 }
19267 19267
19268 /// <summary> 19268 /// <summary>
@@ -19279,34 +19279,34 @@ namespace WixToolset.Core
19279 Debug.Assert(ComplexReferenceParentType.PackageGroup == parentType); 19279 Debug.Assert(ComplexReferenceParentType.PackageGroup == parentType);
19280 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PackageGroup == previousType || ComplexReferenceChildType.Package == previousType); 19280 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PackageGroup == previousType || ComplexReferenceChildType.Package == previousType);
19281 19281
19282 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 19282 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
19283 Identifier id = null; 19283 Identifier id = null;
19284 YesNoType vital = YesNoType.Yes; 19284 var vital = YesNoType.Yes;
19285 YesNoType transaction = YesNoType.No; 19285 var transaction = YesNoType.No;
19286 19286
19287 // This list lets us evaluate extension attributes *after* all core attributes 19287 // This list lets us evaluate extension attributes *after* all core attributes
19288 // have been parsed and dealt with, regardless of authoring order. 19288 // have been parsed and dealt with, regardless of authoring order.
19289 List<XAttribute> extensionAttributes = new List<XAttribute>(); 19289 var extensionAttributes = new List<XAttribute>();
19290 19290
19291 foreach (XAttribute attrib in node.Attributes()) 19291 foreach (var attrib in node.Attributes())
19292 { 19292 {
19293 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 19293 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
19294 { 19294 {
19295 bool allowed = true; 19295 var allowed = true;
19296 switch (attrib.Name.LocalName) 19296 switch (attrib.Name.LocalName)
19297 { 19297 {
19298 case "Id": 19298 case "Id":
19299 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 19299 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
19300 break; 19300 break;
19301 case "Vital": 19301 case "Vital":
19302 vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19302 vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19303 break; 19303 break;
19304 case "Transaction": 19304 case "Transaction":
19305 transaction = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19305 transaction = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19306 break; 19306 break;
19307 default: 19307 default:
19308 allowed = false; 19308 allowed = false;
19309 break; 19309 break;
19310 } 19310 }
19311 19311
19312 if (!allowed) 19312 if (!allowed)
@@ -19340,9 +19340,11 @@ namespace WixToolset.Core
19340 } 19340 }
19341 19341
19342 // Now that the rollback identifier is known, we can parse the extension attributes... 19342 // Now that the rollback identifier is known, we can parse the extension attributes...
19343 Dictionary<string, string> contextValues = new Dictionary<string, string>(); 19343 var contextValues = new Dictionary<string, string>
19344 contextValues["RollbackBoundaryId"] = id.Id; 19344 {
19345 foreach (XAttribute attribute in extensionAttributes) 19345 ["RollbackBoundaryId"] = id.Id
19346 };
19347 foreach (var attribute in extensionAttributes)
19346 { 19348 {
19347 this.Core.ParseExtensionAttribute(node, attribute, contextValues); 19349 this.Core.ParseExtensionAttribute(node, attribute, contextValues);
19348 } 19350 }
@@ -19374,165 +19376,165 @@ namespace WixToolset.Core
19374 Debug.Assert(ComplexReferenceParentType.PackageGroup == parentType); 19376 Debug.Assert(ComplexReferenceParentType.PackageGroup == parentType);
19375 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PackageGroup == previousType || ComplexReferenceChildType.Package == previousType); 19377 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PackageGroup == previousType || ComplexReferenceChildType.Package == previousType);
19376 19378
19377 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 19379 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
19378 Identifier id = null; 19380 Identifier id = null;
19379 string name = null; 19381 string name = null;
19380 string sourceFile = null; 19382 string sourceFile = null;
19381 string downloadUrl = null; 19383 string downloadUrl = null;
19382 string after = null; 19384 string after = null;
19383 string installCondition = null; 19385 string installCondition = null;
19384 YesNoAlwaysType cache = YesNoAlwaysType.Yes; // the default is to cache everything in tradeoff for stability over disk space. 19386 var cache = YesNoAlwaysType.Yes; // the default is to cache everything in tradeoff for stability over disk space.
19385 string cacheId = null; 19387 string cacheId = null;
19386 string description = null; 19388 string description = null;
19387 string displayName = null; 19389 string displayName = null;
19388 string logPathVariable = (packageType == WixBundlePackageType.Msu) ? String.Empty : null; 19390 var logPathVariable = (packageType == WixBundlePackageType.Msu) ? String.Empty : null;
19389 string rollbackPathVariable = (packageType == WixBundlePackageType.Msu) ? String.Empty : null; 19391 var rollbackPathVariable = (packageType == WixBundlePackageType.Msu) ? String.Empty : null;
19390 YesNoType permanent = YesNoType.NotSet; 19392 var permanent = YesNoType.NotSet;
19391 YesNoType visible = YesNoType.NotSet; 19393 var visible = YesNoType.NotSet;
19392 YesNoType vital = YesNoType.Yes; 19394 var vital = YesNoType.Yes;
19393 string installCommand = null; 19395 string installCommand = null;
19394 string repairCommand = null; 19396 string repairCommand = null;
19395 YesNoType repairable = YesNoType.NotSet; 19397 var repairable = YesNoType.NotSet;
19396 string uninstallCommand = null; 19398 string uninstallCommand = null;
19397 YesNoDefaultType perMachine = YesNoDefaultType.NotSet; 19399 var perMachine = YesNoDefaultType.NotSet;
19398 string detectCondition = null; 19400 string detectCondition = null;
19399 string protocol = null; 19401 string protocol = null;
19400 int installSize = CompilerConstants.IntegerNotSet; 19402 var installSize = CompilerConstants.IntegerNotSet;
19401 string msuKB = null; 19403 string msuKB = null;
19402 YesNoType suppressLooseFilePayloadGeneration = YesNoType.NotSet; 19404 var suppressLooseFilePayloadGeneration = YesNoType.NotSet;
19403 YesNoType enableSignatureVerification = YesNoType.No; 19405 var enableSignatureVerification = YesNoType.No;
19404 YesNoDefaultType compressed = YesNoDefaultType.Default; 19406 var compressed = YesNoDefaultType.Default;
19405 YesNoType displayInternalUI = YesNoType.NotSet; 19407 var displayInternalUI = YesNoType.NotSet;
19406 YesNoType enableFeatureSelection = YesNoType.NotSet; 19408 var enableFeatureSelection = YesNoType.NotSet;
19407 YesNoType forcePerMachine = YesNoType.NotSet; 19409 var forcePerMachine = YesNoType.NotSet;
19408 Wix.RemotePayload remotePayload = null; 19410 Wix.RemotePayload remotePayload = null;
19409 YesNoType slipstream = YesNoType.NotSet; 19411 var slipstream = YesNoType.NotSet;
19410 19412
19411 string[] expectedNetFx4Args = new string[] { "/q", "/norestart", "/chainingpackage" }; 19413 var expectedNetFx4Args = new string[] { "/q", "/norestart", "/chainingpackage" };
19412 19414
19413 // This list lets us evaluate extension attributes *after* all core attributes 19415 // This list lets us evaluate extension attributes *after* all core attributes
19414 // have been parsed and dealt with, regardless of authoring order. 19416 // have been parsed and dealt with, regardless of authoring order.
19415 List<XAttribute> extensionAttributes = new List<XAttribute>(); 19417 var extensionAttributes = new List<XAttribute>();
19416 19418
19417 foreach (XAttribute attrib in node.Attributes()) 19419 foreach (var attrib in node.Attributes())
19418 { 19420 {
19419 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 19421 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
19420 { 19422 {
19421 bool allowed = true; 19423 var allowed = true;
19422 switch (attrib.Name.LocalName) 19424 switch (attrib.Name.LocalName)
19423 { 19425 {
19424 case "Id": 19426 case "Id":
19425 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 19427 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
19426 break; 19428 break;
19427 case "Name": 19429 case "Name":
19428 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); 19430 name = this.Core.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true);
19429 if (!this.Core.IsValidLongFilename(name, false, true)) 19431 if (!this.Core.IsValidLongFilename(name, false, true))
19430 { 19432 {
19431 this.Core.Write(ErrorMessages.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Name", name)); 19433 this.Core.Write(ErrorMessages.IllegalLongFilename(sourceLineNumbers, node.Name.LocalName, "Name", name));
19432 } 19434 }
19433 break; 19435 break;
19434 case "SourceFile": 19436 case "SourceFile":
19435 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19437 sourceFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19436 break; 19438 break;
19437 case "DownloadUrl": 19439 case "DownloadUrl":
19438 downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19440 downloadUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19439 break; 19441 break;
19440 case "After": 19442 case "After":
19441 after = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19443 after = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19442 break; 19444 break;
19443 case "InstallCondition": 19445 case "InstallCondition":
19444 installCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19446 installCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19445 break; 19447 break;
19446 case "Cache": 19448 case "Cache":
19447 cache = this.Core.GetAttributeYesNoAlwaysValue(sourceLineNumbers, attrib); 19449 cache = this.Core.GetAttributeYesNoAlwaysValue(sourceLineNumbers, attrib);
19448 break; 19450 break;
19449 case "CacheId": 19451 case "CacheId":
19450 cacheId = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19452 cacheId = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19451 break; 19453 break;
19452 case "Description": 19454 case "Description":
19453 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19455 description = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19454 break; 19456 break;
19455 case "DisplayName": 19457 case "DisplayName":
19456 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19458 displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19457 break; 19459 break;
19458 case "DisplayInternalUI": 19460 case "DisplayInternalUI":
19459 displayInternalUI = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19461 displayInternalUI = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19460 allowed = (packageType == WixBundlePackageType.Msi || packageType == WixBundlePackageType.Msp); 19462 allowed = (packageType == WixBundlePackageType.Msi || packageType == WixBundlePackageType.Msp);
19461 break; 19463 break;
19462 case "EnableFeatureSelection": 19464 case "EnableFeatureSelection":
19463 enableFeatureSelection = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19465 enableFeatureSelection = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19464 allowed = (packageType == WixBundlePackageType.Msi); 19466 allowed = (packageType == WixBundlePackageType.Msi);
19465 break; 19467 break;
19466 case "ForcePerMachine": 19468 case "ForcePerMachine":
19467 forcePerMachine = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19469 forcePerMachine = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19468 allowed = (packageType == WixBundlePackageType.Msi); 19470 allowed = (packageType == WixBundlePackageType.Msi);
19469 break; 19471 break;
19470 case "LogPathVariable": 19472 case "LogPathVariable":
19471 logPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 19473 logPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
19472 break; 19474 break;
19473 case "RollbackLogPathVariable": 19475 case "RollbackLogPathVariable":
19474 rollbackPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 19476 rollbackPathVariable = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
19475 break; 19477 break;
19476 case "Permanent": 19478 case "Permanent":
19477 permanent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19479 permanent = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19478 break; 19480 break;
19479 case "Visible": 19481 case "Visible":
19480 visible = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19482 visible = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19481 allowed = (packageType == WixBundlePackageType.Msi); 19483 allowed = (packageType == WixBundlePackageType.Msi);
19482 break; 19484 break;
19483 case "Vital": 19485 case "Vital":
19484 vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19486 vital = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19485 break; 19487 break;
19486 case "InstallCommand": 19488 case "InstallCommand":
19487 installCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19489 installCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19488 allowed = (packageType == WixBundlePackageType.Exe); 19490 allowed = (packageType == WixBundlePackageType.Exe);
19489 break; 19491 break;
19490 case "RepairCommand": 19492 case "RepairCommand":
19491 repairCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 19493 repairCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
19492 repairable = YesNoType.Yes; 19494 repairable = YesNoType.Yes;
19493 allowed = (packageType == WixBundlePackageType.Exe); 19495 allowed = (packageType == WixBundlePackageType.Exe);
19494 break; 19496 break;
19495 case "UninstallCommand": 19497 case "UninstallCommand":
19496 uninstallCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19498 uninstallCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19497 allowed = (packageType == WixBundlePackageType.Exe); 19499 allowed = (packageType == WixBundlePackageType.Exe);
19498 break; 19500 break;
19499 case "PerMachine": 19501 case "PerMachine":
19500 perMachine = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); 19502 perMachine = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
19501 allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msp); 19503 allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msp);
19502 break; 19504 break;
19503 case "DetectCondition": 19505 case "DetectCondition":
19504 detectCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19506 detectCondition = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19505 allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msu); 19507 allowed = (packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msu);
19506 break; 19508 break;
19507 case "Protocol": 19509 case "Protocol":
19508 protocol = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19510 protocol = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19509 allowed = (packageType == WixBundlePackageType.Exe); 19511 allowed = (packageType == WixBundlePackageType.Exe);
19510 break; 19512 break;
19511 case "InstallSize": 19513 case "InstallSize":
19512 installSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); 19514 installSize = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int32.MaxValue);
19513 break; 19515 break;
19514 case "KB": 19516 case "KB":
19515 msuKB = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19517 msuKB = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19516 allowed = (packageType == WixBundlePackageType.Msu); 19518 allowed = (packageType == WixBundlePackageType.Msu);
19517 break; 19519 break;
19518 case "Compressed": 19520 case "Compressed":
19519 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); 19521 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
19520 break; 19522 break;
19521 case "SuppressLooseFilePayloadGeneration": 19523 case "SuppressLooseFilePayloadGeneration":
19522 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 19524 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
19523 suppressLooseFilePayloadGeneration = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19525 suppressLooseFilePayloadGeneration = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19524 allowed = (packageType == WixBundlePackageType.Msi); 19526 allowed = (packageType == WixBundlePackageType.Msi);
19525 break; 19527 break;
19526 case "EnableSignatureVerification": 19528 case "EnableSignatureVerification":
19527 enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19529 enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19528 break; 19530 break;
19529 case "Slipstream": 19531 case "Slipstream":
19530 slipstream = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 19532 slipstream = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
19531 allowed = (packageType == WixBundlePackageType.Msp); 19533 allowed = (packageType == WixBundlePackageType.Msp);
19532 break; 19534 break;
19533 default: 19535 default:
19534 allowed = false; 19536 allowed = false;
19535 break; 19537 break;
19536 } 19538 }
19537 19539
19538 if (!allowed) 19540 if (!allowed)
@@ -19548,9 +19550,9 @@ namespace WixToolset.Core
19548 } 19550 }
19549 19551
19550 // We need to handle RemotePayload up front because it effects value of sourceFile which is used in Id generation. Id is needed by other child elements. 19552 // We need to handle RemotePayload up front because it effects value of sourceFile which is used in Id generation. Id is needed by other child elements.
19551 foreach (XElement child in node.Elements(CompilerCore.WixNamespace + "RemotePayload")) 19553 foreach (var child in node.Elements(CompilerCore.WixNamespace + "RemotePayload"))
19552 { 19554 {
19553 SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); 19555 var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
19554 19556
19555 if (CompilerCore.WixNamespace == node.Name.Namespace && node.Name.LocalName != "ExePackage" && node.Name.LocalName != "MsuPackage") 19557 if (CompilerCore.WixNamespace == node.Name.Namespace && node.Name.LocalName != "ExePackage" && node.Name.LocalName != "MsuPackage")
19556 { 19558 {
@@ -19643,7 +19645,7 @@ namespace WixToolset.Core
19643 19645
19644 if (!String.IsNullOrEmpty(protocol) && protocol.Equals("netfx4", StringComparison.Ordinal)) 19646 if (!String.IsNullOrEmpty(protocol) && protocol.Equals("netfx4", StringComparison.Ordinal))
19645 { 19647 {
19646 foreach (string expectedArgument in expectedNetFx4Args) 19648 foreach (var expectedArgument in expectedNetFx4Args)
19647 { 19649 {
19648 if (null == installCommand || -1 == installCommand.IndexOf(expectedArgument, StringComparison.OrdinalIgnoreCase)) 19650 if (null == installCommand || -1 == installCommand.IndexOf(expectedArgument, StringComparison.OrdinalIgnoreCase))
19649 { 19651 {
@@ -19669,59 +19671,59 @@ namespace WixToolset.Core
19669 } 19671 }
19670 19672
19671 // Now that the package ID is known, we can parse the extension attributes... 19673 // Now that the package ID is known, we can parse the extension attributes...
19672 Dictionary<string, string> contextValues = new Dictionary<string, string>() { { "PackageId", id.Id } }; 19674 var contextValues = new Dictionary<string, string>() { { "PackageId", id.Id } };
19673 foreach (XAttribute attribute in extensionAttributes) 19675 foreach (var attribute in extensionAttributes)
19674 { 19676 {
19675 this.Core.ParseExtensionAttribute(node, attribute, contextValues); 19677 this.Core.ParseExtensionAttribute(node, attribute, contextValues);
19676 } 19678 }
19677 19679
19678 foreach (XElement child in node.Elements()) 19680 foreach (var child in node.Elements())
19679 { 19681 {
19680 if (CompilerCore.WixNamespace == child.Name.Namespace) 19682 if (CompilerCore.WixNamespace == child.Name.Namespace)
19681 { 19683 {
19682 bool allowed = true; 19684 var allowed = true;
19683 switch (child.Name.LocalName) 19685 switch (child.Name.LocalName)
19684 { 19686 {
19685 case "SlipstreamMsp": 19687 case "SlipstreamMsp":
19686 allowed = (packageType == WixBundlePackageType.Msi); 19688 allowed = (packageType == WixBundlePackageType.Msi);
19687 if (allowed) 19689 if (allowed)
19688 { 19690 {
19689 this.ParseSlipstreamMspElement(child, id.Id); 19691 this.ParseSlipstreamMspElement(child, id.Id);
19690 } 19692 }
19691 break; 19693 break;
19692 case "MsiProperty": 19694 case "MsiProperty":
19693 allowed = (packageType == WixBundlePackageType.Msi || packageType == WixBundlePackageType.Msp); 19695 allowed = (packageType == WixBundlePackageType.Msi || packageType == WixBundlePackageType.Msp);
19694 if (allowed) 19696 if (allowed)
19695 { 19697 {
19696 this.ParseMsiPropertyElement(child, id.Id); 19698 this.ParseMsiPropertyElement(child, id.Id);
19697 } 19699 }
19698 break; 19700 break;
19699 case "Payload": 19701 case "Payload":
19700 this.ParsePayloadElement(child, ComplexReferenceParentType.Package, id.Id, ComplexReferenceChildType.Unknown, null); 19702 this.ParsePayloadElement(child, ComplexReferenceParentType.Package, id.Id, ComplexReferenceChildType.Unknown, null);
19701 break; 19703 break;
19702 case "PayloadGroupRef": 19704 case "PayloadGroupRef":
19703 this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Package, id.Id, ComplexReferenceChildType.Unknown, null); 19705 this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Package, id.Id, ComplexReferenceChildType.Unknown, null);
19704 break; 19706 break;
19705 case "ExitCode": 19707 case "ExitCode":
19706 allowed = (packageType == WixBundlePackageType.Exe); 19708 allowed = (packageType == WixBundlePackageType.Exe);
19707 if (allowed) 19709 if (allowed)
19708 { 19710 {
19709 this.ParseExitCodeElement(child, id.Id); 19711 this.ParseExitCodeElement(child, id.Id);
19710 } 19712 }
19711 break; 19713 break;
19712 case "CommandLine": 19714 case "CommandLine":
19713 allowed = (packageType == WixBundlePackageType.Exe); 19715 allowed = (packageType == WixBundlePackageType.Exe);
19714 if (allowed) 19716 if (allowed)
19715 { 19717 {
19716 this.ParseCommandLineElement(child, id.Id); 19718 this.ParseCommandLineElement(child, id.Id);
19717 } 19719 }
19718 break; 19720 break;
19719 case "RemotePayload": 19721 case "RemotePayload":
19720 // Handled previously 19722 // Handled previously
19721 break; 19723 break;
19722 default: 19724 default:
19723 allowed = false; 19725 allowed = false;
19724 break; 19726 break;
19725 } 19727 }
19726 19728
19727 if (!allowed) 19729 if (!allowed)
@@ -19731,7 +19733,7 @@ namespace WixToolset.Core
19731 } 19733 }
19732 else 19734 else
19733 { 19735 {
19734 Dictionary<string, string> context = new Dictionary<string, string>() { { "Id", id.Id } }; 19736 var context = new Dictionary<string, string>() { { "Id", id.Id } };
19735 this.Core.ParseExtensionElement(node, child, context); 19737 this.Core.ParseExtensionElement(node, child, context);
19736 } 19738 }
19737 } 19739 }
@@ -19782,44 +19784,44 @@ namespace WixToolset.Core
19782 19784
19783 switch (packageType) 19785 switch (packageType)
19784 { 19786 {
19785 case WixBundlePackageType.Exe: 19787 case WixBundlePackageType.Exe:
19786 WixBundleExePackageAttributes exeAttributes = 0; 19788 WixBundleExePackageAttributes exeAttributes = 0;
19787 exeAttributes |= (YesNoType.Yes == repairable) ? WixBundleExePackageAttributes.Repairable : 0; 19789 exeAttributes |= (YesNoType.Yes == repairable) ? WixBundleExePackageAttributes.Repairable : 0;
19788 19790
19789 var exeRow = (WixBundleExePackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleExePackage, id); 19791 var exeRow = (WixBundleExePackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleExePackage, id);
19790 exeRow.Attributes = exeAttributes; 19792 exeRow.Attributes = exeAttributes;
19791 exeRow.DetectCondition = detectCondition; 19793 exeRow.DetectCondition = detectCondition;
19792 exeRow.InstallCommand = installCommand; 19794 exeRow.InstallCommand = installCommand;
19793 exeRow.RepairCommand = repairCommand; 19795 exeRow.RepairCommand = repairCommand;
19794 exeRow.UninstallCommand = uninstallCommand; 19796 exeRow.UninstallCommand = uninstallCommand;
19795 exeRow.ExeProtocol = protocol; 19797 exeRow.ExeProtocol = protocol;
19796 break; 19798 break;
19797 19799
19798 case WixBundlePackageType.Msi: 19800 case WixBundlePackageType.Msi:
19799 WixBundleMsiPackageAttributes msiAttributes = 0; 19801 WixBundleMsiPackageAttributes msiAttributes = 0;
19800 msiAttributes |= (YesNoType.Yes == displayInternalUI) ? WixBundleMsiPackageAttributes.DisplayInternalUI : 0; 19802 msiAttributes |= (YesNoType.Yes == displayInternalUI) ? WixBundleMsiPackageAttributes.DisplayInternalUI : 0;
19801 msiAttributes |= (YesNoType.Yes == enableFeatureSelection) ? WixBundleMsiPackageAttributes.EnableFeatureSelection : 0; 19803 msiAttributes |= (YesNoType.Yes == enableFeatureSelection) ? WixBundleMsiPackageAttributes.EnableFeatureSelection : 0;
19802 msiAttributes |= (YesNoType.Yes == forcePerMachine) ? WixBundleMsiPackageAttributes.ForcePerMachine : 0; 19804 msiAttributes |= (YesNoType.Yes == forcePerMachine) ? WixBundleMsiPackageAttributes.ForcePerMachine : 0;
19803 msiAttributes |= (YesNoType.Yes == suppressLooseFilePayloadGeneration) ? WixBundleMsiPackageAttributes.SuppressLooseFilePayloadGeneration : 0; 19805 msiAttributes |= (YesNoType.Yes == suppressLooseFilePayloadGeneration) ? WixBundleMsiPackageAttributes.SuppressLooseFilePayloadGeneration : 0;
19804 19806
19805 var msiRow = (WixBundleMsiPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsiPackage, id); 19807 var msiRow = (WixBundleMsiPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsiPackage, id);
19806 msiRow.Attributes = msiAttributes; 19808 msiRow.Attributes = msiAttributes;
19807 break; 19809 break;
19808 19810
19809 case WixBundlePackageType.Msp: 19811 case WixBundlePackageType.Msp:
19810 WixBundleMspPackageAttributes mspAttributes = 0; 19812 WixBundleMspPackageAttributes mspAttributes = 0;
19811 mspAttributes |= (YesNoType.Yes == displayInternalUI) ? WixBundleMspPackageAttributes.DisplayInternalUI : 0; 19813 mspAttributes |= (YesNoType.Yes == displayInternalUI) ? WixBundleMspPackageAttributes.DisplayInternalUI : 0;
19812 mspAttributes |= (YesNoType.Yes == slipstream) ? WixBundleMspPackageAttributes.Slipstream : 0; 19814 mspAttributes |= (YesNoType.Yes == slipstream) ? WixBundleMspPackageAttributes.Slipstream : 0;
19813 19815
19814 var mspRow = (WixBundleMspPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMspPackage, id); 19816 var mspRow = (WixBundleMspPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMspPackage, id);
19815 mspRow.Attributes = mspAttributes; 19817 mspRow.Attributes = mspAttributes;
19816 break; 19818 break;
19817 19819
19818 case WixBundlePackageType.Msu: 19820 case WixBundlePackageType.Msu:
19819 var msuRow = (WixBundleMsuPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsuPackage, id); 19821 var msuRow = (WixBundleMsuPackageTuple)this.Core.CreateRow(sourceLineNumbers, TupleDefinitionType.WixBundleMsuPackage, id);
19820 msuRow.DetectCondition = detectCondition; 19822 msuRow.DetectCondition = detectCondition;
19821 msuRow.MsuKB = msuKB; 19823 msuRow.MsuKB = msuKB;
19822 break; 19824 break;
19823 } 19825 }
19824 19826
19825 this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, after); 19827 this.CreateChainPackageMetaRows(sourceLineNumbers, parentType, parentId, ComplexReferenceChildType.Package, id.Id, previousType, previousId, after);
@@ -19834,33 +19836,33 @@ namespace WixToolset.Core
19834 /// <param name="node">Element to parse</param> 19836 /// <param name="node">Element to parse</param>
19835 private void ParseCommandLineElement(XElement node, string packageId) 19837 private void ParseCommandLineElement(XElement node, string packageId)
19836 { 19838 {
19837 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 19839 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
19838 string installArgument = null; 19840 string installArgument = null;
19839 string uninstallArgument = null; 19841 string uninstallArgument = null;
19840 string repairArgument = null; 19842 string repairArgument = null;
19841 string condition = null; 19843 string condition = null;
19842 19844
19843 foreach (XAttribute attrib in node.Attributes()) 19845 foreach (var attrib in node.Attributes())
19844 { 19846 {
19845 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 19847 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
19846 { 19848 {
19847 switch (attrib.Name.LocalName) 19849 switch (attrib.Name.LocalName)
19848 { 19850 {
19849 case "InstallArgument": 19851 case "InstallArgument":
19850 installArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19852 installArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19851 break; 19853 break;
19852 case "UninstallArgument": 19854 case "UninstallArgument":
19853 uninstallArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19855 uninstallArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19854 break; 19856 break;
19855 case "RepairArgument": 19857 case "RepairArgument":
19856 repairArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19858 repairArgument = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19857 break; 19859 break;
19858 case "Condition": 19860 case "Condition":
19859 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 19861 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
19860 break; 19862 break;
19861 default: 19863 default:
19862 this.Core.UnexpectedAttribute(node, attrib); 19864 this.Core.UnexpectedAttribute(node, attrib);
19863 break; 19865 break;
19864 } 19866 }
19865 } 19867 }
19866 else 19868 else
@@ -19893,21 +19895,21 @@ namespace WixToolset.Core
19893 /// <param name="node">Element to parse</param> 19895 /// <param name="node">Element to parse</param>
19894 private void ParsePackageGroupElement(XElement node) 19896 private void ParsePackageGroupElement(XElement node)
19895 { 19897 {
19896 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 19898 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
19897 Identifier id = null; 19899 Identifier id = null;
19898 19900
19899 foreach (XAttribute attrib in node.Attributes()) 19901 foreach (var attrib in node.Attributes())
19900 { 19902 {
19901 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 19903 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
19902 { 19904 {
19903 switch (attrib.Name.LocalName) 19905 switch (attrib.Name.LocalName)
19904 { 19906 {
19905 case "Id": 19907 case "Id":
19906 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 19908 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
19907 break; 19909 break;
19908 default: 19910 default:
19909 this.Core.UnexpectedAttribute(node, attrib); 19911 this.Core.UnexpectedAttribute(node, attrib);
19910 break; 19912 break;
19911 } 19913 }
19912 } 19914 }
19913 else 19915 else
@@ -19922,41 +19924,41 @@ namespace WixToolset.Core
19922 id = Identifier.Invalid; 19924 id = Identifier.Invalid;
19923 } 19925 }
19924 19926
19925 ComplexReferenceChildType previousType = ComplexReferenceChildType.Unknown; 19927 var previousType = ComplexReferenceChildType.Unknown;
19926 string previousId = null; 19928 string previousId = null;
19927 foreach (XElement child in node.Elements()) 19929 foreach (var child in node.Elements())
19928 { 19930 {
19929 if (CompilerCore.WixNamespace == child.Name.Namespace) 19931 if (CompilerCore.WixNamespace == child.Name.Namespace)
19930 { 19932 {
19931 switch (child.Name.LocalName) 19933 switch (child.Name.LocalName)
19932 { 19934 {
19933 case "MsiPackage": 19935 case "MsiPackage":
19934 previousId = this.ParseMsiPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); 19936 previousId = this.ParseMsiPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId);
19935 previousType = ComplexReferenceChildType.Package; 19937 previousType = ComplexReferenceChildType.Package;
19936 break; 19938 break;
19937 case "MspPackage": 19939 case "MspPackage":
19938 previousId = this.ParseMspPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); 19940 previousId = this.ParseMspPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId);
19939 previousType = ComplexReferenceChildType.Package; 19941 previousType = ComplexReferenceChildType.Package;
19940 break; 19942 break;
19941 case "MsuPackage": 19943 case "MsuPackage":
19942 previousId = this.ParseMsuPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); 19944 previousId = this.ParseMsuPackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId);
19943 previousType = ComplexReferenceChildType.Package; 19945 previousType = ComplexReferenceChildType.Package;
19944 break; 19946 break;
19945 case "ExePackage": 19947 case "ExePackage":
19946 previousId = this.ParseExePackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); 19948 previousId = this.ParseExePackageElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId);
19947 previousType = ComplexReferenceChildType.Package; 19949 previousType = ComplexReferenceChildType.Package;
19948 break; 19950 break;
19949 case "RollbackBoundary": 19951 case "RollbackBoundary":
19950 previousId = this.ParseRollbackBoundaryElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); 19952 previousId = this.ParseRollbackBoundaryElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId);
19951 previousType = ComplexReferenceChildType.Package; 19953 previousType = ComplexReferenceChildType.Package;
19952 break; 19954 break;
19953 case "PackageGroupRef": 19955 case "PackageGroupRef":
19954 previousId = this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId); 19956 previousId = this.ParsePackageGroupRefElement(child, ComplexReferenceParentType.PackageGroup, id.Id, previousType, previousId);
19955 previousType = ComplexReferenceChildType.PackageGroup; 19957 previousType = ComplexReferenceChildType.PackageGroup;
19956 break; 19958 break;
19957 default: 19959 default:
19958 this.Core.UnexpectedElement(node, child); 19960 this.Core.UnexpectedElement(node, child);
19959 break; 19961 break;
19960 } 19962 }
19961 } 19963 }
19962 else 19964 else
@@ -19998,26 +20000,26 @@ namespace WixToolset.Core
19998 Debug.Assert(ComplexReferenceParentType.Unknown == parentType || ComplexReferenceParentType.PackageGroup == parentType || ComplexReferenceParentType.Container == parentType); 20000 Debug.Assert(ComplexReferenceParentType.Unknown == parentType || ComplexReferenceParentType.PackageGroup == parentType || ComplexReferenceParentType.Container == parentType);
19999 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PackageGroup == previousType || ComplexReferenceChildType.Package == previousType); 20001 Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PackageGroup == previousType || ComplexReferenceChildType.Package == previousType);
20000 20002
20001 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 20003 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
20002 string id = null; 20004 string id = null;
20003 string after = null; 20005 string after = null;
20004 20006
20005 foreach (XAttribute attrib in node.Attributes()) 20007 foreach (var attrib in node.Attributes())
20006 { 20008 {
20007 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 20009 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
20008 { 20010 {
20009 switch (attrib.Name.LocalName) 20011 switch (attrib.Name.LocalName)
20010 { 20012 {
20011 case "Id": 20013 case "Id":
20012 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 20014 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
20013 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackageGroup", id); 20015 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackageGroup", id);
20014 break; 20016 break;
20015 case "After": 20017 case "After":
20016 after = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 20018 after = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
20017 break; 20019 break;
20018 default: 20020 default:
20019 this.Core.UnexpectedAttribute(node, attrib); 20021 this.Core.UnexpectedAttribute(node, attrib);
20020 break; 20022 break;
20021 } 20023 }
20022 } 20024 }
20023 else 20025 else
@@ -20129,29 +20131,29 @@ namespace WixToolset.Core
20129 /// <param name="packageId">Id of parent element</param> 20131 /// <param name="packageId">Id of parent element</param>
20130 private void ParseMsiPropertyElement(XElement node, string packageId) 20132 private void ParseMsiPropertyElement(XElement node, string packageId)
20131 { 20133 {
20132 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 20134 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
20133 string name = null; 20135 string name = null;
20134 string value = null; 20136 string value = null;
20135 string condition = null; 20137 string condition = null;
20136 20138
20137 foreach (XAttribute attrib in node.Attributes()) 20139 foreach (var attrib in node.Attributes())
20138 { 20140 {
20139 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 20141 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
20140 { 20142 {
20141 switch (attrib.Name.LocalName) 20143 switch (attrib.Name.LocalName)
20142 { 20144 {
20143 case "Name": 20145 case "Name":
20144 name = this.Core.GetAttributeMsiPropertyNameValue(sourceLineNumbers, attrib); 20146 name = this.Core.GetAttributeMsiPropertyNameValue(sourceLineNumbers, attrib);
20145 break; 20147 break;
20146 case "Value": 20148 case "Value":
20147 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 20149 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
20148 break; 20150 break;
20149 case "Condition": 20151 case "Condition":
20150 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 20152 condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
20151 break; 20153 break;
20152 default: 20154 default:
20153 this.Core.UnexpectedAttribute(node, attrib); 20155 this.Core.UnexpectedAttribute(node, attrib);
20154 break; 20156 break;
20155 } 20157 }
20156 } 20158 }
20157 else 20159 else
@@ -20193,22 +20195,22 @@ namespace WixToolset.Core
20193 /// <param name="packageId">Id of parent element</param> 20195 /// <param name="packageId">Id of parent element</param>
20194 private void ParseSlipstreamMspElement(XElement node, string packageId) 20196 private void ParseSlipstreamMspElement(XElement node, string packageId)
20195 { 20197 {
20196 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 20198 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
20197 string id = null; 20199 string id = null;
20198 20200
20199 foreach (XAttribute attrib in node.Attributes()) 20201 foreach (var attrib in node.Attributes())
20200 { 20202 {
20201 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 20203 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
20202 { 20204 {
20203 switch (attrib.Name.LocalName) 20205 switch (attrib.Name.LocalName)
20204 { 20206 {
20205 case "Id": 20207 case "Id":
20206 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); 20208 id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
20207 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackage", id); 20209 this.Core.CreateSimpleReference(sourceLineNumbers, "WixBundlePackage", id);
20208 break; 20210 break;
20209 default: 20211 default:
20210 this.Core.UnexpectedAttribute(node, attrib); 20212 this.Core.UnexpectedAttribute(node, attrib);
20211 break; 20213 break;
20212 } 20214 }
20213 } 20215 }
20214 else 20216 else
@@ -20238,26 +20240,26 @@ namespace WixToolset.Core
20238 /// <param name="node">Element to parse</param> 20240 /// <param name="node">Element to parse</param>
20239 private void ParseRelatedBundleElement(XElement node) 20241 private void ParseRelatedBundleElement(XElement node)
20240 { 20242 {
20241 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 20243 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
20242 string id = null; 20244 string id = null;
20243 string action = null; 20245 string action = null;
20244 Wix.RelatedBundle.ActionType actionType = Wix.RelatedBundle.ActionType.Detect; 20246 var actionType = Wix.RelatedBundle.ActionType.Detect;
20245 20247
20246 foreach (XAttribute attrib in node.Attributes()) 20248 foreach (var attrib in node.Attributes())
20247 { 20249 {
20248 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 20250 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
20249 { 20251 {
20250 switch (attrib.Name.LocalName) 20252 switch (attrib.Name.LocalName)
20251 { 20253 {
20252 case "Id": 20254 case "Id":
20253 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false); 20255 id = this.Core.GetAttributeGuidValue(sourceLineNumbers, attrib, false);
20254 break; 20256 break;
20255 case "Action": 20257 case "Action":
20256 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 20258 action = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
20257 break; 20259 break;
20258 default: 20260 default:
20259 this.Core.UnexpectedAttribute(node, attrib); 20261 this.Core.UnexpectedAttribute(node, attrib);
20260 break; 20262 break;
20261 } 20263 }
20262 } 20264 }
20263 else 20265 else
@@ -20276,17 +20278,17 @@ namespace WixToolset.Core
20276 actionType = Wix.RelatedBundle.ParseActionType(action); 20278 actionType = Wix.RelatedBundle.ParseActionType(action);
20277 switch (actionType) 20279 switch (actionType)
20278 { 20280 {
20279 case Wix.RelatedBundle.ActionType.Detect: 20281 case Wix.RelatedBundle.ActionType.Detect:
20280 break; 20282 break;
20281 case Wix.RelatedBundle.ActionType.Upgrade: 20283 case Wix.RelatedBundle.ActionType.Upgrade:
20282 break; 20284 break;
20283 case Wix.RelatedBundle.ActionType.Addon: 20285 case Wix.RelatedBundle.ActionType.Addon:
20284 break; 20286 break;
20285 case Wix.RelatedBundle.ActionType.Patch: 20287 case Wix.RelatedBundle.ActionType.Patch:
20286 break; 20288 break;
20287 default: 20289 default:
20288 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", action, "Detect", "Upgrade", "Addon", "Patch")); 20290 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Action", action, "Detect", "Upgrade", "Addon", "Patch"));
20289 break; 20291 break;
20290 } 20292 }
20291 } 20293 }
20292 20294
@@ -20306,21 +20308,21 @@ namespace WixToolset.Core
20306 /// <param name="node">Element to parse</param> 20308 /// <param name="node">Element to parse</param>
20307 private void ParseUpdateElement(XElement node) 20309 private void ParseUpdateElement(XElement node)
20308 { 20310 {
20309 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 20311 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
20310 string location = null; 20312 string location = null;
20311 20313
20312 foreach (XAttribute attrib in node.Attributes()) 20314 foreach (var attrib in node.Attributes())
20313 { 20315 {
20314 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 20316 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
20315 { 20317 {
20316 switch (attrib.Name.LocalName) 20318 switch (attrib.Name.LocalName)
20317 { 20319 {
20318 case "Location": 20320 case "Location":
20319 location = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 20321 location = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
20320 break; 20322 break;
20321 default: 20323 default:
20322 this.Core.UnexpectedAttribute(node, attrib); 20324 this.Core.UnexpectedAttribute(node, attrib);
20323 break; 20325 break;
20324 } 20326 }
20325 } 20327 }
20326 else 20328 else
@@ -20349,43 +20351,43 @@ namespace WixToolset.Core
20349 /// <param name="node">Element to parse</param> 20351 /// <param name="node">Element to parse</param>
20350 private void ParseVariableElement(XElement node) 20352 private void ParseVariableElement(XElement node)
20351 { 20353 {
20352 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 20354 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
20353 bool hidden = false; 20355 var hidden = false;
20354 string name = null; 20356 string name = null;
20355 bool persisted = false; 20357 var persisted = false;
20356 string value = null; 20358 string value = null;
20357 string type = null; 20359 string type = null;
20358 20360
20359 foreach (XAttribute attrib in node.Attributes()) 20361 foreach (var attrib in node.Attributes())
20360 { 20362 {
20361 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 20363 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
20362 { 20364 {
20363 switch (attrib.Name.LocalName) 20365 switch (attrib.Name.LocalName)
20364 { 20366 {
20365 case "Hidden": 20367 case "Hidden":
20366 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 20368 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
20367 { 20369 {
20368 hidden = true; 20370 hidden = true;
20369 } 20371 }
20370 break; 20372 break;
20371 case "Name": 20373 case "Name":
20372 name = this.Core.GetAttributeBundleVariableValue(sourceLineNumbers, attrib); 20374 name = this.Core.GetAttributeBundleVariableValue(sourceLineNumbers, attrib);
20373 break; 20375 break;
20374 case "Persisted": 20376 case "Persisted":
20375 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) 20377 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
20376 { 20378 {
20377 persisted = true; 20379 persisted = true;
20378 } 20380 }
20379 break; 20381 break;
20380 case "Value": 20382 case "Value":
20381 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 20383 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
20382 break; 20384 break;
20383 case "Type": 20385 case "Type":
20384 type = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 20386 type = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
20385 break; 20387 break;
20386 default: 20388 default:
20387 this.Core.UnexpectedAttribute(node, attrib); 20389 this.Core.UnexpectedAttribute(node, attrib);
20388 break; 20390 break;
20389 } 20391 }
20390 } 20392 }
20391 else 20393 else
@@ -20410,8 +20412,7 @@ namespace WixToolset.Core
20410 { 20412 {
20411 // Version constructor does not support simple "v#" syntax so check to see if the value is 20413 // Version constructor does not support simple "v#" syntax so check to see if the value is
20412 // non-negative real quick. 20414 // non-negative real quick.
20413 Int32 number; 20415 if (Int32.TryParse(value.Substring(1), NumberStyles.None, CultureInfo.InvariantCulture.NumberFormat, out var number))
20414 if (Int32.TryParse(value.Substring(1), NumberStyles.None, CultureInfo.InvariantCulture.NumberFormat, out number))
20415 { 20416 {
20416 type = "version"; 20417 type = "version";
20417 } 20418 }
@@ -20420,7 +20421,7 @@ namespace WixToolset.Core
20420 // Sadly, Version doesn't have a TryParse() method until .NET 4, so we have to try/catch to see if it parses. 20421 // Sadly, Version doesn't have a TryParse() method until .NET 4, so we have to try/catch to see if it parses.
20421 try 20422 try
20422 { 20423 {
20423 Version version = new Version(value.Substring(1)); 20424 var version = new Version(value.Substring(1));
20424 type = "version"; 20425 type = "version";
20425 } 20426 }
20426 catch (Exception) 20427 catch (Exception)
@@ -20432,8 +20433,7 @@ namespace WixToolset.Core
20432 // Not a version, check for numeric. 20433 // Not a version, check for numeric.
20433 if (null == type) 20434 if (null == type)
20434 { 20435 {
20435 Int64 number; 20436 if (Int64.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture.NumberFormat, out var number))
20436 if (Int64.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture.NumberFormat, out number))
20437 { 20437 {
20438 type = "numeric"; 20438 type = "numeric";
20439 } 20439 }
@@ -20470,21 +20470,21 @@ namespace WixToolset.Core
20470 /// <param name="node">Element to parse.</param> 20470 /// <param name="node">Element to parse.</param>
20471 private void ParseWixElement(XElement node) 20471 private void ParseWixElement(XElement node)
20472 { 20472 {
20473 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 20473 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
20474 string requiredVersion = null; 20474 string requiredVersion = null;
20475 20475
20476 foreach (XAttribute attrib in node.Attributes()) 20476 foreach (var attrib in node.Attributes())
20477 { 20477 {
20478 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 20478 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
20479 { 20479 {
20480 switch (attrib.Name.LocalName) 20480 switch (attrib.Name.LocalName)
20481 { 20481 {
20482 case "RequiredVersion": 20482 case "RequiredVersion":
20483 requiredVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); 20483 requiredVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib);
20484 break; 20484 break;
20485 default: 20485 default:
20486 this.Core.UnexpectedAttribute(node, attrib); 20486 this.Core.UnexpectedAttribute(node, attrib);
20487 break; 20487 break;
20488 } 20488 }
20489 } 20489 }
20490 else 20490 else
@@ -20498,33 +20498,33 @@ namespace WixToolset.Core
20498 this.Core.VerifyRequiredVersion(sourceLineNumbers, requiredVersion); 20498 this.Core.VerifyRequiredVersion(sourceLineNumbers, requiredVersion);
20499 } 20499 }
20500 20500
20501 foreach (XElement child in node.Elements()) 20501 foreach (var child in node.Elements())
20502 { 20502 {
20503 if (CompilerCore.WixNamespace == child.Name.Namespace) 20503 if (CompilerCore.WixNamespace == child.Name.Namespace)
20504 { 20504 {
20505 switch (child.Name.LocalName) 20505 switch (child.Name.LocalName)
20506 { 20506 {
20507 case "Bundle": 20507 case "Bundle":
20508 this.ParseBundleElement(child); 20508 this.ParseBundleElement(child);
20509 break; 20509 break;
20510 case "Fragment": 20510 case "Fragment":
20511 this.ParseFragmentElement(child); 20511 this.ParseFragmentElement(child);
20512 break; 20512 break;
20513 case "Module": 20513 case "Module":
20514 this.ParseModuleElement(child); 20514 this.ParseModuleElement(child);
20515 break; 20515 break;
20516 case "PatchCreation": 20516 case "PatchCreation":
20517 this.ParsePatchCreationElement(child); 20517 this.ParsePatchCreationElement(child);
20518 break; 20518 break;
20519 case "Product": 20519 case "Product":
20520 this.ParseProductElement(child); 20520 this.ParseProductElement(child);
20521 break; 20521 break;
20522 case "Patch": 20522 case "Patch":
20523 this.ParsePatchElement(child); 20523 this.ParsePatchElement(child);
20524 break; 20524 break;
20525 default: 20525 default:
20526 this.Core.UnexpectedElement(node, child); 20526 this.Core.UnexpectedElement(node, child);
20527 break; 20527 break;
20528 } 20528 }
20529 } 20529 }
20530 else 20530 else
@@ -20540,29 +20540,29 @@ namespace WixToolset.Core
20540 /// <param name="node">Element to parse.</param> 20540 /// <param name="node">Element to parse.</param>
20541 private void ParseWixVariableElement(XElement node) 20541 private void ParseWixVariableElement(XElement node)
20542 { 20542 {
20543 SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 20543 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
20544 Identifier id = null; 20544 Identifier id = null;
20545 bool overridable = false; 20545 var overridable = false;
20546 string value = null; 20546 string value = null;
20547 20547
20548 foreach (XAttribute attrib in node.Attributes()) 20548 foreach (var attrib in node.Attributes())
20549 { 20549 {
20550 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) 20550 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
20551 { 20551 {
20552 switch (attrib.Name.LocalName) 20552 switch (attrib.Name.LocalName)
20553 { 20553 {
20554 case "Id": 20554 case "Id":
20555 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); 20555 id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
20556 break; 20556 break;
20557 case "Overridable": 20557 case "Overridable":
20558 overridable = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)); 20558 overridable = (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib));
20559 break; 20559 break;
20560 case "Value": 20560 case "Value":
20561 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 20561 value = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
20562 break; 20562 break;
20563 default: 20563 default:
20564 this.Core.UnexpectedAttribute(node, attrib); 20564 this.Core.UnexpectedAttribute(node, attrib);
20565 break; 20565 break;
20566 } 20566 }
20567 } 20567 }
20568 else 20568 else
diff --git a/src/WixToolset.Core/Localizer.cs b/src/WixToolset.Core/Localizer.cs
index a545f844..94fa6ff7 100644
--- a/src/WixToolset.Core/Localizer.cs
+++ b/src/WixToolset.Core/Localizer.cs
@@ -26,7 +26,7 @@ namespace WixToolset.Core
26 public Localization ParseLocalizationFile(string path) 26 public Localization ParseLocalizationFile(string path)
27 { 27 {
28 var document = XDocument.Load(path); 28 var document = XDocument.Load(path);
29 return ParseLocalizationFile(document); 29 return this.ParseLocalizationFile(document);
30 } 30 }
31 31
32 public Localization ParseLocalizationFile(XDocument document) 32 public Localization ParseLocalizationFile(XDocument document)
diff --git a/src/WixToolset.Core/Preprocessor.cs b/src/WixToolset.Core/Preprocessor.cs
index 5a9cf115..a829f7c4 100644
--- a/src/WixToolset.Core/Preprocessor.cs
+++ b/src/WixToolset.Core/Preprocessor.cs
@@ -133,7 +133,7 @@ namespace WixToolset.Core
133 133
134 this.Context = context; 134 this.Context = context;
135 this.Context.CurrentSourceLineNumber = new SourceLineNumber(context.SourcePath); 135 this.Context.CurrentSourceLineNumber = new SourceLineNumber(context.SourcePath);
136 this.Context.Variables = this.Context.Variables == null ? new Dictionary<string, string>() : new Dictionary<string, string>(this.Context.Variables); 136 this.Context.Variables = (this.Context.Variables == null) ? new Dictionary<string, string>() : new Dictionary<string, string>(this.Context.Variables);
137 137
138 this.PreProcess(); 138 this.PreProcess();
139 139