diff options
Diffstat (limited to 'src/WixToolset.Core/Compiler_Bundle.cs')
| -rw-r--r-- | src/WixToolset.Core/Compiler_Bundle.cs | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 5154a72f..2b274474 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
| @@ -280,6 +280,9 @@ namespace WixToolset.Core | |||
| 280 | case "BundleCustomData": | 280 | case "BundleCustomData": |
| 281 | this.ParseBundleCustomDataElement(child); | 281 | this.ParseBundleCustomDataElement(child); |
| 282 | break; | 282 | break; |
| 283 | case "BundleCustomDataRef": | ||
| 284 | this.ParseBundleCustomDataRefElement(child); | ||
| 285 | break; | ||
| 283 | case "BundleExtension": | 286 | case "BundleExtension": |
| 284 | this.ParseBundleExtensionElement(child); | 287 | this.ParseBundleExtensionElement(child); |
| 285 | break; | 288 | break; |
| @@ -784,6 +787,7 @@ namespace WixToolset.Core | |||
| 784 | WixBundleCustomDataType? customDataType = null; | 787 | WixBundleCustomDataType? customDataType = null; |
| 785 | string extensionId = null; | 788 | string extensionId = null; |
| 786 | var attributeDefinitions = new List<WixBundleCustomDataAttributeTuple>(); | 789 | var attributeDefinitions = new List<WixBundleCustomDataAttributeTuple>(); |
| 790 | var foundAttributeDefinitions = false; | ||
| 787 | 791 | ||
| 788 | foreach (var attrib in node.Attributes()) | 792 | foreach (var attrib in node.Attributes()) |
| 789 | { | 793 | { |
| @@ -831,9 +835,9 @@ namespace WixToolset.Core | |||
| 831 | } | 835 | } |
| 832 | 836 | ||
| 833 | var hasExtensionId = null != extensionId; | 837 | var hasExtensionId = null != extensionId; |
| 834 | if (hasExtensionId && !customDataType.HasValue) | 838 | if (!customDataType.HasValue) |
| 835 | { | 839 | { |
| 836 | customDataType = WixBundleCustomDataType.BundleExtension; | 840 | customDataType = hasExtensionId ? WixBundleCustomDataType.BundleExtension : WixBundleCustomDataType.BootstrapperApplication; |
| 837 | } | 841 | } |
| 838 | 842 | ||
| 839 | if (!customDataType.HasValue) | 843 | if (!customDataType.HasValue) |
| @@ -860,6 +864,8 @@ namespace WixToolset.Core | |||
| 860 | switch (child.Name.LocalName) | 864 | switch (child.Name.LocalName) |
| 861 | { | 865 | { |
| 862 | case "BundleAttributeDefinition": | 866 | case "BundleAttributeDefinition": |
| 867 | foundAttributeDefinitions = true; | ||
| 868 | |||
| 863 | var attributeDefinition = this.ParseBundleAttributeDefinitionElement(child, childSourceLineNumbers, customDataId); | 869 | var attributeDefinition = this.ParseBundleAttributeDefinitionElement(child, childSourceLineNumbers, customDataId); |
| 864 | if (attributeDefinition != null) | 870 | if (attributeDefinition != null) |
| 865 | { | 871 | { |
| @@ -894,6 +900,73 @@ namespace WixToolset.Core | |||
| 894 | }); | 900 | }); |
| 895 | } | 901 | } |
| 896 | } | 902 | } |
| 903 | else if (!foundAttributeDefinitions) | ||
| 904 | { | ||
| 905 | this.Core.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "BundleAttributeDefinition")); | ||
| 906 | } | ||
| 907 | } | ||
| 908 | |||
| 909 | /// <summary> | ||
| 910 | /// Parses a BundleCustomDataRef element. | ||
| 911 | /// </summary> | ||
| 912 | /// <param name="node">Element to parse.</param> | ||
| 913 | private void ParseBundleCustomDataRefElement(XElement node) | ||
| 914 | { | ||
| 915 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | ||
| 916 | string customDataId = null; | ||
| 917 | var foundChild = false; | ||
| 918 | |||
| 919 | foreach (var attrib in node.Attributes()) | ||
| 920 | { | ||
| 921 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) | ||
| 922 | { | ||
| 923 | switch (attrib.Name.LocalName) | ||
| 924 | { | ||
| 925 | case "Id": | ||
| 926 | customDataId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | ||
| 927 | break; | ||
| 928 | default: | ||
| 929 | this.Core.UnexpectedAttribute(node, attrib); | ||
| 930 | break; | ||
| 931 | } | ||
| 932 | } | ||
| 933 | else | ||
| 934 | { | ||
| 935 | this.Core.ParseExtensionAttribute(node, attrib); | ||
| 936 | } | ||
| 937 | } | ||
| 938 | |||
| 939 | if (null == customDataId) | ||
| 940 | { | ||
| 941 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | ||
| 942 | } | ||
| 943 | |||
| 944 | foreach (var child in node.Elements()) | ||
| 945 | { | ||
| 946 | foundChild = true; | ||
| 947 | if (CompilerCore.WixNamespace == child.Name.Namespace) | ||
| 948 | { | ||
| 949 | var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); | ||
| 950 | switch (child.Name.LocalName) | ||
| 951 | { | ||
| 952 | case "BundleElement": | ||
| 953 | this.ParseBundleElementElement(child, childSourceLineNumbers, customDataId); | ||
| 954 | break; | ||
| 955 | default: | ||
| 956 | this.Core.UnexpectedElement(node, child); | ||
| 957 | break; | ||
| 958 | } | ||
| 959 | } | ||
| 960 | else | ||
| 961 | { | ||
| 962 | this.Core.ParseExtensionElement(node, child); | ||
| 963 | } | ||
| 964 | } | ||
| 965 | |||
| 966 | if (!foundChild) | ||
| 967 | { | ||
| 968 | this.Core.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, node.Name.LocalName)); | ||
| 969 | } | ||
| 897 | } | 970 | } |
| 898 | 971 | ||
| 899 | /// <summary> | 972 | /// <summary> |
