From cc3313d974870cd62ac7ae7eccbcf41a85417e33 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 22 Jun 2020 23:15:20 -0700 Subject: Move launch conditions to Launch element --- src/WixToolset.Core/Compiler.cs | 58 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index 358f8844..1a9746fc 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs @@ -6277,6 +6277,9 @@ namespace WixToolset.Core case "MediaTemplate": this.ParseMediaTemplateElement(child, null); break; + case "Launch": + this.ParseLaunchElement(child); + break; case "PackageGroup": this.ParsePackageGroupElement(child); break; @@ -6353,6 +6356,61 @@ namespace WixToolset.Core } } + /// + /// Parses a launch condition element. + /// + /// Element to parse. + private void ParseLaunchElement(XElement node) + { + var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + string condition = null; + string message = null; + + foreach (var attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Cndition": + condition = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Message": + message = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (String.IsNullOrEmpty(condition)) + { + this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Condition")); + } + + if (String.IsNullOrEmpty(message)) + { + this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Message")); + } + + + this.Core.ParseForExtensionElements(node); + + if (!this.Core.EncounteredError) + { + this.Core.AddTuple(new LaunchConditionTuple(sourceLineNumbers) + { + Condition = condition, + Description = message + }); + } + } /// /// Parses a condition element. -- cgit v1.2.3-55-g6feb