diff options
Diffstat (limited to 'src/ext/Util/wixext/UtilCompiler.cs')
| -rw-r--r-- | src/ext/Util/wixext/UtilCompiler.cs | 103 |
1 files changed, 52 insertions, 51 deletions
diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs index 09a90928..323e0f6a 100644 --- a/src/ext/Util/wixext/UtilCompiler.cs +++ b/src/ext/Util/wixext/UtilCompiler.cs | |||
| @@ -443,7 +443,8 @@ namespace WixToolset.Util | |||
| 443 | string after = null; | 443 | string after = null; |
| 444 | string guid = null; | 444 | string guid = null; |
| 445 | string productCode = null; | 445 | string productCode = null; |
| 446 | var attributes = WixComponentSearchAttributes.KeyPath; | 446 | var attributes = WixComponentSearchAttributes.None; |
| 447 | var type = WixComponentSearchType.KeyPath; | ||
| 447 | 448 | ||
| 448 | foreach (var attrib in element.Attributes()) | 449 | foreach (var attrib in element.Attributes()) |
| 449 | { | 450 | { |
| @@ -468,13 +469,13 @@ namespace WixToolset.Util | |||
| 468 | switch (result) | 469 | switch (result) |
| 469 | { | 470 | { |
| 470 | case "directory": | 471 | case "directory": |
| 471 | attributes = WixComponentSearchAttributes.WantDirectory; | 472 | type = WixComponentSearchType.WantDirectory; |
| 472 | break; | 473 | break; |
| 473 | case "keyPath": | 474 | case "keyPath": |
| 474 | attributes = WixComponentSearchAttributes.KeyPath; | 475 | type = WixComponentSearchType.KeyPath; |
| 475 | break; | 476 | break; |
| 476 | case "state": | 477 | case "state": |
| 477 | attributes = WixComponentSearchAttributes.State; | 478 | type = WixComponentSearchType.State; |
| 478 | break; | 479 | break; |
| 479 | default: | 480 | default: |
| 480 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "directory", "keyPath", "state")); | 481 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "directory", "keyPath", "state")); |
| @@ -499,7 +500,7 @@ namespace WixToolset.Util | |||
| 499 | 500 | ||
| 500 | if (null == id) | 501 | if (null == id) |
| 501 | { | 502 | { |
| 502 | id = this.ParseHelper.CreateIdentifier("wcs", variable, condition, after, guid, productCode, attributes.ToString()); | 503 | id = this.ParseHelper.CreateIdentifier("wcs", variable, condition, after, guid, productCode, attributes.ToString(), type.ToString()); |
| 503 | } | 504 | } |
| 504 | 505 | ||
| 505 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); | 506 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
| @@ -513,6 +514,7 @@ namespace WixToolset.Util | |||
| 513 | Guid = guid, | 514 | Guid = guid, |
| 514 | ProductCode = productCode, | 515 | ProductCode = productCode, |
| 515 | Attributes = attributes, | 516 | Attributes = attributes, |
| 517 | Type = type, | ||
| 516 | }); | 518 | }); |
| 517 | } | 519 | } |
| 518 | } | 520 | } |
| @@ -983,6 +985,7 @@ namespace WixToolset.Util | |||
| 983 | string after = null; | 985 | string after = null; |
| 984 | string path = null; | 986 | string path = null; |
| 985 | var attributes = WixFileSearchAttributes.IsDirectory; | 987 | var attributes = WixFileSearchAttributes.IsDirectory; |
| 988 | var type = WixFileSearchType.Path; | ||
| 986 | 989 | ||
| 987 | foreach (var attrib in element.Attributes()) | 990 | foreach (var attrib in element.Attributes()) |
| 988 | { | 991 | { |
| @@ -1004,7 +1007,7 @@ namespace WixToolset.Util | |||
| 1004 | switch (result) | 1007 | switch (result) |
| 1005 | { | 1008 | { |
| 1006 | case "exists": | 1009 | case "exists": |
| 1007 | attributes |= WixFileSearchAttributes.WantExists; | 1010 | type = WixFileSearchType.Exists; |
| 1008 | break; | 1011 | break; |
| 1009 | default: | 1012 | default: |
| 1010 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists")); | 1013 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists")); |
| @@ -1029,7 +1032,7 @@ namespace WixToolset.Util | |||
| 1029 | 1032 | ||
| 1030 | if (null == id) | 1033 | if (null == id) |
| 1031 | { | 1034 | { |
| 1032 | id = this.ParseHelper.CreateIdentifier("wds", variable, condition, after, path, attributes.ToString()); | 1035 | id = this.ParseHelper.CreateIdentifier("wds", variable, condition, after, path, attributes.ToString(), type.ToString()); |
| 1033 | } | 1036 | } |
| 1034 | 1037 | ||
| 1035 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); | 1038 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
| @@ -1038,7 +1041,7 @@ namespace WixToolset.Util | |||
| 1038 | 1041 | ||
| 1039 | if (!this.Messaging.EncounteredError) | 1042 | if (!this.Messaging.EncounteredError) |
| 1040 | { | 1043 | { |
| 1041 | this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes); | 1044 | this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type); |
| 1042 | } | 1045 | } |
| 1043 | } | 1046 | } |
| 1044 | 1047 | ||
| @@ -1086,7 +1089,8 @@ namespace WixToolset.Util | |||
| 1086 | string condition = null; | 1089 | string condition = null; |
| 1087 | string after = null; | 1090 | string after = null; |
| 1088 | string path = null; | 1091 | string path = null; |
| 1089 | var attributes = WixFileSearchAttributes.Default; | 1092 | var attributes = WixFileSearchAttributes.None; |
| 1093 | var type = WixFileSearchType.Path; | ||
| 1090 | 1094 | ||
| 1091 | foreach (var attrib in node.Attributes()) | 1095 | foreach (var attrib in node.Attributes()) |
| 1092 | { | 1096 | { |
| @@ -1108,10 +1112,10 @@ namespace WixToolset.Util | |||
| 1108 | switch (result) | 1112 | switch (result) |
| 1109 | { | 1113 | { |
| 1110 | case "exists": | 1114 | case "exists": |
| 1111 | attributes |= WixFileSearchAttributes.WantExists; | 1115 | type = WixFileSearchType.Exists; |
| 1112 | break; | 1116 | break; |
| 1113 | case "version": | 1117 | case "version": |
| 1114 | attributes |= WixFileSearchAttributes.WantVersion; | 1118 | type = WixFileSearchType.Version; |
| 1115 | break; | 1119 | break; |
| 1116 | default: | 1120 | default: |
| 1117 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists", "version")); | 1121 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists", "version")); |
| @@ -1136,7 +1140,7 @@ namespace WixToolset.Util | |||
| 1136 | 1140 | ||
| 1137 | if (null == id) | 1141 | if (null == id) |
| 1138 | { | 1142 | { |
| 1139 | id = this.ParseHelper.CreateIdentifier("wfs", variable, condition, after, path, attributes.ToString()); | 1143 | id = this.ParseHelper.CreateIdentifier("wfs", variable, condition, after, path, attributes.ToString(), type.ToString()); |
| 1140 | } | 1144 | } |
| 1141 | 1145 | ||
| 1142 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); | 1146 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); |
| @@ -1145,7 +1149,7 @@ namespace WixToolset.Util | |||
| 1145 | 1149 | ||
| 1146 | if (!this.Messaging.EncounteredError) | 1150 | if (!this.Messaging.EncounteredError) |
| 1147 | { | 1151 | { |
| 1148 | this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes); | 1152 | this.CreateWixFileSearchRow(section, sourceLineNumbers, id, path, attributes, type); |
| 1149 | } | 1153 | } |
| 1150 | } | 1154 | } |
| 1151 | 1155 | ||
| @@ -1156,12 +1160,14 @@ namespace WixToolset.Util | |||
| 1156 | /// <param name="id">Identifier of the search (key into the WixSearch table)</param> | 1160 | /// <param name="id">Identifier of the search (key into the WixSearch table)</param> |
| 1157 | /// <param name="path">File/directory path to search for.</param> | 1161 | /// <param name="path">File/directory path to search for.</param> |
| 1158 | /// <param name="attributes"></param> | 1162 | /// <param name="attributes"></param> |
| 1159 | private void CreateWixFileSearchRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string path, WixFileSearchAttributes attributes) | 1163 | /// <param name="type"></param> |
| 1164 | private void CreateWixFileSearchRow(IntermediateSection section, SourceLineNumber sourceLineNumbers, Identifier id, string path, WixFileSearchAttributes attributes, WixFileSearchType type) | ||
| 1160 | { | 1165 | { |
| 1161 | section.AddSymbol(new WixFileSearchSymbol(sourceLineNumbers, id) | 1166 | section.AddSymbol(new WixFileSearchSymbol(sourceLineNumbers, id) |
| 1162 | { | 1167 | { |
| 1163 | Path = path, | 1168 | Path = path, |
| 1164 | Attributes = attributes, | 1169 | Attributes = attributes, |
| 1170 | Type = type, | ||
| 1165 | }); | 1171 | }); |
| 1166 | } | 1172 | } |
| 1167 | 1173 | ||
| @@ -2545,7 +2551,8 @@ namespace WixToolset.Util | |||
| 2545 | string after = null; | 2551 | string after = null; |
| 2546 | string productCode = null; | 2552 | string productCode = null; |
| 2547 | string upgradeCode = null; | 2553 | string upgradeCode = null; |
| 2548 | var attributes = WixProductSearchAttributes.Version; | 2554 | var attributes = WixProductSearchAttributes.None; |
| 2555 | var type = WixProductSearchType.Version; | ||
| 2549 | 2556 | ||
| 2550 | foreach (var attrib in element.Attributes()) | 2557 | foreach (var attrib in element.Attributes()) |
| 2551 | { | 2558 | { |
| @@ -2570,16 +2577,16 @@ namespace WixToolset.Util | |||
| 2570 | switch (result) | 2577 | switch (result) |
| 2571 | { | 2578 | { |
| 2572 | case "version": | 2579 | case "version": |
| 2573 | attributes = WixProductSearchAttributes.Version; | 2580 | type = WixProductSearchType.Version; |
| 2574 | break; | 2581 | break; |
| 2575 | case "language": | 2582 | case "language": |
| 2576 | attributes = WixProductSearchAttributes.Language; | 2583 | type = WixProductSearchType.Language; |
| 2577 | break; | 2584 | break; |
| 2578 | case "state": | 2585 | case "state": |
| 2579 | attributes = WixProductSearchAttributes.State; | 2586 | type = WixProductSearchType.State; |
| 2580 | break; | 2587 | break; |
| 2581 | case "assignment": | 2588 | case "assignment": |
| 2582 | attributes = WixProductSearchAttributes.Assignment; | 2589 | type = WixProductSearchType.Assignment; |
| 2583 | break; | 2590 | break; |
| 2584 | default: | 2591 | default: |
| 2585 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "version", "language", "state", "assignment")); | 2592 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "version", "language", "state", "assignment")); |
| @@ -2607,9 +2614,21 @@ namespace WixToolset.Util | |||
| 2607 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "UpgradeCode", "ProductCode")); | 2614 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "UpgradeCode", "ProductCode")); |
| 2608 | } | 2615 | } |
| 2609 | 2616 | ||
| 2617 | string guid; | ||
| 2618 | if (upgradeCode != null) | ||
| 2619 | { | ||
| 2620 | // set an additional flag if this is an upgrade code | ||
| 2621 | attributes |= WixProductSearchAttributes.UpgradeCode; | ||
| 2622 | guid = upgradeCode; | ||
| 2623 | } | ||
| 2624 | else | ||
| 2625 | { | ||
| 2626 | guid = productCode; | ||
| 2627 | } | ||
| 2628 | |||
| 2610 | if (null == id) | 2629 | if (null == id) |
| 2611 | { | 2630 | { |
| 2612 | id = this.ParseHelper.CreateIdentifier("wps", variable, condition, after, productCode ?? upgradeCode, attributes.ToString()); | 2631 | id = this.ParseHelper.CreateIdentifier("wps", variable, condition, after, guid, attributes.ToString(), type.ToString()); |
| 2613 | } | 2632 | } |
| 2614 | 2633 | ||
| 2615 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); | 2634 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
| @@ -2618,16 +2637,11 @@ namespace WixToolset.Util | |||
| 2618 | 2637 | ||
| 2619 | if (!this.Messaging.EncounteredError) | 2638 | if (!this.Messaging.EncounteredError) |
| 2620 | { | 2639 | { |
| 2621 | // set an additional flag if this is an upgrade code | ||
| 2622 | if (null != upgradeCode) | ||
| 2623 | { | ||
| 2624 | attributes |= WixProductSearchAttributes.UpgradeCode; | ||
| 2625 | } | ||
| 2626 | |||
| 2627 | section.AddSymbol(new WixProductSearchSymbol(sourceLineNumbers, id) | 2640 | section.AddSymbol(new WixProductSearchSymbol(sourceLineNumbers, id) |
| 2628 | { | 2641 | { |
| 2629 | Guid = productCode ?? upgradeCode, | 2642 | Guid = guid, |
| 2630 | Attributes = attributes, | 2643 | Attributes = attributes, |
| 2644 | Type = type, | ||
| 2631 | }); | 2645 | }); |
| 2632 | } | 2646 | } |
| 2633 | } | 2647 | } |
| @@ -2648,7 +2662,8 @@ namespace WixToolset.Util | |||
| 2648 | string value = null; | 2662 | string value = null; |
| 2649 | var expand = YesNoType.NotSet; | 2663 | var expand = YesNoType.NotSet; |
| 2650 | var win64 = this.Context.IsCurrentPlatform64Bit; | 2664 | var win64 = this.Context.IsCurrentPlatform64Bit; |
| 2651 | var attributes = WixRegistrySearchAttributes.Raw | WixRegistrySearchAttributes.WantValue; | 2665 | var attributes = WixRegistrySearchAttributes.None; |
| 2666 | var type = WixRegistrySearchType.Value; | ||
| 2652 | 2667 | ||
| 2653 | foreach (var attrib in element.Attributes()) | 2668 | foreach (var attrib in element.Attributes()) |
| 2654 | { | 2669 | { |
| @@ -2692,30 +2707,15 @@ namespace WixToolset.Util | |||
| 2692 | case "ExpandEnvironmentVariables": | 2707 | case "ExpandEnvironmentVariables": |
| 2693 | expand = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 2708 | expand = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
| 2694 | break; | 2709 | break; |
| 2695 | case "Format": | ||
| 2696 | string format = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 2697 | switch (format) | ||
| 2698 | { | ||
| 2699 | case "raw": | ||
| 2700 | attributes |= WixRegistrySearchAttributes.Raw; | ||
| 2701 | break; | ||
| 2702 | case "compatible": | ||
| 2703 | attributes |= WixRegistrySearchAttributes.Compatible; | ||
| 2704 | break; | ||
| 2705 | default: | ||
| 2706 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, format, "raw", "compatible")); | ||
| 2707 | break; | ||
| 2708 | } | ||
| 2709 | break; | ||
| 2710 | case "Result": | 2710 | case "Result": |
| 2711 | var result = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 2711 | var result = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 2712 | switch (result) | 2712 | switch (result) |
| 2713 | { | 2713 | { |
| 2714 | case "exists": | 2714 | case "exists": |
| 2715 | attributes |= WixRegistrySearchAttributes.WantExists; | 2715 | type = WixRegistrySearchType.Exists; |
| 2716 | break; | 2716 | break; |
| 2717 | case "value": | 2717 | case "value": |
| 2718 | attributes |= WixRegistrySearchAttributes.WantValue; | 2718 | type = WixRegistrySearchType.Value; |
| 2719 | break; | 2719 | break; |
| 2720 | default: | 2720 | default: |
| 2721 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists", "value")); | 2721 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Parent.Name.LocalName, attrib.Name.LocalName, result, "exists", "value")); |
| @@ -2743,14 +2743,9 @@ namespace WixToolset.Util | |||
| 2743 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Key")); | 2743 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Key")); |
| 2744 | } | 2744 | } |
| 2745 | 2745 | ||
| 2746 | if (null == id) | ||
| 2747 | { | ||
| 2748 | id = this.ParseHelper.CreateIdentifier("wrs", variable, condition, after, root.ToString(), key, value, attributes.ToString()); | ||
| 2749 | } | ||
| 2750 | |||
| 2751 | if (expand == YesNoType.Yes) | 2746 | if (expand == YesNoType.Yes) |
| 2752 | { | 2747 | { |
| 2753 | if (0 != (attributes & WixRegistrySearchAttributes.WantExists)) | 2748 | if (type == WixRegistrySearchType.Exists) |
| 2754 | { | 2749 | { |
| 2755 | this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "ExpandEnvironmentVariables", expand.ToString(), "Result", "exists")); | 2750 | this.Messaging.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "ExpandEnvironmentVariables", expand.ToString(), "Result", "exists")); |
| 2756 | } | 2751 | } |
| @@ -2763,6 +2758,11 @@ namespace WixToolset.Util | |||
| 2763 | attributes |= WixRegistrySearchAttributes.Win64; | 2758 | attributes |= WixRegistrySearchAttributes.Win64; |
| 2764 | } | 2759 | } |
| 2765 | 2760 | ||
| 2761 | if (null == id) | ||
| 2762 | { | ||
| 2763 | id = this.ParseHelper.CreateIdentifier("wrs", variable, condition, after, root.ToString(), key, value, attributes.ToString(), type.ToString()); | ||
| 2764 | } | ||
| 2765 | |||
| 2766 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); | 2766 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
| 2767 | 2767 | ||
| 2768 | this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null); | 2768 | this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, null); |
| @@ -2775,6 +2775,7 @@ namespace WixToolset.Util | |||
| 2775 | Key = key, | 2775 | Key = key, |
| 2776 | Value = value, | 2776 | Value = value, |
| 2777 | Attributes = attributes, | 2777 | Attributes = attributes, |
| 2778 | Type = type, | ||
| 2778 | }); | 2779 | }); |
| 2779 | } | 2780 | } |
| 2780 | } | 2781 | } |
