diff options
Diffstat (limited to 'src/wixext/ComPlusCompiler.cs')
| -rw-r--r-- | src/wixext/ComPlusCompiler.cs | 644 |
1 files changed, 317 insertions, 327 deletions
diff --git a/src/wixext/ComPlusCompiler.cs b/src/wixext/ComPlusCompiler.cs index 4709eba9..9230cdb1 100644 --- a/src/wixext/ComPlusCompiler.cs +++ b/src/wixext/ComPlusCompiler.cs | |||
| @@ -3,14 +3,11 @@ | |||
| 3 | namespace WixToolset.ComPlus | 3 | namespace WixToolset.ComPlus |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections; | ||
| 7 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 8 | using System.Globalization; | ||
| 9 | using System.Text; | ||
| 10 | using System.Xml.Linq; | 7 | using System.Xml.Linq; |
| 8 | using WixToolset.ComPlus.Tuples; | ||
| 11 | using WixToolset.Data; | 9 | using WixToolset.Data; |
| 12 | using WixToolset.Extensibility; | 10 | using WixToolset.Extensibility; |
| 13 | using WixToolset.Extensibility.Data; | ||
| 14 | 11 | ||
| 15 | /// <summary> | 12 | /// <summary> |
| 16 | /// The compiler for the WiX Toolset COM+ Extension. | 13 | /// The compiler for the WiX Toolset COM+ Extension. |
| @@ -42,9 +39,9 @@ namespace WixToolset.ComPlus | |||
| 42 | switch (parentElement.Name.LocalName) | 39 | switch (parentElement.Name.LocalName) |
| 43 | { | 40 | { |
| 44 | case "Component": | 41 | case "Component": |
| 45 | string componentId = context["ComponentId"]; | 42 | var componentId = context["ComponentId"]; |
| 46 | string directoryId = context["DirectoryId"]; | 43 | var directoryId = context["DirectoryId"]; |
| 47 | bool win64 = Boolean.Parse(context["Win64"]); | 44 | var win64 = Boolean.Parse(context["Win64"]); |
| 48 | 45 | ||
| 49 | switch (element.Name.LocalName) | 46 | switch (element.Name.LocalName) |
| 50 | { | 47 | { |
| @@ -130,22 +127,22 @@ namespace WixToolset.ComPlus | |||
| 130 | /// <param name="componentKey">Identifier of parent component.</param> | 127 | /// <param name="componentKey">Identifier of parent component.</param> |
| 131 | private void ParseComPlusPartitionElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, bool win64) | 128 | private void ParseComPlusPartitionElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, bool win64) |
| 132 | { | 129 | { |
| 133 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 130 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 134 | 131 | ||
| 135 | string key = null; | 132 | Identifier key = null; |
| 136 | string id = null; | 133 | string id = null; |
| 137 | string name = null; | 134 | string name = null; |
| 138 | 135 | ||
| 139 | Hashtable properties = new Hashtable(); | 136 | var properties = new Dictionary<string, string>(); |
| 140 | 137 | ||
| 141 | foreach (XAttribute attrib in node.Attributes()) | 138 | foreach (var attrib in node.Attributes()) |
| 142 | { | 139 | { |
| 143 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 140 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 144 | { | 141 | { |
| 145 | switch (attrib.Name.LocalName) | 142 | switch (attrib.Name.LocalName) |
| 146 | { | 143 | { |
| 147 | case "Id": | 144 | case "Id": |
| 148 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 145 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 149 | break; | 146 | break; |
| 150 | case "PartitionId": | 147 | case "PartitionId": |
| 151 | id = this.TryFormatGuidValue(this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib)); | 148 | id = this.TryFormatGuidValue(this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib)); |
| @@ -190,20 +187,20 @@ namespace WixToolset.ComPlus | |||
| 190 | this.Messaging.Write(ComPlusErrors.RequiredAttributeNotUnderComponent(sourceLineNumbers, node.Name.LocalName, "Id", "Name")); | 187 | this.Messaging.Write(ComPlusErrors.RequiredAttributeNotUnderComponent(sourceLineNumbers, node.Name.LocalName, "Id", "Name")); |
| 191 | } | 188 | } |
| 192 | 189 | ||
| 193 | foreach (XElement child in node.Elements()) | 190 | foreach (var child in node.Elements()) |
| 194 | { | 191 | { |
| 195 | if (this.Namespace == child.Name.Namespace) | 192 | if (this.Namespace == child.Name.Namespace) |
| 196 | { | 193 | { |
| 197 | switch (child.Name.LocalName) | 194 | switch (child.Name.LocalName) |
| 198 | { | 195 | { |
| 199 | case "ComPlusPartitionRole": | 196 | case "ComPlusPartitionRole": |
| 200 | this.ParseComPlusPartitionRoleElement(intermediate, section, child, componentKey, key); | 197 | this.ParseComPlusPartitionRoleElement(intermediate, section, child, componentKey, key?.Id); |
| 201 | break; | 198 | break; |
| 202 | case "ComPlusPartitionUser": | 199 | case "ComPlusPartitionUser": |
| 203 | this.ParseComPlusPartitionUserElement(intermediate, section, child, componentKey, key); | 200 | this.ParseComPlusPartitionUserElement(intermediate, section, child, componentKey, key?.Id); |
| 204 | break; | 201 | break; |
| 205 | case "ComPlusApplication": | 202 | case "ComPlusApplication": |
| 206 | this.ParseComPlusApplicationElement(intermediate, section, child, componentKey, win64, key); | 203 | this.ParseComPlusApplicationElement(intermediate, section, child, componentKey, win64, key?.Id); |
| 207 | break; | 204 | break; |
| 208 | default: | 205 | default: |
| 209 | this.ParseHelper.UnexpectedElement(node, child); | 206 | this.ParseHelper.UnexpectedElement(node, child); |
| @@ -216,40 +213,26 @@ namespace WixToolset.ComPlus | |||
| 216 | } | 213 | } |
| 217 | } | 214 | } |
| 218 | 215 | ||
| 219 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusPartition"); | 216 | section.AddTuple(new ComPlusPartitionTuple(sourceLineNumbers, key) |
| 220 | row.Set(0, key); | 217 | { |
| 221 | row.Set(1, componentKey); | 218 | ComponentRef = componentKey, |
| 222 | row.Set(2, id); | 219 | PartitionId = id, |
| 223 | row.Set(3, name); | 220 | Name = name, |
| 221 | }); | ||
| 224 | 222 | ||
| 225 | IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); | 223 | foreach (var kvp in properties) |
| 226 | while (propertiesEnumerator.MoveNext()) | ||
| 227 | { | 224 | { |
| 228 | var propertyRow = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusPartitionProperty"); | 225 | section.AddTuple(new ComPlusPartitionPropertyTuple(sourceLineNumbers) |
| 229 | propertyRow.Set(0, key); | 226 | { |
| 230 | propertyRow.Set(1, (string)propertiesEnumerator.Key); | 227 | PartitionRef = key?.Id, |
| 231 | propertyRow.Set(2, (string)propertiesEnumerator.Value); | 228 | Name = kvp.Key, |
| 229 | Value = kvp.Value, | ||
| 230 | }); | ||
| 232 | } | 231 | } |
| 233 | 232 | ||
| 234 | if (componentKey != null) | 233 | if (componentKey != null) |
| 235 | { | 234 | { |
| 236 | if (win64) | 235 | this.AddReferenceToConfigureComPlus(section, sourceLineNumbers, node.Name.LocalName, win64); |
| 237 | { | ||
| 238 | if (this.Context.Platform == Platform.IA64) | ||
| 239 | { | ||
| 240 | this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, "ia64", node.Name.LocalName)); | ||
| 241 | } | ||
| 242 | else | ||
| 243 | { | ||
| 244 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall_x64"); | ||
| 245 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall_x64"); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | else | ||
| 249 | { | ||
| 250 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall"); | ||
| 251 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall"); | ||
| 252 | } | ||
| 253 | } | 236 | } |
| 254 | } | 237 | } |
| 255 | 238 | ||
| @@ -261,19 +244,19 @@ namespace WixToolset.ComPlus | |||
| 261 | /// <param name="applicationKey">Optional identifier of parent application.</param> | 244 | /// <param name="applicationKey">Optional identifier of parent application.</param> |
| 262 | private void ParseComPlusPartitionRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string partitionKey) | 245 | private void ParseComPlusPartitionRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string partitionKey) |
| 263 | { | 246 | { |
| 264 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 247 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 265 | 248 | ||
| 266 | string key = null; | 249 | Identifier key = null; |
| 267 | string name = null; | 250 | string name = null; |
| 268 | 251 | ||
| 269 | foreach (XAttribute attrib in node.Attributes()) | 252 | foreach (var attrib in node.Attributes()) |
| 270 | { | 253 | { |
| 271 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 254 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 272 | { | 255 | { |
| 273 | switch (attrib.Name.LocalName) | 256 | switch (attrib.Name.LocalName) |
| 274 | { | 257 | { |
| 275 | case "Id": | 258 | case "Id": |
| 276 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 259 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 277 | break; | 260 | break; |
| 278 | case "Partition": | 261 | case "Partition": |
| 279 | if (null != partitionKey) | 262 | if (null != partitionKey) |
| @@ -281,7 +264,7 @@ namespace WixToolset.ComPlus | |||
| 281 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 264 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 282 | } | 265 | } |
| 283 | partitionKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 266 | partitionKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 284 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusPartition", partitionKey); | 267 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusPartition, partitionKey); |
| 285 | break; | 268 | break; |
| 286 | case "Name": | 269 | case "Name": |
| 287 | name = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 270 | name = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -302,17 +285,17 @@ namespace WixToolset.ComPlus | |||
| 302 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Partition")); | 285 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Partition")); |
| 303 | } | 286 | } |
| 304 | 287 | ||
| 305 | foreach (XElement child in node.Elements()) | 288 | foreach (var child in node.Elements()) |
| 306 | { | 289 | { |
| 307 | if (this.Namespace == child.Name.Namespace) | 290 | if (this.Namespace == child.Name.Namespace) |
| 308 | { | 291 | { |
| 309 | switch (child.Name.LocalName) | 292 | switch (child.Name.LocalName) |
| 310 | { | 293 | { |
| 311 | case "ComPlusUserInPartitionRole": | 294 | case "ComPlusUserInPartitionRole": |
| 312 | this.ParseComPlusUserInPartitionRoleElement(intermediate, section, child, componentKey, key); | 295 | this.ParseComPlusUserInPartitionRoleElement(intermediate, section, child, componentKey, key?.Id); |
| 313 | break; | 296 | break; |
| 314 | case "ComPlusGroupInPartitionRole": | 297 | case "ComPlusGroupInPartitionRole": |
| 315 | this.ParseComPlusGroupInPartitionRoleElement(intermediate, section, child, componentKey, key); | 298 | this.ParseComPlusGroupInPartitionRoleElement(intermediate, section, child, componentKey, key?.Id); |
| 316 | break; | 299 | break; |
| 317 | default: | 300 | default: |
| 318 | this.ParseHelper.UnexpectedElement(node, child); | 301 | this.ParseHelper.UnexpectedElement(node, child); |
| @@ -325,11 +308,11 @@ namespace WixToolset.ComPlus | |||
| 325 | } | 308 | } |
| 326 | } | 309 | } |
| 327 | 310 | ||
| 328 | // add table row | 311 | section.AddTuple(new ComPlusPartitionRoleTuple(sourceLineNumbers, key) |
| 329 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusPartitionRole"); | 312 | { |
| 330 | row.Set(0, key); | 313 | PartitionRef = partitionKey, |
| 331 | row.Set(1, partitionKey); | 314 | Name = name, |
| 332 | row.Set(3, name); | 315 | }); |
| 333 | } | 316 | } |
| 334 | 317 | ||
| 335 | /// <summary> | 318 | /// <summary> |
| @@ -340,19 +323,19 @@ namespace WixToolset.ComPlus | |||
| 340 | /// <param name="applicationKey">Optional identifier of parent application role.</param> | 323 | /// <param name="applicationKey">Optional identifier of parent application role.</param> |
| 341 | private void ParseComPlusUserInPartitionRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string partitionRoleKey) | 324 | private void ParseComPlusUserInPartitionRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string partitionRoleKey) |
| 342 | { | 325 | { |
| 343 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 326 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 344 | 327 | ||
| 345 | string key = null; | 328 | Identifier key = null; |
| 346 | string user = null; | 329 | string user = null; |
| 347 | 330 | ||
| 348 | foreach (XAttribute attrib in node.Attributes()) | 331 | foreach (var attrib in node.Attributes()) |
| 349 | { | 332 | { |
| 350 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 333 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 351 | { | 334 | { |
| 352 | switch (attrib.Name.LocalName) | 335 | switch (attrib.Name.LocalName) |
| 353 | { | 336 | { |
| 354 | case "Id": | 337 | case "Id": |
| 355 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 338 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 356 | break; | 339 | break; |
| 357 | case "PartitionRole": | 340 | case "PartitionRole": |
| 358 | if (null != partitionRoleKey) | 341 | if (null != partitionRoleKey) |
| @@ -360,7 +343,7 @@ namespace WixToolset.ComPlus | |||
| 360 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 343 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 361 | } | 344 | } |
| 362 | partitionRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 345 | partitionRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 363 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusPartitionRole", partitionRoleKey); | 346 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusPartitionRole, partitionRoleKey); |
| 364 | break; | 347 | break; |
| 365 | case "User": | 348 | case "User": |
| 366 | user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 349 | user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -382,11 +365,12 @@ namespace WixToolset.ComPlus | |||
| 382 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PartitionRole")); | 365 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PartitionRole")); |
| 383 | } | 366 | } |
| 384 | 367 | ||
| 385 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusUserInPartitionRole"); | 368 | section.AddTuple(new ComPlusUserInPartitionRoleTuple(sourceLineNumbers, key) |
| 386 | row.Set(0, key); | 369 | { |
| 387 | row.Set(1, partitionRoleKey); | 370 | PartitionRoleRef = partitionRoleKey, |
| 388 | row.Set(2, componentKey); | 371 | ComponentRef = componentKey, |
| 389 | row.Set(3, user); | 372 | UserRef = user, |
| 373 | }); | ||
| 390 | } | 374 | } |
| 391 | 375 | ||
| 392 | /// <summary> | 376 | /// <summary> |
| @@ -397,19 +381,19 @@ namespace WixToolset.ComPlus | |||
| 397 | /// <param name="applicationKey">Optional identifier of parent application role.</param> | 381 | /// <param name="applicationKey">Optional identifier of parent application role.</param> |
| 398 | private void ParseComPlusGroupInPartitionRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string partitionRoleKey) | 382 | private void ParseComPlusGroupInPartitionRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string partitionRoleKey) |
| 399 | { | 383 | { |
| 400 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 384 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 401 | 385 | ||
| 402 | string key = null; | 386 | Identifier key = null; |
| 403 | string group = null; | 387 | string group = null; |
| 404 | 388 | ||
| 405 | foreach (XAttribute attrib in node.Attributes()) | 389 | foreach (var attrib in node.Attributes()) |
| 406 | { | 390 | { |
| 407 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 391 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 408 | { | 392 | { |
| 409 | switch (attrib.Name.LocalName) | 393 | switch (attrib.Name.LocalName) |
| 410 | { | 394 | { |
| 411 | case "Id": | 395 | case "Id": |
| 412 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 396 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 413 | break; | 397 | break; |
| 414 | case "PartitionRole": | 398 | case "PartitionRole": |
| 415 | if (null != partitionRoleKey) | 399 | if (null != partitionRoleKey) |
| @@ -417,7 +401,7 @@ namespace WixToolset.ComPlus | |||
| 417 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 401 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 418 | } | 402 | } |
| 419 | partitionRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 403 | partitionRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 420 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusPartitionRole", partitionRoleKey); | 404 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusPartitionRole, partitionRoleKey); |
| 421 | break; | 405 | break; |
| 422 | case "Group": | 406 | case "Group": |
| 423 | group = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 407 | group = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -439,11 +423,12 @@ namespace WixToolset.ComPlus | |||
| 439 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PartitionRole")); | 423 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "PartitionRole")); |
| 440 | } | 424 | } |
| 441 | 425 | ||
| 442 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusGroupInPartitionRole"); | 426 | section.AddTuple(new ComPlusGroupInPartitionRoleTuple(sourceLineNumbers, key) |
| 443 | row.Set(0, key); | 427 | { |
| 444 | row.Set(1, partitionRoleKey); | 428 | PartitionRoleRef = partitionRoleKey, |
| 445 | row.Set(2, componentKey); | 429 | ComponentRef = componentKey, |
| 446 | row.Set(3, group); | 430 | GroupRef = group, |
| 431 | }); | ||
| 447 | } | 432 | } |
| 448 | 433 | ||
| 449 | /// <summary> | 434 | /// <summary> |
| @@ -453,19 +438,19 @@ namespace WixToolset.ComPlus | |||
| 453 | /// <param name="componentKey">Identifier of parent component.</param> | 438 | /// <param name="componentKey">Identifier of parent component.</param> |
| 454 | private void ParseComPlusPartitionUserElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string partitionKey) | 439 | private void ParseComPlusPartitionUserElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string partitionKey) |
| 455 | { | 440 | { |
| 456 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 441 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 457 | 442 | ||
| 458 | string key = null; | 443 | Identifier key = null; |
| 459 | string user = null; | 444 | string user = null; |
| 460 | 445 | ||
| 461 | foreach (XAttribute attrib in node.Attributes()) | 446 | foreach (var attrib in node.Attributes()) |
| 462 | { | 447 | { |
| 463 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 448 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 464 | { | 449 | { |
| 465 | switch (attrib.Name.LocalName) | 450 | switch (attrib.Name.LocalName) |
| 466 | { | 451 | { |
| 467 | case "Id": | 452 | case "Id": |
| 468 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 453 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 469 | break; | 454 | break; |
| 470 | case "Partition": | 455 | case "Partition": |
| 471 | if (null != partitionKey) | 456 | if (null != partitionKey) |
| @@ -473,7 +458,7 @@ namespace WixToolset.ComPlus | |||
| 473 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 458 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 474 | } | 459 | } |
| 475 | partitionKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 460 | partitionKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 476 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusPartition", partitionKey); | 461 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusPartition, partitionKey); |
| 477 | break; | 462 | break; |
| 478 | case "User": | 463 | case "User": |
| 479 | user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 464 | user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -495,11 +480,12 @@ namespace WixToolset.ComPlus | |||
| 495 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Partition")); | 480 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Partition")); |
| 496 | } | 481 | } |
| 497 | 482 | ||
| 498 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusPartitionUser"); | 483 | section.AddTuple(new ComPlusPartitionUserTuple(sourceLineNumbers, key) |
| 499 | row.Set(0, key); | 484 | { |
| 500 | row.Set(1, partitionKey); | 485 | PartitionRef = partitionKey, |
| 501 | row.Set(2, componentKey); | 486 | ComponentRef = componentKey, |
| 502 | row.Set(3, user); | 487 | UserRef = user, |
| 488 | }); | ||
| 503 | } | 489 | } |
| 504 | 490 | ||
| 505 | /// <summary> | 491 | /// <summary> |
| @@ -510,13 +496,13 @@ namespace WixToolset.ComPlus | |||
| 510 | /// <param name="partitionKey">Optional identifier of parent partition.</param> | 496 | /// <param name="partitionKey">Optional identifier of parent partition.</param> |
| 511 | private void ParseComPlusApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, bool win64, string partitionKey) | 497 | private void ParseComPlusApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, bool win64, string partitionKey) |
| 512 | { | 498 | { |
| 513 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 499 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 514 | 500 | ||
| 515 | string key = null; | 501 | Identifier key = null; |
| 516 | string id = null; | 502 | string id = null; |
| 517 | string name = null; | 503 | string name = null; |
| 518 | 504 | ||
| 519 | Hashtable properties = new Hashtable(); | 505 | var properties = new Dictionary<string, string>(); |
| 520 | 506 | ||
| 521 | foreach (XAttribute attrib in node.Attributes()) | 507 | foreach (XAttribute attrib in node.Attributes()) |
| 522 | { | 508 | { |
| @@ -525,7 +511,7 @@ namespace WixToolset.ComPlus | |||
| 525 | switch (attrib.Name.LocalName) | 511 | switch (attrib.Name.LocalName) |
| 526 | { | 512 | { |
| 527 | case "Id": | 513 | case "Id": |
| 528 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 514 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 529 | break; | 515 | break; |
| 530 | case "Partition": | 516 | case "Partition": |
| 531 | if (null != partitionKey) | 517 | if (null != partitionKey) |
| @@ -533,7 +519,7 @@ namespace WixToolset.ComPlus | |||
| 533 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 519 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 534 | } | 520 | } |
| 535 | partitionKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 521 | partitionKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 536 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusPartition", partitionKey); | 522 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusPartition, partitionKey); |
| 537 | break; | 523 | break; |
| 538 | case "ApplicationId": | 524 | case "ApplicationId": |
| 539 | id = this.TryFormatGuidValue(this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib)); | 525 | id = this.TryFormatGuidValue(this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib)); |
| @@ -553,7 +539,7 @@ namespace WixToolset.ComPlus | |||
| 553 | { | 539 | { |
| 554 | this.Messaging.Write(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 540 | this.Messaging.Write(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); |
| 555 | } | 541 | } |
| 556 | string accessChecksLevelValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 542 | var accessChecksLevelValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 557 | switch (accessChecksLevelValue) | 543 | switch (accessChecksLevelValue) |
| 558 | { | 544 | { |
| 559 | case "applicationLevel": | 545 | case "applicationLevel": |
| @@ -572,7 +558,7 @@ namespace WixToolset.ComPlus | |||
| 572 | { | 558 | { |
| 573 | this.Messaging.Write(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 559 | this.Messaging.Write(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); |
| 574 | } | 560 | } |
| 575 | string activationValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 561 | var activationValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 576 | switch (activationValue) | 562 | switch (activationValue) |
| 577 | { | 563 | { |
| 578 | case "inproc": | 564 | case "inproc": |
| @@ -639,7 +625,7 @@ namespace WixToolset.ComPlus | |||
| 639 | { | 625 | { |
| 640 | this.Messaging.Write(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 626 | this.Messaging.Write(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); |
| 641 | } | 627 | } |
| 642 | string authenticationCapabilityValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 628 | var authenticationCapabilityValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 643 | switch (authenticationCapabilityValue) | 629 | switch (authenticationCapabilityValue) |
| 644 | { | 630 | { |
| 645 | case "none": | 631 | case "none": |
| @@ -938,7 +924,7 @@ namespace WixToolset.ComPlus | |||
| 938 | { | 924 | { |
| 939 | this.Messaging.Write(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); | 925 | this.Messaging.Write(ComPlusErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); |
| 940 | } | 926 | } |
| 941 | string srpTrustLevelValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 927 | var srpTrustLevelValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 942 | switch (srpTrustLevelValue) | 928 | switch (srpTrustLevelValue) |
| 943 | { | 929 | { |
| 944 | case "disallowed": | 930 | case "disallowed": |
| @@ -972,17 +958,17 @@ namespace WixToolset.ComPlus | |||
| 972 | this.Messaging.Write(ComPlusErrors.RequiredAttributeNotUnderComponent(sourceLineNumbers, node.Name.LocalName, "Id", "Name")); | 958 | this.Messaging.Write(ComPlusErrors.RequiredAttributeNotUnderComponent(sourceLineNumbers, node.Name.LocalName, "Id", "Name")); |
| 973 | } | 959 | } |
| 974 | 960 | ||
| 975 | foreach (XElement child in node.Elements()) | 961 | foreach (var child in node.Elements()) |
| 976 | { | 962 | { |
| 977 | if (this.Namespace == child.Name.Namespace) | 963 | if (this.Namespace == child.Name.Namespace) |
| 978 | { | 964 | { |
| 979 | switch (child.Name.LocalName) | 965 | switch (child.Name.LocalName) |
| 980 | { | 966 | { |
| 981 | case "ComPlusApplicationRole": | 967 | case "ComPlusApplicationRole": |
| 982 | this.ParseComPlusApplicationRoleElement(intermediate, section, child, componentKey, key); | 968 | this.ParseComPlusApplicationRoleElement(intermediate, section, child, componentKey, key?.Id); |
| 983 | break; | 969 | break; |
| 984 | case "ComPlusAssembly": | 970 | case "ComPlusAssembly": |
| 985 | this.ParseComPlusAssemblyElement(intermediate, section, child, componentKey, win64, key); | 971 | this.ParseComPlusAssemblyElement(intermediate, section, child, componentKey, win64, key?.Id); |
| 986 | break; | 972 | break; |
| 987 | default: | 973 | default: |
| 988 | this.ParseHelper.UnexpectedElement(node, child); | 974 | this.ParseHelper.UnexpectedElement(node, child); |
| @@ -995,41 +981,27 @@ namespace WixToolset.ComPlus | |||
| 995 | } | 981 | } |
| 996 | } | 982 | } |
| 997 | 983 | ||
| 998 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusApplication"); | 984 | section.AddTuple(new ComPlusApplicationTuple(sourceLineNumbers, key) |
| 999 | row.Set(0, key); | 985 | { |
| 1000 | row.Set(1, partitionKey); | 986 | PartitionRef = partitionKey, |
| 1001 | row.Set(2, componentKey); | 987 | ComponentRef = componentKey, |
| 1002 | row.Set(3, id); | 988 | ApplicationId = id, |
| 1003 | row.Set(4, name); | 989 | Name = name, |
| 990 | }); | ||
| 1004 | 991 | ||
| 1005 | IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); | 992 | foreach (var kvp in properties) |
| 1006 | while (propertiesEnumerator.MoveNext()) | ||
| 1007 | { | 993 | { |
| 1008 | var propertyRow = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusApplicationProperty"); | 994 | section.AddTuple(new ComPlusApplicationPropertyTuple(sourceLineNumbers) |
| 1009 | propertyRow.Set(0, key); | 995 | { |
| 1010 | propertyRow.Set(1, (string)propertiesEnumerator.Key); | 996 | ApplicationRef = key?.Id, |
| 1011 | propertyRow.Set(2, (string)propertiesEnumerator.Value); | 997 | Name = kvp.Key, |
| 998 | Value = kvp.Value, | ||
| 999 | }); | ||
| 1012 | } | 1000 | } |
| 1013 | 1001 | ||
| 1014 | if (componentKey != null) | 1002 | if (componentKey != null) |
| 1015 | { | 1003 | { |
| 1016 | if (win64) | 1004 | this.AddReferenceToConfigureComPlus(section, sourceLineNumbers, node.Name.LocalName, win64); |
| 1017 | { | ||
| 1018 | if (this.Context.Platform == Platform.IA64) | ||
| 1019 | { | ||
| 1020 | this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, "ia64", node.Name.LocalName)); | ||
| 1021 | } | ||
| 1022 | else | ||
| 1023 | { | ||
| 1024 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall_x64"); | ||
| 1025 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall_x64"); | ||
| 1026 | } | ||
| 1027 | } | ||
| 1028 | else | ||
| 1029 | { | ||
| 1030 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall"); | ||
| 1031 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall"); | ||
| 1032 | } | ||
| 1033 | } | 1005 | } |
| 1034 | } | 1006 | } |
| 1035 | 1007 | ||
| @@ -1041,21 +1013,21 @@ namespace WixToolset.ComPlus | |||
| 1041 | /// <param name="applicationKey">Optional identifier of parent application.</param> | 1013 | /// <param name="applicationKey">Optional identifier of parent application.</param> |
| 1042 | private void ParseComPlusApplicationRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string applicationKey) | 1014 | private void ParseComPlusApplicationRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string applicationKey) |
| 1043 | { | 1015 | { |
| 1044 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1016 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1045 | 1017 | ||
| 1046 | string key = null; | 1018 | Identifier key = null; |
| 1047 | string name = null; | 1019 | string name = null; |
| 1048 | 1020 | ||
| 1049 | Hashtable properties = new Hashtable(); | 1021 | var properties = new Dictionary<string, string>(); |
| 1050 | 1022 | ||
| 1051 | foreach (XAttribute attrib in node.Attributes()) | 1023 | foreach (var attrib in node.Attributes()) |
| 1052 | { | 1024 | { |
| 1053 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1025 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1054 | { | 1026 | { |
| 1055 | switch (attrib.Name.LocalName) | 1027 | switch (attrib.Name.LocalName) |
| 1056 | { | 1028 | { |
| 1057 | case "Id": | 1029 | case "Id": |
| 1058 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1030 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1059 | break; | 1031 | break; |
| 1060 | case "Application": | 1032 | case "Application": |
| 1061 | if (null != applicationKey) | 1033 | if (null != applicationKey) |
| @@ -1063,7 +1035,7 @@ namespace WixToolset.ComPlus | |||
| 1063 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 1035 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 1064 | } | 1036 | } |
| 1065 | applicationKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1037 | applicationKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1066 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusApplication", applicationKey); | 1038 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusApplication, applicationKey); |
| 1067 | break; | 1039 | break; |
| 1068 | case "Name": | 1040 | case "Name": |
| 1069 | name = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1041 | name = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -1091,17 +1063,17 @@ namespace WixToolset.ComPlus | |||
| 1091 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Application")); | 1063 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Application")); |
| 1092 | } | 1064 | } |
| 1093 | 1065 | ||
| 1094 | foreach (XElement child in node.Elements()) | 1066 | foreach (var child in node.Elements()) |
| 1095 | { | 1067 | { |
| 1096 | if (this.Namespace == child.Name.Namespace) | 1068 | if (this.Namespace == child.Name.Namespace) |
| 1097 | { | 1069 | { |
| 1098 | switch (child.Name.LocalName) | 1070 | switch (child.Name.LocalName) |
| 1099 | { | 1071 | { |
| 1100 | case "ComPlusUserInApplicationRole": | 1072 | case "ComPlusUserInApplicationRole": |
| 1101 | this.ParseComPlusUserInApplicationRoleElement(intermediate, section, child, componentKey, key); | 1073 | this.ParseComPlusUserInApplicationRoleElement(intermediate, section, child, componentKey, key?.Id); |
| 1102 | break; | 1074 | break; |
| 1103 | case "ComPlusGroupInApplicationRole": | 1075 | case "ComPlusGroupInApplicationRole": |
| 1104 | this.ParseComPlusGroupInApplicationRoleElement(intermediate, section, child, componentKey, key); | 1076 | this.ParseComPlusGroupInApplicationRoleElement(intermediate, section, child, componentKey, key?.Id); |
| 1105 | break; | 1077 | break; |
| 1106 | default: | 1078 | default: |
| 1107 | this.ParseHelper.UnexpectedElement(node, child); | 1079 | this.ParseHelper.UnexpectedElement(node, child); |
| @@ -1114,19 +1086,21 @@ namespace WixToolset.ComPlus | |||
| 1114 | } | 1086 | } |
| 1115 | } | 1087 | } |
| 1116 | 1088 | ||
| 1117 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusApplicationRole"); | 1089 | section.AddTuple(new ComPlusApplicationRoleTuple(sourceLineNumbers, key) |
| 1118 | row.Set(0, key); | 1090 | { |
| 1119 | row.Set(1, applicationKey); | 1091 | ApplicationRef = applicationKey, |
| 1120 | row.Set(2, componentKey); | 1092 | ComponentRef = componentKey, |
| 1121 | row.Set(3, name); | 1093 | Name = name, |
| 1094 | }); | ||
| 1122 | 1095 | ||
| 1123 | IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); | 1096 | foreach (var kvp in properties) |
| 1124 | while (propertiesEnumerator.MoveNext()) | ||
| 1125 | { | 1097 | { |
| 1126 | var propertyRow = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusApplicationRoleProperty"); | 1098 | section.AddTuple(new ComPlusApplicationRolePropertyTuple(sourceLineNumbers) |
| 1127 | propertyRow.Set(0, key); | 1099 | { |
| 1128 | propertyRow.Set(1, (string)propertiesEnumerator.Key); | 1100 | ApplicationRoleRef = key?.Id, |
| 1129 | propertyRow.Set(2, (string)propertiesEnumerator.Value); | 1101 | Name = kvp.Key, |
| 1102 | Value = kvp.Value, | ||
| 1103 | }); | ||
| 1130 | } | 1104 | } |
| 1131 | } | 1105 | } |
| 1132 | 1106 | ||
| @@ -1138,19 +1112,19 @@ namespace WixToolset.ComPlus | |||
| 1138 | /// <param name="applicationKey">Optional identifier of parent application role.</param> | 1112 | /// <param name="applicationKey">Optional identifier of parent application role.</param> |
| 1139 | private void ParseComPlusUserInApplicationRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string applicationRoleKey) | 1113 | private void ParseComPlusUserInApplicationRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string applicationRoleKey) |
| 1140 | { | 1114 | { |
| 1141 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1115 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1142 | 1116 | ||
| 1143 | string key = null; | 1117 | Identifier key = null; |
| 1144 | string user = null; | 1118 | string user = null; |
| 1145 | 1119 | ||
| 1146 | foreach (XAttribute attrib in node.Attributes()) | 1120 | foreach (var attrib in node.Attributes()) |
| 1147 | { | 1121 | { |
| 1148 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1122 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1149 | { | 1123 | { |
| 1150 | switch (attrib.Name.LocalName) | 1124 | switch (attrib.Name.LocalName) |
| 1151 | { | 1125 | { |
| 1152 | case "Id": | 1126 | case "Id": |
| 1153 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1127 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1154 | break; | 1128 | break; |
| 1155 | case "ApplicationRole": | 1129 | case "ApplicationRole": |
| 1156 | if (null != applicationRoleKey) | 1130 | if (null != applicationRoleKey) |
| @@ -1158,7 +1132,7 @@ namespace WixToolset.ComPlus | |||
| 1158 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 1132 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 1159 | } | 1133 | } |
| 1160 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1134 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1161 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusApplicationRole", applicationRoleKey); | 1135 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusApplicationRole, applicationRoleKey); |
| 1162 | break; | 1136 | break; |
| 1163 | case "User": | 1137 | case "User": |
| 1164 | user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1138 | user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -1180,11 +1154,12 @@ namespace WixToolset.ComPlus | |||
| 1180 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ApplicationRole")); | 1154 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ApplicationRole")); |
| 1181 | } | 1155 | } |
| 1182 | 1156 | ||
| 1183 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusUserInApplicationRole"); | 1157 | section.AddTuple(new ComPlusUserInApplicationRoleTuple(sourceLineNumbers, key) |
| 1184 | row.Set(0, key); | 1158 | { |
| 1185 | row.Set(1, applicationRoleKey); | 1159 | ApplicationRoleRef = applicationRoleKey, |
| 1186 | row.Set(2, componentKey); | 1160 | ComponentRef = componentKey, |
| 1187 | row.Set(3, user); | 1161 | UserRef = user, |
| 1162 | }); | ||
| 1188 | } | 1163 | } |
| 1189 | 1164 | ||
| 1190 | /// <summary> | 1165 | /// <summary> |
| @@ -1195,19 +1170,19 @@ namespace WixToolset.ComPlus | |||
| 1195 | /// <param name="applicationKey">Optional identifier of parent application role.</param> | 1170 | /// <param name="applicationKey">Optional identifier of parent application role.</param> |
| 1196 | private void ParseComPlusGroupInApplicationRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string applicationRoleKey) | 1171 | private void ParseComPlusGroupInApplicationRoleElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string applicationRoleKey) |
| 1197 | { | 1172 | { |
| 1198 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1173 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1199 | 1174 | ||
| 1200 | string key = null; | 1175 | Identifier key = null; |
| 1201 | string group = null; | 1176 | string group = null; |
| 1202 | 1177 | ||
| 1203 | foreach (XAttribute attrib in node.Attributes()) | 1178 | foreach (var attrib in node.Attributes()) |
| 1204 | { | 1179 | { |
| 1205 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1180 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1206 | { | 1181 | { |
| 1207 | switch (attrib.Name.LocalName) | 1182 | switch (attrib.Name.LocalName) |
| 1208 | { | 1183 | { |
| 1209 | case "Id": | 1184 | case "Id": |
| 1210 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1185 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1211 | break; | 1186 | break; |
| 1212 | case "ApplicationRole": | 1187 | case "ApplicationRole": |
| 1213 | if (null != applicationRoleKey) | 1188 | if (null != applicationRoleKey) |
| @@ -1215,7 +1190,7 @@ namespace WixToolset.ComPlus | |||
| 1215 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 1190 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 1216 | } | 1191 | } |
| 1217 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1192 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1218 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusApplicationRole", applicationRoleKey); | 1193 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusApplicationRole, applicationRoleKey); |
| 1219 | break; | 1194 | break; |
| 1220 | case "Group": | 1195 | case "Group": |
| 1221 | group = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1196 | group = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -1237,11 +1212,12 @@ namespace WixToolset.ComPlus | |||
| 1237 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ApplicationRole")); | 1212 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ApplicationRole")); |
| 1238 | } | 1213 | } |
| 1239 | 1214 | ||
| 1240 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusGroupInApplicationRole"); | 1215 | section.AddTuple(new ComPlusGroupInApplicationRoleTuple(sourceLineNumbers, key) |
| 1241 | row.Set(0, key); | 1216 | { |
| 1242 | row.Set(1, applicationRoleKey); | 1217 | ApplicationRoleRef = applicationRoleKey, |
| 1243 | row.Set(2, componentKey); | 1218 | ComponentRef = componentKey, |
| 1244 | row.Set(3, group); | 1219 | GroupRef = group, |
| 1220 | }); | ||
| 1245 | } | 1221 | } |
| 1246 | 1222 | ||
| 1247 | /// <summary> | 1223 | /// <summary> |
| @@ -1252,25 +1228,25 @@ namespace WixToolset.ComPlus | |||
| 1252 | /// <param name="applicationKey">Optional identifier of parent application.</param> | 1228 | /// <param name="applicationKey">Optional identifier of parent application.</param> |
| 1253 | private void ParseComPlusAssemblyElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, bool win64, string applicationKey) | 1229 | private void ParseComPlusAssemblyElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, bool win64, string applicationKey) |
| 1254 | { | 1230 | { |
| 1255 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1231 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1256 | 1232 | ||
| 1257 | string key = null; | 1233 | Identifier key = null; |
| 1258 | string assemblyName = null; | 1234 | string assemblyName = null; |
| 1259 | string dllPath = null; | 1235 | string dllPath = null; |
| 1260 | string tlbPath = null; | 1236 | string tlbPath = null; |
| 1261 | string psDllPath = null; | 1237 | string psDllPath = null; |
| 1262 | int attributes = 0; | 1238 | int attributes = 0; |
| 1263 | 1239 | ||
| 1264 | bool hasComponents = false; | 1240 | var hasComponents = false; |
| 1265 | 1241 | ||
| 1266 | foreach (XAttribute attrib in node.Attributes()) | 1242 | foreach (var attrib in node.Attributes()) |
| 1267 | { | 1243 | { |
| 1268 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1244 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1269 | { | 1245 | { |
| 1270 | switch (attrib.Name.LocalName) | 1246 | switch (attrib.Name.LocalName) |
| 1271 | { | 1247 | { |
| 1272 | case "Id": | 1248 | case "Id": |
| 1273 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1249 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1274 | break; | 1250 | break; |
| 1275 | case "Application": | 1251 | case "Application": |
| 1276 | if (null != applicationKey) | 1252 | if (null != applicationKey) |
| @@ -1278,7 +1254,7 @@ namespace WixToolset.ComPlus | |||
| 1278 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 1254 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 1279 | } | 1255 | } |
| 1280 | applicationKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1256 | applicationKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1281 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusApplication", applicationKey); | 1257 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusApplication, applicationKey); |
| 1282 | break; | 1258 | break; |
| 1283 | case "AssemblyName": | 1259 | case "AssemblyName": |
| 1284 | assemblyName = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1260 | assemblyName = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -1369,17 +1345,17 @@ namespace WixToolset.ComPlus | |||
| 1369 | this.Messaging.Write(ComPlusErrors.UnexpectedAttributeWithOtherValue(sourceLineNumbers, node.Name.LocalName, "EventClass", "yes", "Type", ".net")); | 1345 | this.Messaging.Write(ComPlusErrors.UnexpectedAttributeWithOtherValue(sourceLineNumbers, node.Name.LocalName, "EventClass", "yes", "Type", ".net")); |
| 1370 | } | 1346 | } |
| 1371 | 1347 | ||
| 1372 | foreach (XElement child in node.Elements()) | 1348 | foreach (var child in node.Elements()) |
| 1373 | { | 1349 | { |
| 1374 | if (this.Namespace == child.Name.Namespace) | 1350 | if (this.Namespace == child.Name.Namespace) |
| 1375 | { | 1351 | { |
| 1376 | switch (child.Name.LocalName) | 1352 | switch (child.Name.LocalName) |
| 1377 | { | 1353 | { |
| 1378 | case "ComPlusAssemblyDependency": | 1354 | case "ComPlusAssemblyDependency": |
| 1379 | this.ParseComPlusAssemblyDependencyElement(intermediate, section, child, key); | 1355 | this.ParseComPlusAssemblyDependencyElement(intermediate, section, child, key?.Id); |
| 1380 | break; | 1356 | break; |
| 1381 | case "ComPlusComponent": | 1357 | case "ComPlusComponent": |
| 1382 | this.ParseComPlusComponentElement(intermediate, section, child, componentKey, key); | 1358 | this.ParseComPlusComponentElement(intermediate, section, child, componentKey, key?.Id); |
| 1383 | hasComponents = true; | 1359 | hasComponents = true; |
| 1384 | break; | 1360 | break; |
| 1385 | default: | 1361 | default: |
| @@ -1398,33 +1374,18 @@ namespace WixToolset.ComPlus | |||
| 1398 | this.Messaging.Write(ComPlusWarnings.MissingComponents(sourceLineNumbers)); | 1374 | this.Messaging.Write(ComPlusWarnings.MissingComponents(sourceLineNumbers)); |
| 1399 | } | 1375 | } |
| 1400 | 1376 | ||
| 1401 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusAssembly"); | 1377 | section.AddTuple(new ComPlusAssemblyTuple(sourceLineNumbers, key) |
| 1402 | row.Set(0, key); | ||
| 1403 | row.Set(1, applicationKey); | ||
| 1404 | row.Set(2, componentKey); | ||
| 1405 | row.Set(3, assemblyName); | ||
| 1406 | row.Set(4, dllPath); | ||
| 1407 | row.Set(5, tlbPath); | ||
| 1408 | row.Set(6, psDllPath); | ||
| 1409 | row.Set(7, attributes); | ||
| 1410 | |||
| 1411 | if (win64) | ||
| 1412 | { | ||
| 1413 | if (this.Context.Platform == Platform.IA64) | ||
| 1414 | { | ||
| 1415 | this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, "ia64", node.Name.LocalName)); | ||
| 1416 | } | ||
| 1417 | else | ||
| 1418 | { | ||
| 1419 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall_x64"); | ||
| 1420 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall_x64"); | ||
| 1421 | } | ||
| 1422 | } | ||
| 1423 | else | ||
| 1424 | { | 1378 | { |
| 1425 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall"); | 1379 | ApplicationRef = applicationKey, |
| 1426 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall"); | 1380 | ComponentRef = componentKey, |
| 1427 | } | 1381 | AssemblyName = assemblyName, |
| 1382 | DllPath = dllPath, | ||
| 1383 | TlbPath = tlbPath, | ||
| 1384 | PSDllPath = psDllPath, | ||
| 1385 | Attributes = attributes, | ||
| 1386 | }); | ||
| 1387 | |||
| 1388 | this.AddReferenceToConfigureComPlus(section, sourceLineNumbers, node.Name.LocalName, win64); | ||
| 1428 | } | 1389 | } |
| 1429 | 1390 | ||
| 1430 | /// <summary> | 1391 | /// <summary> |
| @@ -1434,11 +1395,11 @@ namespace WixToolset.ComPlus | |||
| 1434 | /// <param name="assemblyKey">Identifier of parent assembly.</param> | 1395 | /// <param name="assemblyKey">Identifier of parent assembly.</param> |
| 1435 | private void ParseComPlusAssemblyDependencyElement(Intermediate intermediate, IntermediateSection section, XElement node, string assemblyKey) | 1396 | private void ParseComPlusAssemblyDependencyElement(Intermediate intermediate, IntermediateSection section, XElement node, string assemblyKey) |
| 1436 | { | 1397 | { |
| 1437 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1398 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1438 | 1399 | ||
| 1439 | string requiredAssemblyKey = null; | 1400 | string requiredAssemblyKey = null; |
| 1440 | 1401 | ||
| 1441 | foreach (XAttribute attrib in node.Attributes()) | 1402 | foreach (var attrib in node.Attributes()) |
| 1442 | { | 1403 | { |
| 1443 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1404 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1444 | { | 1405 | { |
| @@ -1458,9 +1419,11 @@ namespace WixToolset.ComPlus | |||
| 1458 | } | 1419 | } |
| 1459 | } | 1420 | } |
| 1460 | 1421 | ||
| 1461 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusAssemblyDependency"); | 1422 | section.AddTuple(new ComPlusAssemblyDependencyTuple(sourceLineNumbers) |
| 1462 | row.Set(0, assemblyKey); | 1423 | { |
| 1463 | row.Set(1, requiredAssemblyKey); | 1424 | AssemblyRef = assemblyKey, |
| 1425 | RequiredAssemblyRef = requiredAssemblyKey, | ||
| 1426 | }); | ||
| 1464 | } | 1427 | } |
| 1465 | 1428 | ||
| 1466 | /// <summary> | 1429 | /// <summary> |
| @@ -1471,21 +1434,21 @@ namespace WixToolset.ComPlus | |||
| 1471 | /// <param name="assemblyKey">Identifier of parent assembly.</param> | 1434 | /// <param name="assemblyKey">Identifier of parent assembly.</param> |
| 1472 | private void ParseComPlusComponentElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string assemblyKey) | 1435 | private void ParseComPlusComponentElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string assemblyKey) |
| 1473 | { | 1436 | { |
| 1474 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1437 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1475 | 1438 | ||
| 1476 | string key = null; | 1439 | Identifier key = null; |
| 1477 | string clsid = null; | 1440 | string clsid = null; |
| 1478 | 1441 | ||
| 1479 | Hashtable properties = new Hashtable(); | 1442 | var properties = new Dictionary<string, string>(); |
| 1480 | 1443 | ||
| 1481 | foreach (XAttribute attrib in node.Attributes()) | 1444 | foreach (var attrib in node.Attributes()) |
| 1482 | { | 1445 | { |
| 1483 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1446 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1484 | { | 1447 | { |
| 1485 | switch (attrib.Name.LocalName) | 1448 | switch (attrib.Name.LocalName) |
| 1486 | { | 1449 | { |
| 1487 | case "Id": | 1450 | case "Id": |
| 1488 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1451 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1489 | break; | 1452 | break; |
| 1490 | case "CLSID": | 1453 | case "CLSID": |
| 1491 | clsid = "{" + this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib) + "}"; | 1454 | clsid = "{" + this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib) + "}"; |
| @@ -1572,7 +1535,7 @@ namespace WixToolset.ComPlus | |||
| 1572 | properties["SoapTypeName"] = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1535 | properties["SoapTypeName"] = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1573 | break; | 1536 | break; |
| 1574 | case "Synchronization": | 1537 | case "Synchronization": |
| 1575 | string synchronizationValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1538 | var synchronizationValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1576 | switch (synchronizationValue) | 1539 | switch (synchronizationValue) |
| 1577 | { | 1540 | { |
| 1578 | case "ignored": | 1541 | case "ignored": |
| @@ -1596,7 +1559,7 @@ namespace WixToolset.ComPlus | |||
| 1596 | } | 1559 | } |
| 1597 | break; | 1560 | break; |
| 1598 | case "Transaction": | 1561 | case "Transaction": |
| 1599 | string transactionValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1562 | var transactionValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1600 | switch (transactionValue) | 1563 | switch (transactionValue) |
| 1601 | { | 1564 | { |
| 1602 | case "ignored": | 1565 | case "ignored": |
| @@ -1620,7 +1583,7 @@ namespace WixToolset.ComPlus | |||
| 1620 | } | 1583 | } |
| 1621 | break; | 1584 | break; |
| 1622 | case "TxIsolationLevel": | 1585 | case "TxIsolationLevel": |
| 1623 | string txIsolationLevelValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1586 | var txIsolationLevelValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1624 | switch (txIsolationLevelValue) | 1587 | switch (txIsolationLevelValue) |
| 1625 | { | 1588 | { |
| 1626 | case "any": | 1589 | case "any": |
| @@ -1654,20 +1617,20 @@ namespace WixToolset.ComPlus | |||
| 1654 | } | 1617 | } |
| 1655 | } | 1618 | } |
| 1656 | 1619 | ||
| 1657 | foreach (XElement child in node.Elements()) | 1620 | foreach (var child in node.Elements()) |
| 1658 | { | 1621 | { |
| 1659 | if (this.Namespace == child.Name.Namespace) | 1622 | if (this.Namespace == child.Name.Namespace) |
| 1660 | { | 1623 | { |
| 1661 | switch (child.Name.LocalName) | 1624 | switch (child.Name.LocalName) |
| 1662 | { | 1625 | { |
| 1663 | case "ComPlusRoleForComponent": | 1626 | case "ComPlusRoleForComponent": |
| 1664 | this.ParseComPlusRoleForComponentElement(intermediate, section, child, componentKey, key); | 1627 | this.ParseComPlusRoleForComponentElement(intermediate, section, child, componentKey, key?.Id); |
| 1665 | break; | 1628 | break; |
| 1666 | case "ComPlusInterface": | 1629 | case "ComPlusInterface": |
| 1667 | this.ParseComPlusInterfaceElement(intermediate, section, child, componentKey, key); | 1630 | this.ParseComPlusInterfaceElement(intermediate, section, child, componentKey, key?.Id); |
| 1668 | break; | 1631 | break; |
| 1669 | case "ComPlusSubscription": | 1632 | case "ComPlusSubscription": |
| 1670 | this.ParseComPlusSubscriptionElement(intermediate, section, child, componentKey, key); | 1633 | this.ParseComPlusSubscriptionElement(intermediate, section, child, componentKey, key?.Id); |
| 1671 | break; | 1634 | break; |
| 1672 | default: | 1635 | default: |
| 1673 | this.ParseHelper.UnexpectedElement(node, child); | 1636 | this.ParseHelper.UnexpectedElement(node, child); |
| @@ -1680,18 +1643,20 @@ namespace WixToolset.ComPlus | |||
| 1680 | } | 1643 | } |
| 1681 | } | 1644 | } |
| 1682 | 1645 | ||
| 1683 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusComponent"); | 1646 | section.AddTuple(new ComPlusComponentTuple(sourceLineNumbers, key) |
| 1684 | row.Set(0, key); | 1647 | { |
| 1685 | row.Set(1, assemblyKey); | 1648 | AssemblyRef = assemblyKey, |
| 1686 | row.Set(2, clsid); | 1649 | CLSID = clsid, |
| 1650 | }); | ||
| 1687 | 1651 | ||
| 1688 | IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); | 1652 | foreach (var kvp in properties) |
| 1689 | while (propertiesEnumerator.MoveNext()) | ||
| 1690 | { | 1653 | { |
| 1691 | var propertyRow = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusComponentProperty"); | 1654 | section.AddTuple(new ComPlusComponentPropertyTuple(sourceLineNumbers) |
| 1692 | propertyRow.Set(0, key); | 1655 | { |
| 1693 | propertyRow.Set(1, (string)propertiesEnumerator.Key); | 1656 | ComPlusComponentRef = key?.Id, |
| 1694 | propertyRow.Set(2, (string)propertiesEnumerator.Value); | 1657 | Name = kvp.Key, |
| 1658 | Value = kvp.Value, | ||
| 1659 | }); | ||
| 1695 | } | 1660 | } |
| 1696 | } | 1661 | } |
| 1697 | 1662 | ||
| @@ -1703,19 +1668,19 @@ namespace WixToolset.ComPlus | |||
| 1703 | /// <param name="cpcomponentKey">Identifier of parent COM+ component.</param> | 1668 | /// <param name="cpcomponentKey">Identifier of parent COM+ component.</param> |
| 1704 | private void ParseComPlusRoleForComponentElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string cpcomponentKey) | 1669 | private void ParseComPlusRoleForComponentElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string cpcomponentKey) |
| 1705 | { | 1670 | { |
| 1706 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1671 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1707 | 1672 | ||
| 1708 | string key = null; | 1673 | Identifier key = null; |
| 1709 | string applicationRoleKey = null; | 1674 | string applicationRoleKey = null; |
| 1710 | 1675 | ||
| 1711 | foreach (XAttribute attrib in node.Attributes()) | 1676 | foreach (var attrib in node.Attributes()) |
| 1712 | { | 1677 | { |
| 1713 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1678 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1714 | { | 1679 | { |
| 1715 | switch (attrib.Name.LocalName) | 1680 | switch (attrib.Name.LocalName) |
| 1716 | { | 1681 | { |
| 1717 | case "Id": | 1682 | case "Id": |
| 1718 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1683 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1719 | break; | 1684 | break; |
| 1720 | case "Component": | 1685 | case "Component": |
| 1721 | if (null != cpcomponentKey) | 1686 | if (null != cpcomponentKey) |
| @@ -1723,7 +1688,7 @@ namespace WixToolset.ComPlus | |||
| 1723 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 1688 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 1724 | } | 1689 | } |
| 1725 | cpcomponentKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1690 | cpcomponentKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1726 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusComponent", cpcomponentKey); | 1691 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusComponent, cpcomponentKey); |
| 1727 | break; | 1692 | break; |
| 1728 | case "ApplicationRole": | 1693 | case "ApplicationRole": |
| 1729 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1694 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -1744,11 +1709,12 @@ namespace WixToolset.ComPlus | |||
| 1744 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Component")); | 1709 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Component")); |
| 1745 | } | 1710 | } |
| 1746 | 1711 | ||
| 1747 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusRoleForComponent"); | 1712 | section.AddTuple(new ComPlusRoleForComponentTuple(sourceLineNumbers, key) |
| 1748 | row.Set(0, key); | 1713 | { |
| 1749 | row.Set(1, cpcomponentKey); | 1714 | ComPlusComponentRef = cpcomponentKey, |
| 1750 | row.Set(2, applicationRoleKey); | 1715 | ApplicationRoleRef = applicationRoleKey, |
| 1751 | row.Set(3, componentKey); | 1716 | ComponentRef = componentKey, |
| 1717 | }); | ||
| 1752 | } | 1718 | } |
| 1753 | 1719 | ||
| 1754 | /// <summary> | 1720 | /// <summary> |
| @@ -1759,22 +1725,22 @@ namespace WixToolset.ComPlus | |||
| 1759 | /// <param name="cpcomponentKey">Identifier of parent COM+ component.</param> | 1725 | /// <param name="cpcomponentKey">Identifier of parent COM+ component.</param> |
| 1760 | private void ParseComPlusInterfaceElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string cpcomponentKey) | 1726 | private void ParseComPlusInterfaceElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string cpcomponentKey) |
| 1761 | { | 1727 | { |
| 1762 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1728 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1763 | 1729 | ||
| 1764 | // parse attributes | 1730 | // parse attributes |
| 1765 | string key = null; | 1731 | Identifier key = null; |
| 1766 | string iid = null; | 1732 | string iid = null; |
| 1767 | 1733 | ||
| 1768 | Hashtable properties = new Hashtable(); | 1734 | var properties = new Dictionary<string, string>(); |
| 1769 | 1735 | ||
| 1770 | foreach (XAttribute attrib in node.Attributes()) | 1736 | foreach (var attrib in node.Attributes()) |
| 1771 | { | 1737 | { |
| 1772 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1738 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1773 | { | 1739 | { |
| 1774 | switch (attrib.Name.LocalName) | 1740 | switch (attrib.Name.LocalName) |
| 1775 | { | 1741 | { |
| 1776 | case "Id": | 1742 | case "Id": |
| 1777 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1743 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1778 | break; | 1744 | break; |
| 1779 | case "IID": | 1745 | case "IID": |
| 1780 | iid = "{" + this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib) + "}"; | 1746 | iid = "{" + this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib) + "}"; |
| @@ -1796,17 +1762,17 @@ namespace WixToolset.ComPlus | |||
| 1796 | } | 1762 | } |
| 1797 | } | 1763 | } |
| 1798 | 1764 | ||
| 1799 | foreach (XElement child in node.Elements()) | 1765 | foreach (var child in node.Elements()) |
| 1800 | { | 1766 | { |
| 1801 | if (this.Namespace == child.Name.Namespace) | 1767 | if (this.Namespace == child.Name.Namespace) |
| 1802 | { | 1768 | { |
| 1803 | switch (child.Name.LocalName) | 1769 | switch (child.Name.LocalName) |
| 1804 | { | 1770 | { |
| 1805 | case "ComPlusRoleForInterface": | 1771 | case "ComPlusRoleForInterface": |
| 1806 | this.ParseComPlusRoleForInterfaceElement(intermediate, section, child, componentKey, key); | 1772 | this.ParseComPlusRoleForInterfaceElement(intermediate, section, child, componentKey, key?.Id); |
| 1807 | break; | 1773 | break; |
| 1808 | case "ComPlusMethod": | 1774 | case "ComPlusMethod": |
| 1809 | this.ParseComPlusMethodElement(intermediate, section, child, componentKey, key); | 1775 | this.ParseComPlusMethodElement(intermediate, section, child, componentKey, key?.Id); |
| 1810 | break; | 1776 | break; |
| 1811 | default: | 1777 | default: |
| 1812 | this.ParseHelper.UnexpectedElement(node, child); | 1778 | this.ParseHelper.UnexpectedElement(node, child); |
| @@ -1819,18 +1785,20 @@ namespace WixToolset.ComPlus | |||
| 1819 | } | 1785 | } |
| 1820 | } | 1786 | } |
| 1821 | 1787 | ||
| 1822 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusInterface"); | 1788 | section.AddTuple(new ComPlusInterfaceTuple(sourceLineNumbers, key) |
| 1823 | row.Set(0, key); | 1789 | { |
| 1824 | row.Set(1, cpcomponentKey); | 1790 | ComPlusComponentRef = cpcomponentKey, |
| 1825 | row.Set(2, iid); | 1791 | IID = iid, |
| 1792 | }); | ||
| 1826 | 1793 | ||
| 1827 | IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); | 1794 | foreach (var kvp in properties) |
| 1828 | while (propertiesEnumerator.MoveNext()) | ||
| 1829 | { | 1795 | { |
| 1830 | var propertyRow = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusInterfaceProperty"); | 1796 | section.AddTuple(new ComPlusInterfacePropertyTuple(sourceLineNumbers) |
| 1831 | propertyRow.Set(0, key); | 1797 | { |
| 1832 | propertyRow.Set(1, (string)propertiesEnumerator.Key); | 1798 | InterfaceRef = key?.Id, |
| 1833 | propertyRow.Set(2, (string)propertiesEnumerator.Value); | 1799 | Name = kvp.Key, |
| 1800 | Value = kvp.Value, | ||
| 1801 | }); | ||
| 1834 | } | 1802 | } |
| 1835 | } | 1803 | } |
| 1836 | 1804 | ||
| @@ -1842,19 +1810,19 @@ namespace WixToolset.ComPlus | |||
| 1842 | /// <param name="interfaceKey">Identifier of parent interface.</param> | 1810 | /// <param name="interfaceKey">Identifier of parent interface.</param> |
| 1843 | private void ParseComPlusRoleForInterfaceElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string interfaceKey) | 1811 | private void ParseComPlusRoleForInterfaceElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string interfaceKey) |
| 1844 | { | 1812 | { |
| 1845 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1813 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1846 | 1814 | ||
| 1847 | string key = null; | 1815 | Identifier key = null; |
| 1848 | string applicationRoleKey = null; | 1816 | string applicationRoleKey = null; |
| 1849 | 1817 | ||
| 1850 | foreach (XAttribute attrib in node.Attributes()) | 1818 | foreach (var attrib in node.Attributes()) |
| 1851 | { | 1819 | { |
| 1852 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1820 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1853 | { | 1821 | { |
| 1854 | switch (attrib.Name.LocalName) | 1822 | switch (attrib.Name.LocalName) |
| 1855 | { | 1823 | { |
| 1856 | case "Id": | 1824 | case "Id": |
| 1857 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1825 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1858 | break; | 1826 | break; |
| 1859 | case "Interface": | 1827 | case "Interface": |
| 1860 | if (null != interfaceKey) | 1828 | if (null != interfaceKey) |
| @@ -1862,7 +1830,7 @@ namespace WixToolset.ComPlus | |||
| 1862 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 1830 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 1863 | } | 1831 | } |
| 1864 | interfaceKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1832 | interfaceKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 1865 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusInterface", interfaceKey); | 1833 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusInterface, interfaceKey); |
| 1866 | break; | 1834 | break; |
| 1867 | case "ApplicationRole": | 1835 | case "ApplicationRole": |
| 1868 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1836 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -1883,11 +1851,12 @@ namespace WixToolset.ComPlus | |||
| 1883 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Interface")); | 1851 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Interface")); |
| 1884 | } | 1852 | } |
| 1885 | 1853 | ||
| 1886 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusRoleForInterface"); | 1854 | section.AddTuple(new ComPlusRoleForInterfaceTuple(sourceLineNumbers, key) |
| 1887 | row.Set(0, key); | 1855 | { |
| 1888 | row.Set(1, interfaceKey); | 1856 | InterfaceRef = interfaceKey, |
| 1889 | row.Set(2, applicationRoleKey); | 1857 | ApplicationRoleRef = applicationRoleKey, |
| 1890 | row.Set(3, componentKey); | 1858 | ComponentRef = componentKey, |
| 1859 | }); | ||
| 1891 | } | 1860 | } |
| 1892 | 1861 | ||
| 1893 | /// <summary> | 1862 | /// <summary> |
| @@ -1898,22 +1867,22 @@ namespace WixToolset.ComPlus | |||
| 1898 | /// <param name="interfaceKey">Identifier of parent interface.</param> | 1867 | /// <param name="interfaceKey">Identifier of parent interface.</param> |
| 1899 | private void ParseComPlusMethodElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string interfaceKey) | 1868 | private void ParseComPlusMethodElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string interfaceKey) |
| 1900 | { | 1869 | { |
| 1901 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1870 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1902 | 1871 | ||
| 1903 | string key = null; | 1872 | Identifier key = null; |
| 1904 | int index = CompilerConstants.IntegerNotSet; | 1873 | var index = CompilerConstants.IntegerNotSet; |
| 1905 | string name = null; | 1874 | string name = null; |
| 1906 | 1875 | ||
| 1907 | Hashtable properties = new Hashtable(); | 1876 | var properties = new Dictionary<string, string>(); |
| 1908 | 1877 | ||
| 1909 | foreach (XAttribute attrib in node.Attributes()) | 1878 | foreach (var attrib in node.Attributes()) |
| 1910 | { | 1879 | { |
| 1911 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1880 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 1912 | { | 1881 | { |
| 1913 | switch (attrib.Name.LocalName) | 1882 | switch (attrib.Name.LocalName) |
| 1914 | { | 1883 | { |
| 1915 | case "Id": | 1884 | case "Id": |
| 1916 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1885 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 1917 | break; | 1886 | break; |
| 1918 | case "Index": | 1887 | case "Index": |
| 1919 | index = this.ParseHelper.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); | 1888 | index = this.ParseHelper.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, int.MaxValue); |
| @@ -1938,14 +1907,14 @@ namespace WixToolset.ComPlus | |||
| 1938 | } | 1907 | } |
| 1939 | } | 1908 | } |
| 1940 | 1909 | ||
| 1941 | foreach (XElement child in node.Elements()) | 1910 | foreach (var child in node.Elements()) |
| 1942 | { | 1911 | { |
| 1943 | if (this.Namespace == child.Name.Namespace) | 1912 | if (this.Namespace == child.Name.Namespace) |
| 1944 | { | 1913 | { |
| 1945 | switch (child.Name.LocalName) | 1914 | switch (child.Name.LocalName) |
| 1946 | { | 1915 | { |
| 1947 | case "ComPlusRoleForMethod": | 1916 | case "ComPlusRoleForMethod": |
| 1948 | this.ParseComPlusRoleForMethodElement(intermediate, section, child, componentKey, key); | 1917 | this.ParseComPlusRoleForMethodElement(intermediate, section, child, componentKey, key?.Id); |
| 1949 | break; | 1918 | break; |
| 1950 | default: | 1919 | default: |
| 1951 | this.ParseHelper.UnexpectedElement(node, child); | 1920 | this.ParseHelper.UnexpectedElement(node, child); |
| @@ -1963,22 +1932,25 @@ namespace WixToolset.ComPlus | |||
| 1963 | this.Messaging.Write(ComPlusErrors.RequiredAttribute(sourceLineNumbers, node.Name.LocalName, "Index", "Name")); | 1932 | this.Messaging.Write(ComPlusErrors.RequiredAttribute(sourceLineNumbers, node.Name.LocalName, "Index", "Name")); |
| 1964 | } | 1933 | } |
| 1965 | 1934 | ||
| 1966 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusMethod"); | 1935 | var tuple = section.AddTuple(new ComPlusMethodTuple(sourceLineNumbers, key) |
| 1967 | row.Set(0, key); | 1936 | { |
| 1968 | row.Set(1, interfaceKey); | 1937 | InterfaceRef = interfaceKey, |
| 1938 | Name = name, | ||
| 1939 | }); | ||
| 1940 | |||
| 1969 | if (CompilerConstants.IntegerNotSet != index) | 1941 | if (CompilerConstants.IntegerNotSet != index) |
| 1970 | { | 1942 | { |
| 1971 | row.Set(2, index); | 1943 | tuple.Index = index; |
| 1972 | } | 1944 | } |
| 1973 | row.Set(3, name); | ||
| 1974 | 1945 | ||
| 1975 | IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); | 1946 | foreach (var kvp in properties) |
| 1976 | while (propertiesEnumerator.MoveNext()) | ||
| 1977 | { | 1947 | { |
| 1978 | var propertyRow = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusMethodProperty"); | 1948 | section.AddTuple(new ComPlusMethodPropertyTuple(sourceLineNumbers) |
| 1979 | propertyRow.Set(0, key); | 1949 | { |
| 1980 | propertyRow.Set(1, (string)propertiesEnumerator.Key); | 1950 | MethodRef = key?.Id, |
| 1981 | propertyRow.Set(2, (string)propertiesEnumerator.Value); | 1951 | Name = kvp.Key, |
| 1952 | Value = kvp.Value, | ||
| 1953 | }); | ||
| 1982 | } | 1954 | } |
| 1983 | } | 1955 | } |
| 1984 | 1956 | ||
| @@ -1990,19 +1962,19 @@ namespace WixToolset.ComPlus | |||
| 1990 | /// <param name="methodKey">Identifier of parent method.</param> | 1962 | /// <param name="methodKey">Identifier of parent method.</param> |
| 1991 | private void ParseComPlusRoleForMethodElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string methodKey) | 1963 | private void ParseComPlusRoleForMethodElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string methodKey) |
| 1992 | { | 1964 | { |
| 1993 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 1965 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 1994 | 1966 | ||
| 1995 | string key = null; | 1967 | Identifier key = null; |
| 1996 | string applicationRoleKey = null; | 1968 | string applicationRoleKey = null; |
| 1997 | 1969 | ||
| 1998 | foreach (XAttribute attrib in node.Attributes()) | 1970 | foreach (var attrib in node.Attributes()) |
| 1999 | { | 1971 | { |
| 2000 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 1972 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 2001 | { | 1973 | { |
| 2002 | switch (attrib.Name.LocalName) | 1974 | switch (attrib.Name.LocalName) |
| 2003 | { | 1975 | { |
| 2004 | case "Id": | 1976 | case "Id": |
| 2005 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 1977 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 2006 | break; | 1978 | break; |
| 2007 | case "Method": | 1979 | case "Method": |
| 2008 | if (null != methodKey) | 1980 | if (null != methodKey) |
| @@ -2010,7 +1982,7 @@ namespace WixToolset.ComPlus | |||
| 2010 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 1982 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 2011 | } | 1983 | } |
| 2012 | methodKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1984 | methodKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 2013 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusMethod", methodKey); | 1985 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusMethod, methodKey); |
| 2014 | break; | 1986 | break; |
| 2015 | case "ApplicationRole": | 1987 | case "ApplicationRole": |
| 2016 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1988 | applicationRoleKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| @@ -2031,11 +2003,12 @@ namespace WixToolset.ComPlus | |||
| 2031 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Method")); | 2003 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Method")); |
| 2032 | } | 2004 | } |
| 2033 | 2005 | ||
| 2034 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusRoleForMethod"); | 2006 | section.AddTuple(new ComPlusRoleForMethodTuple(sourceLineNumbers, key) |
| 2035 | row.Set(0, key); | 2007 | { |
| 2036 | row.Set(1, methodKey); | 2008 | MethodRef = methodKey, |
| 2037 | row.Set(2, applicationRoleKey); | 2009 | ApplicationRoleRef = applicationRoleKey, |
| 2038 | row.Set(3, componentKey); | 2010 | ComponentRef = componentKey, |
| 2011 | }); | ||
| 2039 | } | 2012 | } |
| 2040 | 2013 | ||
| 2041 | /// <summary> | 2014 | /// <summary> |
| @@ -2046,24 +2019,24 @@ namespace WixToolset.ComPlus | |||
| 2046 | /// <param name="cpcomponentKey">Identifier of parent COM+ component.</param> | 2019 | /// <param name="cpcomponentKey">Identifier of parent COM+ component.</param> |
| 2047 | private void ParseComPlusSubscriptionElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string cpcomponentKey) | 2020 | private void ParseComPlusSubscriptionElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentKey, string cpcomponentKey) |
| 2048 | { | 2021 | { |
| 2049 | SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); | 2022 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); |
| 2050 | 2023 | ||
| 2051 | string key = null; | 2024 | Identifier key = null; |
| 2052 | string id = null; | 2025 | string id = null; |
| 2053 | string name = null; | 2026 | string name = null; |
| 2054 | string eventCLSID = null; | 2027 | string eventCLSID = null; |
| 2055 | string publisherID = null; | 2028 | string publisherID = null; |
| 2056 | 2029 | ||
| 2057 | Hashtable properties = new Hashtable(); | 2030 | var properties = new Dictionary<string, string>(); |
| 2058 | 2031 | ||
| 2059 | foreach (XAttribute attrib in node.Attributes()) | 2032 | foreach (var attrib in node.Attributes()) |
| 2060 | { | 2033 | { |
| 2061 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | 2034 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) |
| 2062 | { | 2035 | { |
| 2063 | switch (attrib.Name.LocalName) | 2036 | switch (attrib.Name.LocalName) |
| 2064 | { | 2037 | { |
| 2065 | case "Id": | 2038 | case "Id": |
| 2066 | key = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 2039 | key = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); |
| 2067 | break; | 2040 | break; |
| 2068 | case "Component": | 2041 | case "Component": |
| 2069 | if (null != cpcomponentKey) | 2042 | if (null != cpcomponentKey) |
| @@ -2071,7 +2044,7 @@ namespace WixToolset.ComPlus | |||
| 2071 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); | 2044 | this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName)); |
| 2072 | } | 2045 | } |
| 2073 | cpcomponentKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 2046 | cpcomponentKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
| 2074 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "ComPlusComponent", cpcomponentKey); | 2047 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, ComPlusTupleDefinitions.ComPlusComponent, cpcomponentKey); |
| 2075 | break; | 2048 | break; |
| 2076 | case "SubscriptionId": | 2049 | case "SubscriptionId": |
| 2077 | id = this.TryFormatGuidValue(this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib)); | 2050 | id = this.TryFormatGuidValue(this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib)); |
| @@ -2136,22 +2109,25 @@ namespace WixToolset.ComPlus | |||
| 2136 | 2109 | ||
| 2137 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); | 2110 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); |
| 2138 | 2111 | ||
| 2139 | var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusSubscription"); | 2112 | section.AddTuple(new ComPlusSubscriptionTuple(sourceLineNumbers, key) |
| 2140 | row.Set(0, key); | 2113 | { |
| 2141 | row.Set(1, cpcomponentKey); | 2114 | Subscription = key?.Id, |
| 2142 | row.Set(2, componentKey); | 2115 | ComPlusComponentRef = cpcomponentKey, |
| 2143 | row.Set(3, id); | 2116 | ComponentRef = componentKey, |
| 2144 | row.Set(4, name); | 2117 | SubscriptionId = id, |
| 2145 | row.Set(5, eventCLSID); | 2118 | Name = name, |
| 2146 | row.Set(6, publisherID); | 2119 | EventCLSID = eventCLSID, |
| 2147 | 2120 | PublisherID = publisherID, | |
| 2148 | IDictionaryEnumerator propertiesEnumerator = properties.GetEnumerator(); | 2121 | }); |
| 2149 | while (propertiesEnumerator.MoveNext()) | 2122 | |
| 2150 | { | 2123 | foreach (var kvp in properties) |
| 2151 | var propertyRow = this.ParseHelper.CreateRow(section, sourceLineNumbers, "ComPlusSubscriptionProperty"); | 2124 | { |
| 2152 | propertyRow.Set(0, key); | 2125 | section.AddTuple(new ComPlusSubscriptionPropertyTuple(sourceLineNumbers) |
| 2153 | propertyRow.Set(1, (string)propertiesEnumerator.Key); | 2126 | { |
| 2154 | propertyRow.Set(2, (string)propertiesEnumerator.Value); | 2127 | SubscriptionRef = key?.Id, |
| 2128 | Name = kvp.Key, | ||
| 2129 | Value = kvp.Value, | ||
| 2130 | }); | ||
| 2155 | } | 2131 | } |
| 2156 | } | 2132 | } |
| 2157 | 2133 | ||
| @@ -2161,21 +2137,35 @@ namespace WixToolset.ComPlus | |||
| 2161 | /// </summary> | 2137 | /// </summary> |
| 2162 | /// <param name="val"></param> | 2138 | /// <param name="val"></param> |
| 2163 | /// <returns></returns> | 2139 | /// <returns></returns> |
| 2164 | string TryFormatGuidValue(string val) | 2140 | private string TryFormatGuidValue(string val) |
| 2165 | { | 2141 | { |
| 2166 | try | 2142 | if (!Guid.TryParse(val, out var guid)) |
| 2167 | { | 2143 | { |
| 2168 | Guid guid = new Guid(val); | 2144 | return val; |
| 2169 | return guid.ToString("B").ToUpper(); | ||
| 2170 | } | 2145 | } |
| 2171 | catch (FormatException) | 2146 | return guid.ToString("B").ToUpper(); |
| 2147 | } | ||
| 2148 | |||
| 2149 | private void AddReferenceToConfigureComPlus(IntermediateSection section, SourceLineNumber sourceLineNumbers, string elementName, bool win64) | ||
| 2150 | { | ||
| 2151 | if (win64) | ||
| 2172 | { | 2152 | { |
| 2173 | return val; | 2153 | if (this.Context.Platform == Platform.IA64) |
| 2154 | { | ||
| 2155 | this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, "ia64", elementName)); | ||
| 2156 | } | ||
| 2157 | else | ||
| 2158 | { | ||
| 2159 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall_x64"); | ||
| 2160 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall_x64"); | ||
| 2161 | } | ||
| 2174 | } | 2162 | } |
| 2175 | catch (OverflowException) | 2163 | else |
| 2176 | { | 2164 | { |
| 2177 | return val; | 2165 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusInstall"); |
| 2166 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "ConfigureComPlusUninstall"); | ||
| 2178 | } | 2167 | } |
| 2168 | |||
| 2179 | } | 2169 | } |
| 2180 | } | 2170 | } |
| 2181 | } | 2171 | } |
