diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Core/Compiler.cs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index 1a9746fc..a9b13d43 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs | |||
| @@ -4873,6 +4873,9 @@ namespace WixToolset.Core | |||
| 4873 | case "FeatureRef": | 4873 | case "FeatureRef": |
| 4874 | this.ParseFeatureRefElement(child, ComplexReferenceParentType.Feature, id.Id); | 4874 | this.ParseFeatureRefElement(child, ComplexReferenceParentType.Feature, id.Id); |
| 4875 | break; | 4875 | break; |
| 4876 | case "Level": | ||
| 4877 | this.ParseLevelElement(child, id.Id); | ||
| 4878 | break; | ||
| 4876 | case "MergeRef": | 4879 | case "MergeRef": |
| 4877 | this.ParseMergeRefElement(child, ComplexReferenceParentType.Feature, id.Id); | 4880 | this.ParseMergeRefElement(child, ComplexReferenceParentType.Feature, id.Id); |
| 4878 | break; | 4881 | break; |
| @@ -7819,6 +7822,72 @@ namespace WixToolset.Core | |||
| 7819 | } | 7822 | } |
| 7820 | 7823 | ||
| 7821 | /// <summary> | 7824 | /// <summary> |
| 7825 | /// Parses a condition element. | ||
| 7826 | /// </summary> | ||
| 7827 | /// <param name="node">Element to parse.</param> | ||
| 7828 | /// <param name="featureId">Id of the parent Feature element.</param> | ||
| 7829 | private void ParseLevelElement(XElement node, string featureId) | ||
| 7830 | { | ||
| 7831 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | ||
| 7832 | string condition = null; | ||
| 7833 | int? level = null; | ||
| 7834 | |||
| 7835 | foreach (var attrib in node.Attributes()) | ||
| 7836 | { | ||
| 7837 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) | ||
| 7838 | { | ||
| 7839 | switch (attrib.Name.LocalName) | ||
| 7840 | { | ||
| 7841 | case "Condition": | ||
| 7842 | condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | ||
| 7843 | break; | ||
| 7844 | case "Value": | ||
| 7845 | level = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue); | ||
| 7846 | break; | ||
| 7847 | default: | ||
| 7848 | this.Core.UnexpectedAttribute(node, attrib); | ||
| 7849 | break; | ||
| 7850 | } | ||
| 7851 | } | ||
| 7852 | else | ||
| 7853 | { | ||
| 7854 | this.Core.ParseExtensionAttribute(node, attrib); | ||
| 7855 | } | ||
| 7856 | } | ||
| 7857 | |||
| 7858 | if (!level.HasValue) | ||
| 7859 | { | ||
| 7860 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Level")); | ||
| 7861 | } | ||
| 7862 | |||
| 7863 | if (String.IsNullOrEmpty(condition)) | ||
| 7864 | { | ||
| 7865 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Condition")); | ||
| 7866 | } | ||
| 7867 | |||
| 7868 | this.Core.ParseForExtensionElements(node); | ||
| 7869 | |||
| 7870 | if (!this.Core.EncounteredError) | ||
| 7871 | { | ||
| 7872 | if (CompilerConstants.IntegerNotSet == level) | ||
| 7873 | { | ||
| 7874 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Level")); | ||
| 7875 | level = CompilerConstants.IllegalInteger; | ||
| 7876 | } | ||
| 7877 | |||
| 7878 | if (!this.Core.EncounteredError) | ||
| 7879 | { | ||
| 7880 | this.Core.AddTuple(new ConditionTuple(sourceLineNumbers) | ||
| 7881 | { | ||
| 7882 | FeatureRef = featureId, | ||
| 7883 | Level = level.Value, | ||
| 7884 | Condition = condition | ||
| 7885 | }); | ||
| 7886 | } | ||
| 7887 | } | ||
| 7888 | } | ||
| 7889 | |||
| 7890 | /// <summary> | ||
| 7822 | /// Parses a merge reference element. | 7891 | /// Parses a merge reference element. |
| 7823 | /// </summary> | 7892 | /// </summary> |
| 7824 | /// <param name="node">Element to parse.</param> | 7893 | /// <param name="node">Element to parse.</param> |
