From 01ad1ca4991e830239156b10412165ce4dd839af Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 10 Jul 2020 21:36:24 +1000 Subject: Add CustomTableRef element. --- src/WixToolset.Core/Compiler.cs | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'src/WixToolset.Core/Compiler.cs') diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index 020e35fe..3fa06f9c 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs @@ -3612,6 +3612,7 @@ namespace WixToolset.Core string tableId = null; var unreal = false; var columns = new List(); + var foundColumns = false; foreach (var attrib in node.Attributes()) { @@ -3653,6 +3654,8 @@ namespace WixToolset.Core switch (child.Name.LocalName) { case "Column": + foundColumns = true; + var column = this.ParseColumnElement(child, childSourceLineNumbers, tableId); if (column != null) { @@ -3690,6 +3693,67 @@ namespace WixToolset.Core Unreal = unreal, }); } + else if (!foundColumns) + { + this.Core.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "Column")); + } + } + } + + /// + /// Parses a CustomTableRef element. + /// + /// Element to parse. + private void ParseCustomTableRefElement(XElement node) + { + var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + string tableId = null; + + foreach (var attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + tableId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + this.Core.CreateSimpleReference(sourceLineNumbers, SymbolDefinitions.WixCustomTable, tableId); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + if (null == tableId) + { + this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + } + + foreach (var child in node.Elements()) + { + if (CompilerCore.WixNamespace == child.Name.Namespace) + { + var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); + switch (child.Name.LocalName) + { + case "Row": + this.ParseRowElement(child, childSourceLineNumbers, tableId); + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } } } @@ -6155,6 +6219,9 @@ namespace WixToolset.Core case "CustomTable": this.ParseCustomTableElement(child); break; + case "CustomTableRef": + this.ParseCustomTableRefElement(child); + break; case "Directory": this.ParseDirectoryElement(child, null, CompilerConstants.IntegerNotSet, String.Empty); break; -- cgit v1.2.3-55-g6feb