diff options
Diffstat (limited to 'src/WixToolset.Core/CompilerCore.cs')
| -rw-r--r-- | src/WixToolset.Core/CompilerCore.cs | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs index 51828975..93f9276c 100644 --- a/src/WixToolset.Core/CompilerCore.cs +++ b/src/WixToolset.Core/CompilerCore.cs | |||
| @@ -14,6 +14,7 @@ namespace WixToolset.Core | |||
| 14 | using System.Xml.Linq; | 14 | using System.Xml.Linq; |
| 15 | using WixToolset.Data; | 15 | using WixToolset.Data; |
| 16 | using WixToolset.Data.Tuples; | 16 | using WixToolset.Data.Tuples; |
| 17 | using WixToolset.Data.WindowsInstaller; | ||
| 17 | using WixToolset.Extensibility; | 18 | using WixToolset.Extensibility; |
| 18 | using WixToolset.Extensibility.Data; | 19 | using WixToolset.Extensibility.Data; |
| 19 | using WixToolset.Extensibility.Services; | 20 | using WixToolset.Extensibility.Services; |
| @@ -166,9 +167,10 @@ namespace WixToolset.Core | |||
| 166 | /// Add a tuple to the active section. | 167 | /// Add a tuple to the active section. |
| 167 | /// </summary> | 168 | /// </summary> |
| 168 | /// <param name="tuple">Tuple to add.</param> | 169 | /// <param name="tuple">Tuple to add.</param> |
| 169 | public void AddTuple(IntermediateTuple tuple) | 170 | public T AddTuple<T>(T tuple) |
| 171 | where T : IntermediateTuple | ||
| 170 | { | 172 | { |
| 171 | this.ActiveSection.Tuples.Add(tuple); | 173 | return this.ActiveSection.AddTuple(tuple); |
| 172 | } | 174 | } |
| 173 | 175 | ||
| 174 | /// <summary> | 176 | /// <summary> |
| @@ -351,23 +353,6 @@ namespace WixToolset.Core | |||
| 351 | } | 353 | } |
| 352 | 354 | ||
| 353 | /// <summary> | 355 | /// <summary> |
| 354 | /// Creates a tuple in the active section. | ||
| 355 | /// </summary> | ||
| 356 | /// <param name="sourceLineNumbers">Source and line number of current row.</param> | ||
| 357 | /// <param name="tupleType">Type of tuple to create.</param> | ||
| 358 | /// <param name="identifier">Optional identifier.</param> | ||
| 359 | /// <returns>New tuple.</returns> | ||
| 360 | public IntermediateTuple CreateTuple(SourceLineNumber sourceLineNumbers, TupleDefinitionType tupleType, Identifier identifier = null) | ||
| 361 | { | ||
| 362 | var tupleDefinition = TupleDefinitions.ByType(tupleType); | ||
| 363 | var tuple = tupleDefinition.CreateTuple(sourceLineNumbers, identifier); | ||
| 364 | |||
| 365 | this.ActiveSection.Tuples.Add(tuple); | ||
| 366 | |||
| 367 | return tuple; | ||
| 368 | } | ||
| 369 | |||
| 370 | /// <summary> | ||
| 371 | /// Creates directories using the inline directory syntax. | 356 | /// Creates directories using the inline directory syntax. |
| 372 | /// </summary> | 357 | /// </summary> |
| 373 | /// <param name="sourceLineNumbers">Source line information.</param> | 358 | /// <param name="sourceLineNumbers">Source line information.</param> |
| @@ -394,27 +379,38 @@ namespace WixToolset.Core | |||
| 394 | } | 379 | } |
| 395 | 380 | ||
| 396 | /// <summary> | 381 | /// <summary> |
| 397 | /// Create a WixSimpleReference row in the active section. | 382 | /// Create a WixSimpleReferenceTuple in the active section. |
| 398 | /// </summary> | 383 | /// </summary> |
| 399 | /// <param name="sourceLineNumbers">Source line information for the row.</param> | 384 | /// <param name="sourceLineNumbers">Source line information for the row.</param> |
| 400 | /// <param name="tableName">The table name of the simple reference.</param> | 385 | /// <param name="tupleName">The tuple name of the simple reference.</param> |
| 401 | /// <param name="primaryKeys">The primary keys of the simple reference.</param> | 386 | /// <param name="primaryKeys">The primary keys of the simple reference.</param> |
| 402 | public void CreateSimpleReference(SourceLineNumber sourceLineNumbers, string tableName, params string[] primaryKeys) | 387 | public void CreateSimpleReference(SourceLineNumber sourceLineNumbers, string tupleName, params string[] primaryKeys) |
| 403 | { | 388 | { |
| 404 | if (!this.EncounteredError) | 389 | if (!this.EncounteredError) |
| 405 | { | 390 | { |
| 406 | string joinedKeys = String.Join("/", primaryKeys); | 391 | var joinedKeys = String.Join("/", primaryKeys); |
| 407 | string id = String.Concat(tableName, ":", joinedKeys); | 392 | var id = String.Concat(tupleName, ":", joinedKeys); |
| 408 | 393 | ||
| 409 | // If this simple reference hasn't been added to the active section already, add it. | 394 | // If this simple reference hasn't been added to the active section already, add it. |
| 410 | if (this.activeSectionSimpleReferences.Add(id)) | 395 | if (this.activeSectionSimpleReferences.Add(id)) |
| 411 | { | 396 | { |
| 412 | this.parseHelper.CreateSimpleReference(this.ActiveSection, sourceLineNumbers, tableName, primaryKeys); | 397 | this.parseHelper.CreateSimpleReference(this.ActiveSection, sourceLineNumbers, tupleName, primaryKeys); |
| 413 | } | 398 | } |
| 414 | } | 399 | } |
| 415 | } | 400 | } |
| 416 | 401 | ||
| 417 | /// <summary> | 402 | /// <summary> |
| 403 | /// Create a WixSimpleReferenceTuple in the active section. | ||
| 404 | /// </summary> | ||
| 405 | /// <param name="sourceLineNumbers">Source line information for the row.</param> | ||
| 406 | /// <param name="tupleDefinition">The tuple definition of the simple reference.</param> | ||
| 407 | /// <param name="primaryKeys">The primary keys of the simple reference.</param> | ||
| 408 | public void CreateSimpleReference(SourceLineNumber sourceLineNumbers, IntermediateTupleDefinition tupleDefinition, params string[] primaryKeys) | ||
| 409 | { | ||
| 410 | this.CreateSimpleReference(sourceLineNumbers, tupleDefinition.Name, primaryKeys); | ||
| 411 | } | ||
| 412 | |||
| 413 | /// <summary> | ||
| 418 | /// A row in the WixGroup table is added for this child node and its parent node. | 414 | /// A row in the WixGroup table is added for this child node and its parent node. |
| 419 | /// </summary> | 415 | /// </summary> |
| 420 | /// <param name="sourceLineNumbers">Source line information for the row.</param> | 416 | /// <param name="sourceLineNumbers">Source line information for the row.</param> |
| @@ -431,7 +427,7 @@ namespace WixToolset.Core | |||
| 431 | } | 427 | } |
| 432 | 428 | ||
| 433 | /// <summary> | 429 | /// <summary> |
| 434 | /// Add the appropriate rows to make sure that the given table shows up | 430 | /// Add the appropriate tuples to make sure that the given table shows up |
| 435 | /// in the resulting output. | 431 | /// in the resulting output. |
| 436 | /// </summary> | 432 | /// </summary> |
| 437 | /// <param name="sourceLineNumbers">Source line numbers.</param> | 433 | /// <param name="sourceLineNumbers">Source line numbers.</param> |
| @@ -445,6 +441,20 @@ namespace WixToolset.Core | |||
| 445 | } | 441 | } |
| 446 | 442 | ||
| 447 | /// <summary> | 443 | /// <summary> |
| 444 | /// Add the appropriate tuples to make sure that the given table shows up | ||
| 445 | /// in the resulting output. | ||
| 446 | /// </summary> | ||
| 447 | /// <param name="sourceLineNumbers">Source line numbers.</param> | ||
| 448 | /// <param name="tableDefinition">Definition of the table to ensure existance of.</param> | ||
| 449 | public void EnsureTable(SourceLineNumber sourceLineNumbers, TableDefinition tableDefinition) | ||
| 450 | { | ||
| 451 | if (!this.EncounteredError) | ||
| 452 | { | ||
| 453 | this.parseHelper.EnsureTable(this.ActiveSection, sourceLineNumbers, tableDefinition); | ||
| 454 | } | ||
| 455 | } | ||
| 456 | |||
| 457 | /// <summary> | ||
| 448 | /// Get an attribute value. | 458 | /// Get an attribute value. |
| 449 | /// </summary> | 459 | /// </summary> |
| 450 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | 460 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> |
