diff options
Diffstat (limited to 'src/wixext/BalCompiler.cs')
-rw-r--r-- | src/wixext/BalCompiler.cs | 266 |
1 files changed, 135 insertions, 131 deletions
diff --git a/src/wixext/BalCompiler.cs b/src/wixext/BalCompiler.cs index 38ca9e3c..5b54ef58 100644 --- a/src/wixext/BalCompiler.cs +++ b/src/wixext/BalCompiler.cs | |||
@@ -1,21 +1,22 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixToolset.Extensions | 3 | namespace WixToolset.Bal |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.Xml.Linq; | 7 | using System.Xml.Linq; |
8 | using WixToolset.Bal.Tuples; | ||
8 | using WixToolset.Data; | 9 | using WixToolset.Data; |
9 | using WixToolset.Data.Rows; | 10 | using WixToolset.Data.Tuples; |
10 | using WixToolset.Extensibility; | 11 | using WixToolset.Extensibility; |
11 | 12 | ||
12 | /// <summary> | 13 | /// <summary> |
13 | /// The compiler for the WiX Toolset Bal Extension. | 14 | /// The compiler for the WiX Toolset Bal Extension. |
14 | /// </summary> | 15 | /// </summary> |
15 | public sealed class BalCompiler : CompilerExtension | 16 | public sealed class BalCompiler : BaseCompilerExtension |
16 | { | 17 | { |
17 | private SourceLineNumber addedConditionLineNumber; | 18 | private SourceLineNumber addedConditionLineNumber; |
18 | private Dictionary<string, Row> prereqInfoRows; | 19 | private Dictionary<string, WixMbaPrereqInformationTuple> prereqInfoRows; |
19 | 20 | ||
20 | /// <summary> | 21 | /// <summary> |
21 | /// Instantiate a new BalCompiler. | 22 | /// Instantiate a new BalCompiler. |
@@ -23,17 +24,20 @@ namespace WixToolset.Extensions | |||
23 | public BalCompiler() | 24 | public BalCompiler() |
24 | { | 25 | { |
25 | this.addedConditionLineNumber = null; | 26 | this.addedConditionLineNumber = null; |
26 | prereqInfoRows = new Dictionary<string, Row>(); | 27 | this.prereqInfoRows = new Dictionary<string, WixMbaPrereqInformationTuple>(); |
27 | this.Namespace = "http://wixtoolset.org/schemas/v4/wxs/bal"; | ||
28 | } | 28 | } |
29 | 29 | ||
30 | public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/bal"; | ||
31 | |||
30 | /// <summary> | 32 | /// <summary> |
31 | /// Processes an element for the Compiler. | 33 | /// Processes an element for the Compiler. |
32 | /// </summary> | 34 | /// </summary> |
35 | /// <param name="intermediate"></param> | ||
36 | /// <param name="section"></param> | ||
33 | /// <param name="parentElement">Parent element of element to process.</param> | 37 | /// <param name="parentElement">Parent element of element to process.</param> |
34 | /// <param name="element">Element to process.</param> | 38 | /// <param name="element">Element to process.</param> |
35 | /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param> | 39 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> |
36 | public override void ParseElement(XElement parentElement, XElement element, IDictionary<string, string> context) | 40 | public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context) |
37 | { | 41 | { |
38 | switch (parentElement.Name.LocalName) | 42 | switch (parentElement.Name.LocalName) |
39 | { | 43 | { |
@@ -42,10 +46,10 @@ namespace WixToolset.Extensions | |||
42 | switch (element.Name.LocalName) | 46 | switch (element.Name.LocalName) |
43 | { | 47 | { |
44 | case "Condition": | 48 | case "Condition": |
45 | this.ParseConditionElement(element); | 49 | this.ParseConditionElement(intermediate, section, element); |
46 | break; | 50 | break; |
47 | default: | 51 | default: |
48 | this.Core.UnexpectedElement(parentElement, element); | 52 | this.ParseHelper.UnexpectedElement(parentElement, element); |
49 | break; | 53 | break; |
50 | } | 54 | } |
51 | break; | 55 | break; |
@@ -53,18 +57,18 @@ namespace WixToolset.Extensions | |||
53 | switch (element.Name.LocalName) | 57 | switch (element.Name.LocalName) |
54 | { | 58 | { |
55 | case "WixStandardBootstrapperApplication": | 59 | case "WixStandardBootstrapperApplication": |
56 | this.ParseWixStandardBootstrapperApplicationElement(element); | 60 | this.ParseWixStandardBootstrapperApplicationElement(intermediate, section, element); |
57 | break; | 61 | break; |
58 | case "WixManagedBootstrapperApplicationHost": | 62 | case "WixManagedBootstrapperApplicationHost": |
59 | this.ParseWixManagedBootstrapperApplicationHostElement(element); | 63 | this.ParseWixManagedBootstrapperApplicationHostElement(intermediate, section, element); |
60 | break; | 64 | break; |
61 | default: | 65 | default: |
62 | this.Core.UnexpectedElement(parentElement, element); | 66 | this.ParseHelper.UnexpectedElement(parentElement, element); |
63 | break; | 67 | break; |
64 | } | 68 | } |
65 | break; | 69 | break; |
66 | default: | 70 | default: |
67 | this.Core.UnexpectedElement(parentElement, element); | 71 | this.ParseHelper.UnexpectedElement(parentElement, element); |
68 | break; | 72 | break; |
69 | } | 73 | } |
70 | } | 74 | } |
@@ -76,10 +80,10 @@ namespace WixToolset.Extensions | |||
76 | /// <param name="parentElement">Parent element of element to process.</param> | 80 | /// <param name="parentElement">Parent element of element to process.</param> |
77 | /// <param name="attribute">Attribute to process.</param> | 81 | /// <param name="attribute">Attribute to process.</param> |
78 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | 82 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> |
79 | public override void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary<string, string> context) | 83 | public override void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary<string, string> context) |
80 | { | 84 | { |
81 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement); | 85 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); |
82 | Row row; | 86 | WixMbaPrereqInformationTuple prereqInfo; |
83 | 87 | ||
84 | switch (parentElement.Name.LocalName) | 88 | switch (parentElement.Name.LocalName) |
85 | { | 89 | { |
@@ -90,7 +94,7 @@ namespace WixToolset.Extensions | |||
90 | string packageId; | 94 | string packageId; |
91 | if (!context.TryGetValue("PackageId", out packageId) || String.IsNullOrEmpty(packageId)) | 95 | if (!context.TryGetValue("PackageId", out packageId) || String.IsNullOrEmpty(packageId)) |
92 | { | 96 | { |
93 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, parentElement.Name.LocalName, "Id", attribute.Name.LocalName)); | 97 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, parentElement.Name.LocalName, "Id", attribute.Name.LocalName)); |
94 | } | 98 | } |
95 | else | 99 | else |
96 | { | 100 | { |
@@ -98,80 +102,80 @@ namespace WixToolset.Extensions | |||
98 | { | 102 | { |
99 | case "PrereqLicenseFile": | 103 | case "PrereqLicenseFile": |
100 | 104 | ||
101 | if (!prereqInfoRows.TryGetValue(packageId, out row)) | 105 | if (!this.prereqInfoRows.TryGetValue(packageId, out prereqInfo)) |
102 | { | 106 | { |
103 | // at the time the extension attribute is parsed, the compiler might not yet have | 107 | // at the time the extension attribute is parsed, the compiler might not yet have |
104 | // parsed the PrereqPackage attribute, so we need to get it directly from the parent element. | 108 | // parsed the PrereqPackage attribute, so we need to get it directly from the parent element. |
105 | XAttribute prereqPackage = parentElement.Attribute(this.Namespace + "PrereqPackage"); | 109 | XAttribute prereqPackage = parentElement.Attribute(this.Namespace + "PrereqPackage"); |
106 | 110 | ||
107 | if (null != prereqPackage && YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, prereqPackage)) | 111 | if (null != prereqPackage && YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, prereqPackage)) |
108 | { | 112 | { |
109 | row = this.Core.CreateRow(sourceLineNumbers, "WixMbaPrereqInformation"); | 113 | prereqInfo = (WixMbaPrereqInformationTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixMbaPrereqInformation"); |
110 | row[0] = packageId; | 114 | prereqInfo.PackageId = packageId; |
111 | 115 | ||
112 | prereqInfoRows.Add(packageId, row); | 116 | this.prereqInfoRows.Add(packageId, prereqInfo); |
113 | } | 117 | } |
114 | else | 118 | else |
115 | { | 119 | { |
116 | this.Core.OnMessage(BalErrors.AttributeRequiresPrereqPackage(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseFile")); | 120 | this.Messaging.Write(BalErrors.AttributeRequiresPrereqPackage(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseFile")); |
117 | break; | 121 | break; |
118 | } | 122 | } |
119 | } | 123 | } |
120 | 124 | ||
121 | if (null != row[2]) | 125 | if (null != prereqInfo.LicenseUrl) |
122 | { | 126 | { |
123 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseFile", "PrereqLicenseUrl")); | 127 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseFile", "PrereqLicenseUrl")); |
124 | } | 128 | } |
125 | else | 129 | else |
126 | { | 130 | { |
127 | row[1] = this.Core.GetAttributeValue(sourceLineNumbers, attribute); | 131 | prereqInfo.LicenseFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attribute); |
128 | } | 132 | } |
129 | break; | 133 | break; |
130 | case "PrereqLicenseUrl": | 134 | case "PrereqLicenseUrl": |
131 | 135 | ||
132 | if (!prereqInfoRows.TryGetValue(packageId, out row)) | 136 | if (!this.prereqInfoRows.TryGetValue(packageId, out prereqInfo)) |
133 | { | 137 | { |
134 | // at the time the extension attribute is parsed, the compiler might not yet have | 138 | // at the time the extension attribute is parsed, the compiler might not yet have |
135 | // parsed the PrereqPackage attribute, so we need to get it directly from the parent element. | 139 | // parsed the PrereqPackage attribute, so we need to get it directly from the parent element. |
136 | XAttribute prereqPackage = parentElement.Attribute(this.Namespace + "PrereqPackage"); | 140 | XAttribute prereqPackage = parentElement.Attribute(this.Namespace + "PrereqPackage"); |
137 | 141 | ||
138 | if (null != prereqPackage && YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, prereqPackage)) | 142 | if (null != prereqPackage && YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, prereqPackage)) |
139 | { | 143 | { |
140 | row = this.Core.CreateRow(sourceLineNumbers, "WixMbaPrereqInformation"); | 144 | prereqInfo = (WixMbaPrereqInformationTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixMbaPrereqInformation"); |
141 | row[0] = packageId; | 145 | prereqInfo.PackageId = packageId; |
142 | 146 | ||
143 | prereqInfoRows.Add(packageId, row); | 147 | this.prereqInfoRows.Add(packageId, prereqInfo); |
144 | } | 148 | } |
145 | else | 149 | else |
146 | { | 150 | { |
147 | this.Core.OnMessage(BalErrors.AttributeRequiresPrereqPackage(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseUrl")); | 151 | this.Messaging.Write(BalErrors.AttributeRequiresPrereqPackage(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseUrl")); |
148 | break; | 152 | break; |
149 | } | 153 | } |
150 | } | 154 | } |
151 | 155 | ||
152 | if (null != row[1]) | 156 | if (null != prereqInfo.LicenseFile) |
153 | { | 157 | { |
154 | this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttribute(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseUrl", "PrereqLicenseFile")); | 158 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, parentElement.Name.LocalName, "PrereqLicenseUrl", "PrereqLicenseFile")); |
155 | } | 159 | } |
156 | else | 160 | else |
157 | { | 161 | { |
158 | row[2] = this.Core.GetAttributeValue(sourceLineNumbers, attribute); | 162 | prereqInfo.LicenseUrl = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attribute); |
159 | } | 163 | } |
160 | break; | 164 | break; |
161 | case "PrereqPackage": | 165 | case "PrereqPackage": |
162 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attribute)) | 166 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) |
163 | { | 167 | { |
164 | if (!prereqInfoRows.TryGetValue(packageId, out row)) | 168 | if (!this.prereqInfoRows.TryGetValue(packageId, out prereqInfo)) |
165 | { | 169 | { |
166 | row = this.Core.CreateRow(sourceLineNumbers, "WixMbaPrereqInformation"); | 170 | prereqInfo = (WixMbaPrereqInformationTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixMbaPrereqInformation"); |
167 | row[0] = packageId; | 171 | prereqInfo.PackageId = packageId; |
168 | 172 | ||
169 | prereqInfoRows.Add(packageId, row); | 173 | this.prereqInfoRows.Add(packageId, prereqInfo); |
170 | } | 174 | } |
171 | } | 175 | } |
172 | break; | 176 | break; |
173 | default: | 177 | default: |
174 | this.Core.UnexpectedAttribute(parentElement, attribute); | 178 | this.ParseHelper.UnexpectedAttribute(parentElement, attribute); |
175 | break; | 179 | break; |
176 | } | 180 | } |
177 | } | 181 | } |
@@ -180,21 +184,21 @@ namespace WixToolset.Extensions | |||
180 | string payloadId; | 184 | string payloadId; |
181 | if (!context.TryGetValue("Id", out payloadId) || String.IsNullOrEmpty(payloadId)) | 185 | if (!context.TryGetValue("Id", out payloadId) || String.IsNullOrEmpty(payloadId)) |
182 | { | 186 | { |
183 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, parentElement.Name.LocalName, "Id", attribute.Name.LocalName)); | 187 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, parentElement.Name.LocalName, "Id", attribute.Name.LocalName)); |
184 | } | 188 | } |
185 | else | 189 | else |
186 | { | 190 | { |
187 | switch (attribute.Name.LocalName) | 191 | switch (attribute.Name.LocalName) |
188 | { | 192 | { |
189 | case "BAFunctions": | 193 | case "BAFunctions": |
190 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attribute)) | 194 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) |
191 | { | 195 | { |
192 | row = this.Core.CreateRow(sourceLineNumbers, "WixBalBAFunctions"); | 196 | var tuple = (WixBalBAFunctionsTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixBalBAFunctions"); |
193 | row[0] = payloadId; | 197 | tuple.PayloadId = payloadId; |
194 | } | 198 | } |
195 | break; | 199 | break; |
196 | default: | 200 | default: |
197 | this.Core.UnexpectedAttribute(parentElement, attribute); | 201 | this.ParseHelper.UnexpectedAttribute(parentElement, attribute); |
198 | break; | 202 | break; |
199 | } | 203 | } |
200 | } | 204 | } |
@@ -205,21 +209,21 @@ namespace WixToolset.Extensions | |||
205 | XAttribute variableName = parentElement.Attribute("Name"); | 209 | XAttribute variableName = parentElement.Attribute("Name"); |
206 | if (null == variableName) | 210 | if (null == variableName) |
207 | { | 211 | { |
208 | this.Core.OnMessage(WixErrors.ExpectedParentWithAttribute(sourceLineNumbers, "Variable", "Overridable", "Name")); | 212 | this.Messaging.Write(ErrorMessages.ExpectedParentWithAttribute(sourceLineNumbers, "Variable", "Overridable", "Name")); |
209 | } | 213 | } |
210 | else | 214 | else |
211 | { | 215 | { |
212 | switch (attribute.Name.LocalName) | 216 | switch (attribute.Name.LocalName) |
213 | { | 217 | { |
214 | case "Overridable": | 218 | case "Overridable": |
215 | if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attribute)) | 219 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) |
216 | { | 220 | { |
217 | row = this.Core.CreateRow(sourceLineNumbers, "WixStdbaOverridableVariable"); | 221 | var tuple = (WixStdbaOverridableVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixStdbaOverridableVariable"); |
218 | row[0] = variableName; | 222 | tuple.Name = variableName.Value; |
219 | } | 223 | } |
220 | break; | 224 | break; |
221 | default: | 225 | default: |
222 | this.Core.UnexpectedAttribute(parentElement, attribute); | 226 | this.ParseHelper.UnexpectedAttribute(parentElement, attribute); |
223 | break; | 227 | break; |
224 | } | 228 | } |
225 | } | 229 | } |
@@ -231,10 +235,10 @@ namespace WixToolset.Extensions | |||
231 | /// Parses a Condition element for Bundles. | 235 | /// Parses a Condition element for Bundles. |
232 | /// </summary> | 236 | /// </summary> |
233 | /// <param name="node">The element to parse.</param> | 237 | /// <param name="node">The element to parse.</param> |
234 | private void ParseConditionElement(XElement node) | 238 | private void ParseConditionElement(Intermediate intermediate, IntermediateSection section, XElement node) |
235 | { | 239 | { |
236 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 240 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
237 | string condition = this.Core.GetConditionInnerText(node); // condition is the inner text of the element. | 241 | string condition = this.ParseHelper.GetConditionInnerText(node); // condition is the inner text of the element. |
238 | string message = null; | 242 | string message = null; |
239 | 243 | ||
240 | foreach (XAttribute attrib in node.Attributes()) | 244 | foreach (XAttribute attrib in node.Attributes()) |
@@ -244,37 +248,37 @@ namespace WixToolset.Extensions | |||
244 | switch (attrib.Name.LocalName) | 248 | switch (attrib.Name.LocalName) |
245 | { | 249 | { |
246 | case "Message": | 250 | case "Message": |
247 | message = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 251 | message = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
248 | break; | 252 | break; |
249 | default: | 253 | default: |
250 | this.Core.UnexpectedAttribute(node, attrib); | 254 | this.ParseHelper.UnexpectedAttribute(node, attrib); |
251 | break; | 255 | break; |
252 | } | 256 | } |
253 | } | 257 | } |
254 | else | 258 | else |
255 | { | 259 | { |
256 | this.Core.ParseExtensionAttribute(node, attrib); | 260 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); |
257 | } | 261 | } |
258 | } | 262 | } |
259 | 263 | ||
260 | this.Core.ParseForExtensionElements(node); | 264 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); |
261 | 265 | ||
262 | // Error check the values. | 266 | // Error check the values. |
263 | if (String.IsNullOrEmpty(condition)) | 267 | if (String.IsNullOrEmpty(condition)) |
264 | { | 268 | { |
265 | this.Core.OnMessage(WixErrors.ConditionExpected(sourceLineNumbers, node.Name.LocalName)); | 269 | this.Messaging.Write(ErrorMessages.ConditionExpected(sourceLineNumbers, node.Name.LocalName)); |
266 | } | 270 | } |
267 | 271 | ||
268 | if (null == message) | 272 | if (null == message) |
269 | { | 273 | { |
270 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Message")); | 274 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Message")); |
271 | } | 275 | } |
272 | 276 | ||
273 | if (!this.Core.EncounteredError) | 277 | if (!this.Messaging.EncounteredError) |
274 | { | 278 | { |
275 | Row row = this.Core.CreateRow(sourceLineNumbers, "WixBalCondition"); | 279 | var tuple = (WixBalConditionTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixBalCondition"); |
276 | row[0] = condition; | 280 | tuple.Condition = condition; |
277 | row[1] = message; | 281 | tuple.Message = message; |
278 | 282 | ||
279 | if (null == this.addedConditionLineNumber) | 283 | if (null == this.addedConditionLineNumber) |
280 | { | 284 | { |
@@ -287,9 +291,9 @@ namespace WixToolset.Extensions | |||
287 | /// Parses a WixStandardBootstrapperApplication element for Bundles. | 291 | /// Parses a WixStandardBootstrapperApplication element for Bundles. |
288 | /// </summary> | 292 | /// </summary> |
289 | /// <param name="node">The element to parse.</param> | 293 | /// <param name="node">The element to parse.</param> |
290 | private void ParseWixStandardBootstrapperApplicationElement(XElement node) | 294 | private void ParseWixStandardBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node) |
291 | { | 295 | { |
292 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 296 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
293 | string launchTarget = null; | 297 | string launchTarget = null; |
294 | string launchTargetElevatedId = null; | 298 | string launchTargetElevatedId = null; |
295 | string launchArguments = null; | 299 | string launchArguments = null; |
@@ -314,101 +318,101 @@ namespace WixToolset.Extensions | |||
314 | switch (attrib.Name.LocalName) | 318 | switch (attrib.Name.LocalName) |
315 | { | 319 | { |
316 | case "LaunchTarget": | 320 | case "LaunchTarget": |
317 | launchTarget = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 321 | launchTarget = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
318 | break; | 322 | break; |
319 | case "LaunchTargetElevatedId": | 323 | case "LaunchTargetElevatedId": |
320 | launchTargetElevatedId = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 324 | launchTargetElevatedId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
321 | break; | 325 | break; |
322 | case "LaunchArguments": | 326 | case "LaunchArguments": |
323 | launchArguments = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 327 | launchArguments = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
324 | break; | 328 | break; |
325 | case "LaunchHidden": | 329 | case "LaunchHidden": |
326 | launchHidden = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 330 | launchHidden = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
327 | break; | 331 | break; |
328 | case "LaunchWorkingFolder": | 332 | case "LaunchWorkingFolder": |
329 | launchWorkingDir = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 333 | launchWorkingDir = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
330 | break; | 334 | break; |
331 | case "LicenseFile": | 335 | case "LicenseFile": |
332 | licenseFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 336 | licenseFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
333 | break; | 337 | break; |
334 | case "LicenseUrl": | 338 | case "LicenseUrl": |
335 | licenseUrl = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); | 339 | licenseUrl = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); |
336 | break; | 340 | break; |
337 | case "LogoFile": | 341 | case "LogoFile": |
338 | logoFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 342 | logoFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
339 | break; | 343 | break; |
340 | case "LogoSideFile": | 344 | case "LogoSideFile": |
341 | logoSideFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 345 | logoSideFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
342 | break; | 346 | break; |
343 | case "ThemeFile": | 347 | case "ThemeFile": |
344 | themeFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 348 | themeFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
345 | break; | 349 | break; |
346 | case "LocalizationFile": | 350 | case "LocalizationFile": |
347 | localizationFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 351 | localizationFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
348 | break; | 352 | break; |
349 | case "SuppressOptionsUI": | 353 | case "SuppressOptionsUI": |
350 | suppressOptionsUI = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 354 | suppressOptionsUI = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
351 | break; | 355 | break; |
352 | case "SuppressDowngradeFailure": | 356 | case "SuppressDowngradeFailure": |
353 | suppressDowngradeFailure = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 357 | suppressDowngradeFailure = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
354 | break; | 358 | break; |
355 | case "SuppressRepair": | 359 | case "SuppressRepair": |
356 | suppressRepair = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 360 | suppressRepair = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
357 | break; | 361 | break; |
358 | case "ShowVersion": | 362 | case "ShowVersion": |
359 | showVersion = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 363 | showVersion = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
360 | break; | 364 | break; |
361 | case "SupportCacheOnly": | 365 | case "SupportCacheOnly": |
362 | supportCacheOnly = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 366 | supportCacheOnly = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
363 | break; | 367 | break; |
364 | default: | 368 | default: |
365 | this.Core.UnexpectedAttribute(node, attrib); | 369 | this.ParseHelper.UnexpectedAttribute(node, attrib); |
366 | break; | 370 | break; |
367 | } | 371 | } |
368 | } | 372 | } |
369 | else | 373 | else |
370 | { | 374 | { |
371 | this.Core.ParseExtensionAttribute(node, attrib); | 375 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); |
372 | } | 376 | } |
373 | } | 377 | } |
374 | 378 | ||
375 | this.Core.ParseForExtensionElements(node); | 379 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); |
376 | 380 | ||
377 | if (String.IsNullOrEmpty(licenseFile) && null == licenseUrl) | 381 | if (String.IsNullOrEmpty(licenseFile) && null == licenseUrl) |
378 | { | 382 | { |
379 | this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "LicenseFile", "LicenseUrl", true)); | 383 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "LicenseFile", "LicenseUrl", true)); |
380 | } | 384 | } |
381 | 385 | ||
382 | if (!this.Core.EncounteredError) | 386 | if (!this.Messaging.EncounteredError) |
383 | { | 387 | { |
384 | if (!String.IsNullOrEmpty(launchTarget)) | 388 | if (!String.IsNullOrEmpty(launchTarget)) |
385 | { | 389 | { |
386 | WixBundleVariableRow row = (WixBundleVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixBundleVariable"); | 390 | var row = (WixBundleVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixBundleVariable"); |
387 | row.Id = "LaunchTarget"; | 391 | row.Id = new Identifier("LaunchTarget", AccessModifier.Public); |
388 | row.Value = launchTarget; | 392 | row.Value = launchTarget; |
389 | row.Type = "string"; | 393 | row.Type = "string"; |
390 | } | 394 | } |
391 | 395 | ||
392 | if (!String.IsNullOrEmpty(launchTargetElevatedId)) | 396 | if (!String.IsNullOrEmpty(launchTargetElevatedId)) |
393 | { | 397 | { |
394 | WixBundleVariableRow row = (WixBundleVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixBundleVariable"); | 398 | var row = (WixBundleVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixBundleVariable"); |
395 | row.Id = "LaunchTargetElevatedId"; | 399 | row.Id = new Identifier("LaunchTargetElevatedId", AccessModifier.Public); |
396 | row.Value = launchTargetElevatedId; | 400 | row.Value = launchTargetElevatedId; |
397 | row.Type = "string"; | 401 | row.Type = "string"; |
398 | } | 402 | } |
399 | 403 | ||
400 | if (!String.IsNullOrEmpty(launchArguments)) | 404 | if (!String.IsNullOrEmpty(launchArguments)) |
401 | { | 405 | { |
402 | WixBundleVariableRow row = (WixBundleVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixBundleVariable"); | 406 | var row = (WixBundleVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixBundleVariable"); |
403 | row.Id = "LaunchArguments"; | 407 | row.Id = new Identifier("LaunchArguments", AccessModifier.Public); |
404 | row.Value = launchArguments; | 408 | row.Value = launchArguments; |
405 | row.Type = "string"; | 409 | row.Type = "string"; |
406 | } | 410 | } |
407 | 411 | ||
408 | if (YesNoType.Yes == launchHidden) | 412 | if (YesNoType.Yes == launchHidden) |
409 | { | 413 | { |
410 | WixBundleVariableRow row = (WixBundleVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixBundleVariable"); | 414 | var row = (WixBundleVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixBundleVariable"); |
411 | row.Id = "LaunchHidden"; | 415 | row.Id = new Identifier("LaunchHidden", AccessModifier.Public); |
412 | row.Value = "yes"; | 416 | row.Value = "yes"; |
413 | row.Type = "string"; | 417 | row.Type = "string"; |
414 | } | 418 | } |
@@ -416,80 +420,80 @@ namespace WixToolset.Extensions | |||
416 | 420 | ||
417 | if (!String.IsNullOrEmpty(launchWorkingDir)) | 421 | if (!String.IsNullOrEmpty(launchWorkingDir)) |
418 | { | 422 | { |
419 | WixBundleVariableRow row = (WixBundleVariableRow)this.Core.CreateRow(sourceLineNumbers, "Variable"); | 423 | var row = (WixBundleVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "Variable"); |
420 | row.Id = "LaunchWorkingFolder"; | 424 | row.Id = new Identifier("LaunchWorkingFolder", AccessModifier.Public); |
421 | row.Value = launchWorkingDir; | 425 | row.Value = launchWorkingDir; |
422 | row.Type = "string"; | 426 | row.Type = "string"; |
423 | } | 427 | } |
424 | 428 | ||
425 | if (!String.IsNullOrEmpty(licenseFile)) | 429 | if (!String.IsNullOrEmpty(licenseFile)) |
426 | { | 430 | { |
427 | WixVariableRow wixVariableRow = (WixVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixVariable"); | 431 | var wixVariableRow = (WixVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixVariable"); |
428 | wixVariableRow.Id = "WixStdbaLicenseRtf"; | 432 | wixVariableRow.Id = new Identifier("WixStdbaLicenseRtf", AccessModifier.Public); |
429 | wixVariableRow.Value = licenseFile; | 433 | wixVariableRow.Value = licenseFile; |
430 | } | 434 | } |
431 | 435 | ||
432 | if (null != licenseUrl) | 436 | if (null != licenseUrl) |
433 | { | 437 | { |
434 | WixVariableRow wixVariableRow = (WixVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixVariable"); | 438 | var wixVariableRow = (WixVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixVariable"); |
435 | wixVariableRow.Id = "WixStdbaLicenseUrl"; | 439 | wixVariableRow.Id = new Identifier("WixStdbaLicenseUrl", AccessModifier.Public); |
436 | wixVariableRow.Value = licenseUrl; | 440 | wixVariableRow.Value = licenseUrl; |
437 | } | 441 | } |
438 | 442 | ||
439 | if (!String.IsNullOrEmpty(logoFile)) | 443 | if (!String.IsNullOrEmpty(logoFile)) |
440 | { | 444 | { |
441 | WixVariableRow wixVariableRow = (WixVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixVariable"); | 445 | var wixVariableRow = (WixVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixVariable"); |
442 | wixVariableRow.Id = "WixStdbaLogo"; | 446 | wixVariableRow.Id = new Identifier("WixStdbaLogo", AccessModifier.Public); |
443 | wixVariableRow.Value = logoFile; | 447 | wixVariableRow.Value = logoFile; |
444 | } | 448 | } |
445 | 449 | ||
446 | if (!String.IsNullOrEmpty(logoSideFile)) | 450 | if (!String.IsNullOrEmpty(logoSideFile)) |
447 | { | 451 | { |
448 | WixVariableRow wixVariableRow = (WixVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixVariable"); | 452 | var wixVariableRow = (WixVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixVariable"); |
449 | wixVariableRow.Id = "WixStdbaLogoSide"; | 453 | wixVariableRow.Id = new Identifier("WixStdbaLogoSide", AccessModifier.Public); |
450 | wixVariableRow.Value = logoSideFile; | 454 | wixVariableRow.Value = logoSideFile; |
451 | } | 455 | } |
452 | 456 | ||
453 | if (!String.IsNullOrEmpty(themeFile)) | 457 | if (!String.IsNullOrEmpty(themeFile)) |
454 | { | 458 | { |
455 | WixVariableRow wixVariableRow = (WixVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixVariable"); | 459 | var wixVariableRow = (WixVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixVariable"); |
456 | wixVariableRow.Id = "WixStdbaThemeXml"; | 460 | wixVariableRow.Id = new Identifier("WixStdbaThemeXml", AccessModifier.Public); |
457 | wixVariableRow.Value = themeFile; | 461 | wixVariableRow.Value = themeFile; |
458 | } | 462 | } |
459 | 463 | ||
460 | if (!String.IsNullOrEmpty(localizationFile)) | 464 | if (!String.IsNullOrEmpty(localizationFile)) |
461 | { | 465 | { |
462 | WixVariableRow wixVariableRow = (WixVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixVariable"); | 466 | var wixVariableRow = (WixVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixVariable"); |
463 | wixVariableRow.Id = "WixStdbaThemeWxl"; | 467 | wixVariableRow.Id = new Identifier("WixStdbaThemeWxl", AccessModifier.Public); |
464 | wixVariableRow.Value = localizationFile; | 468 | wixVariableRow.Value = localizationFile; |
465 | } | 469 | } |
466 | 470 | ||
467 | if (YesNoType.Yes == suppressOptionsUI || YesNoType.Yes == suppressDowngradeFailure || YesNoType.Yes == suppressRepair || YesNoType.Yes == showVersion || YesNoType.Yes == supportCacheOnly) | 471 | if (YesNoType.Yes == suppressOptionsUI || YesNoType.Yes == suppressDowngradeFailure || YesNoType.Yes == suppressRepair || YesNoType.Yes == showVersion || YesNoType.Yes == supportCacheOnly) |
468 | { | 472 | { |
469 | Row row = this.Core.CreateRow(sourceLineNumbers, "WixStdbaOptions"); | 473 | var tuple = (WixStdbaOptionsTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixStdbaOptions"); |
470 | if (YesNoType.Yes == suppressOptionsUI) | 474 | if (YesNoType.Yes == suppressOptionsUI) |
471 | { | 475 | { |
472 | row[0] = 1; | 476 | tuple.SuppressOptionsUI = 1; |
473 | } | 477 | } |
474 | 478 | ||
475 | if (YesNoType.Yes == suppressDowngradeFailure) | 479 | if (YesNoType.Yes == suppressDowngradeFailure) |
476 | { | 480 | { |
477 | row[1] = 1; | 481 | tuple.SuppressDowngradeFailure = 1; |
478 | } | 482 | } |
479 | 483 | ||
480 | if (YesNoType.Yes == suppressRepair) | 484 | if (YesNoType.Yes == suppressRepair) |
481 | { | 485 | { |
482 | row[2] = 1; | 486 | tuple.SuppressRepair = 1; |
483 | } | 487 | } |
484 | 488 | ||
485 | if (YesNoType.Yes == showVersion) | 489 | if (YesNoType.Yes == showVersion) |
486 | { | 490 | { |
487 | row[3] = 1; | 491 | tuple.ShowVersion = 1; |
488 | } | 492 | } |
489 | 493 | ||
490 | if (YesNoType.Yes == supportCacheOnly) | 494 | if (YesNoType.Yes == supportCacheOnly) |
491 | { | 495 | { |
492 | row[4] = 1; | 496 | tuple.SupportCacheOnly = 1; |
493 | } | 497 | } |
494 | } | 498 | } |
495 | } | 499 | } |
@@ -499,9 +503,9 @@ namespace WixToolset.Extensions | |||
499 | /// Parses a WixManagedBootstrapperApplicationHost element for Bundles. | 503 | /// Parses a WixManagedBootstrapperApplicationHost element for Bundles. |
500 | /// </summary> | 504 | /// </summary> |
501 | /// <param name="node">The element to parse.</param> | 505 | /// <param name="node">The element to parse.</param> |
502 | private void ParseWixManagedBootstrapperApplicationHostElement(XElement node) | 506 | private void ParseWixManagedBootstrapperApplicationHostElement(Intermediate intermediate, IntermediateSection section, XElement node) |
503 | { | 507 | { |
504 | SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | 508 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
505 | string logoFile = null; | 509 | string logoFile = null; |
506 | string themeFile = null; | 510 | string themeFile = null; |
507 | string localizationFile = null; | 511 | string localizationFile = null; |
@@ -513,47 +517,47 @@ namespace WixToolset.Extensions | |||
513 | switch (attrib.Name.LocalName) | 517 | switch (attrib.Name.LocalName) |
514 | { | 518 | { |
515 | case "LogoFile": | 519 | case "LogoFile": |
516 | logoFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 520 | logoFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
517 | break; | 521 | break; |
518 | case "ThemeFile": | 522 | case "ThemeFile": |
519 | themeFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 523 | themeFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
520 | break; | 524 | break; |
521 | case "LocalizationFile": | 525 | case "LocalizationFile": |
522 | localizationFile = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 526 | localizationFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
523 | break; | 527 | break; |
524 | default: | 528 | default: |
525 | this.Core.UnexpectedAttribute(node, attrib); | 529 | this.ParseHelper.UnexpectedAttribute(node, attrib); |
526 | break; | 530 | break; |
527 | } | 531 | } |
528 | } | 532 | } |
529 | else | 533 | else |
530 | { | 534 | { |
531 | this.Core.ParseExtensionAttribute(node, attrib); | 535 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); |
532 | } | 536 | } |
533 | } | 537 | } |
534 | 538 | ||
535 | this.Core.ParseForExtensionElements(node); | 539 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); |
536 | 540 | ||
537 | if (!this.Core.EncounteredError) | 541 | if (!this.Messaging.EncounteredError) |
538 | { | 542 | { |
539 | if (!String.IsNullOrEmpty(logoFile)) | 543 | if (!String.IsNullOrEmpty(logoFile)) |
540 | { | 544 | { |
541 | WixVariableRow wixVariableRow = (WixVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixVariable"); | 545 | var wixVariableRow = (WixVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixVariable"); |
542 | wixVariableRow.Id = "PreqbaLogo"; | 546 | wixVariableRow.Id = new Identifier("PreqbaLogo", AccessModifier.Public); |
543 | wixVariableRow.Value = logoFile; | 547 | wixVariableRow.Value = logoFile; |
544 | } | 548 | } |
545 | 549 | ||
546 | if (!String.IsNullOrEmpty(themeFile)) | 550 | if (!String.IsNullOrEmpty(themeFile)) |
547 | { | 551 | { |
548 | WixVariableRow wixVariableRow = (WixVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixVariable"); | 552 | var wixVariableRow = (WixVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixVariable"); |
549 | wixVariableRow.Id = "PreqbaThemeXml"; | 553 | wixVariableRow.Id = new Identifier("PreqbaThemeXml", AccessModifier.Public); |
550 | wixVariableRow.Value = themeFile; | 554 | wixVariableRow.Value = themeFile; |
551 | } | 555 | } |
552 | 556 | ||
553 | if (!String.IsNullOrEmpty(localizationFile)) | 557 | if (!String.IsNullOrEmpty(localizationFile)) |
554 | { | 558 | { |
555 | WixVariableRow wixVariableRow = (WixVariableRow)this.Core.CreateRow(sourceLineNumbers, "WixVariable"); | 559 | var wixVariableRow = (WixVariableTuple)this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixVariable"); |
556 | wixVariableRow.Id = "PreqbaThemeWxl"; | 560 | wixVariableRow.Id = new Identifier("PreqbaThemeWxl", AccessModifier.Public); |
557 | wixVariableRow.Value = localizationFile; | 561 | wixVariableRow.Value = localizationFile; |
558 | } | 562 | } |
559 | } | 563 | } |