diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-01-13 14:41:17 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-02-05 16:15:47 -0800 |
| commit | 6e2e67ab55c75f4655397588c0dcc64f50d22f92 (patch) | |
| tree | 01290e7b07ec6e4e4384e8fed568f14283f65d61 /src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs | |
| parent | c9c3ab2776252d3131fea561bd3f3fac8c045f5e (diff) | |
| download | wix-6e2e67ab55c75f4655397588c0dcc64f50d22f92.tar.gz wix-6e2e67ab55c75f4655397588c0dcc64f50d22f92.tar.bz2 wix-6e2e67ab55c75f4655397588c0dcc64f50d22f92.zip | |
Remove WixActionRowCollection and duplicate actions.xml
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs | 79 |
1 files changed, 42 insertions, 37 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs index 1651f9d8..107f3208 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs | |||
| @@ -433,59 +433,63 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 433 | /// <param name="mainFileRow">The file row that contains information about the patched file.</param> | 433 | /// <param name="mainFileRow">The file row that contains information about the patched file.</param> |
| 434 | private void AddPatchFilesActionToSequenceTable(SequenceTable table, WindowsInstallerData mainTransform, WindowsInstallerData pairedTransform, Row mainFileRow) | 434 | private void AddPatchFilesActionToSequenceTable(SequenceTable table, WindowsInstallerData mainTransform, WindowsInstallerData pairedTransform, Row mainFileRow) |
| 435 | { | 435 | { |
| 436 | var tableName = table.ToString(); | ||
| 437 | |||
| 436 | // Find/add PatchFiles action (also determine sequence for it). | 438 | // Find/add PatchFiles action (also determine sequence for it). |
| 437 | // Search mainTransform first, then pairedTransform (pairedTransform overrides). | 439 | // Search mainTransform first, then pairedTransform (pairedTransform overrides). |
| 438 | bool hasPatchFilesAction = false; | 440 | var hasPatchFilesAction = false; |
| 439 | int seqInstallFiles = 0; | 441 | var installFilesSequence = 0; |
| 440 | int seqDuplicateFiles = 0; | 442 | var duplicateFilesSequence = 0; |
| 441 | string tableName = table.ToString(); | ||
| 442 | 443 | ||
| 443 | TestSequenceTableForPatchFilesAction( | 444 | TestSequenceTableForPatchFilesAction( |
| 444 | mainTransform.Tables[tableName], | 445 | mainTransform.Tables[tableName], |
| 445 | ref hasPatchFilesAction, | 446 | ref hasPatchFilesAction, |
| 446 | ref seqInstallFiles, | 447 | ref installFilesSequence, |
| 447 | ref seqDuplicateFiles); | 448 | ref duplicateFilesSequence); |
| 448 | TestSequenceTableForPatchFilesAction( | 449 | TestSequenceTableForPatchFilesAction( |
| 449 | pairedTransform.Tables[tableName], | 450 | pairedTransform.Tables[tableName], |
| 450 | ref hasPatchFilesAction, | 451 | ref hasPatchFilesAction, |
| 451 | ref seqInstallFiles, | 452 | ref installFilesSequence, |
| 452 | ref seqDuplicateFiles); | 453 | ref duplicateFilesSequence); |
| 453 | if (!hasPatchFilesAction) | 454 | if (!hasPatchFilesAction) |
| 454 | { | 455 | { |
| 455 | Table iesTable = pairedTransform.EnsureTable(this.TableDefinitions[tableName]); | 456 | WindowsInstallerStandard.TryGetStandardAction(tableName, "PatchFiles", out var patchFilesActionTuple); |
| 456 | if (0 == iesTable.Rows.Count) | 457 | |
| 457 | { | 458 | var sequence = patchFilesActionTuple.Sequence; |
| 458 | iesTable.Operation = TableOperation.Add; | ||
| 459 | } | ||
| 460 | 459 | ||
| 461 | Row patchAction = iesTable.CreateRow(null); | ||
| 462 | WixActionRow wixPatchAction = WindowsInstallerStandardInternal.GetStandardActionRows()[table, "PatchFiles"]; | ||
| 463 | int sequence = wixPatchAction.Sequence; | ||
| 464 | // Test for default sequence value's appropriateness | 460 | // Test for default sequence value's appropriateness |
| 465 | if (seqInstallFiles >= sequence || (0 != seqDuplicateFiles && seqDuplicateFiles <= sequence)) | 461 | if (installFilesSequence >= sequence || (0 != duplicateFilesSequence && duplicateFilesSequence <= sequence)) |
| 466 | { | 462 | { |
| 467 | if (0 != seqDuplicateFiles) | 463 | if (0 != duplicateFilesSequence) |
| 468 | { | 464 | { |
| 469 | if (seqDuplicateFiles < seqInstallFiles) | 465 | if (duplicateFilesSequence < installFilesSequence) |
| 470 | { | 466 | { |
| 471 | throw new WixException(ErrorMessages.InsertInvalidSequenceActionOrder(mainFileRow.SourceLineNumbers, iesTable.Name, "InstallFiles", "DuplicateFiles", wixPatchAction.Action)); | 467 | throw new WixException(ErrorMessages.InsertInvalidSequenceActionOrder(mainFileRow.SourceLineNumbers, tableName, "InstallFiles", "DuplicateFiles", patchFilesActionTuple.Action)); |
| 472 | } | 468 | } |
| 473 | else | 469 | else |
| 474 | { | 470 | { |
| 475 | sequence = (seqDuplicateFiles + seqInstallFiles) / 2; | 471 | sequence = (duplicateFilesSequence + installFilesSequence) / 2; |
| 476 | if (seqInstallFiles == sequence || seqDuplicateFiles == sequence) | 472 | if (installFilesSequence == sequence || duplicateFilesSequence == sequence) |
| 477 | { | 473 | { |
| 478 | throw new WixException(ErrorMessages.InsertSequenceNoSpace(mainFileRow.SourceLineNumbers, iesTable.Name, "InstallFiles", "DuplicateFiles", wixPatchAction.Action)); | 474 | throw new WixException(ErrorMessages.InsertSequenceNoSpace(mainFileRow.SourceLineNumbers, tableName, "InstallFiles", "DuplicateFiles", patchFilesActionTuple.Action)); |
| 479 | } | 475 | } |
| 480 | } | 476 | } |
| 481 | } | 477 | } |
| 482 | else | 478 | else |
| 483 | { | 479 | { |
| 484 | sequence = seqInstallFiles + 1; | 480 | sequence = installFilesSequence + 1; |
| 485 | } | 481 | } |
| 486 | } | 482 | } |
| 487 | patchAction[0] = wixPatchAction.Action; | 483 | |
| 488 | patchAction[1] = wixPatchAction.Condition; | 484 | var sequenceTable = pairedTransform.EnsureTable(this.TableDefinitions[tableName]); |
| 485 | if (0 == sequenceTable.Rows.Count) | ||
| 486 | { | ||
| 487 | sequenceTable.Operation = TableOperation.Add; | ||
| 488 | } | ||
| 489 | |||
| 490 | var patchAction = sequenceTable.CreateRow(null); | ||
| 491 | patchAction[0] = patchFilesActionTuple.Action; | ||
| 492 | patchAction[1] = patchFilesActionTuple.Condition; | ||
| 489 | patchAction[2] = sequence; | 493 | patchAction[2] = sequence; |
| 490 | patchAction.Operation = RowOperation.Add; | 494 | patchAction.Operation = RowOperation.Add; |
| 491 | } | 495 | } |
| @@ -494,27 +498,28 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 494 | /// <summary> | 498 | /// <summary> |
| 495 | /// Tests sequence table for PatchFiles and associated actions | 499 | /// Tests sequence table for PatchFiles and associated actions |
| 496 | /// </summary> | 500 | /// </summary> |
| 497 | /// <param name="iesTable">The table to test.</param> | 501 | /// <param name="sequenceTable">The table to test.</param> |
| 498 | /// <param name="hasPatchFilesAction">Set to true if PatchFiles action is found. Left unchanged otherwise.</param> | 502 | /// <param name="hasPatchFilesAction">Set to true if PatchFiles action is found. Left unchanged otherwise.</param> |
| 499 | /// <param name="seqInstallFiles">Set to sequence value of InstallFiles action if found. Left unchanged otherwise.</param> | 503 | /// <param name="installFilesSequence">Set to sequence value of InstallFiles action if found. Left unchanged otherwise.</param> |
| 500 | /// <param name="seqDuplicateFiles">Set to sequence value of DuplicateFiles action if found. Left unchanged otherwise.</param> | 504 | /// <param name="duplicateFilesSequence">Set to sequence value of DuplicateFiles action if found. Left unchanged otherwise.</param> |
| 501 | private static void TestSequenceTableForPatchFilesAction(Table iesTable, ref bool hasPatchFilesAction, ref int seqInstallFiles, ref int seqDuplicateFiles) | 505 | private static void TestSequenceTableForPatchFilesAction(Table sequenceTable, ref bool hasPatchFilesAction, ref int installFilesSequence, ref int duplicateFilesSequence) |
| 502 | { | 506 | { |
| 503 | if (null != iesTable) | 507 | if (null != sequenceTable) |
| 504 | { | 508 | { |
| 505 | foreach (Row iesRow in iesTable.Rows) | 509 | foreach (var row in sequenceTable.Rows) |
| 506 | { | 510 | { |
| 507 | if (String.Equals("PatchFiles", (string)iesRow[0], StringComparison.Ordinal)) | 511 | var actionName = row.FieldAsString(0); |
| 512 | if (String.Equals("PatchFiles", actionName, StringComparison.Ordinal)) | ||
| 508 | { | 513 | { |
| 509 | hasPatchFilesAction = true; | 514 | hasPatchFilesAction = true; |
| 510 | } | 515 | } |
| 511 | if (String.Equals("InstallFiles", (string)iesRow[0], StringComparison.Ordinal)) | 516 | else if (String.Equals("InstallFiles", actionName, StringComparison.Ordinal)) |
| 512 | { | 517 | { |
| 513 | seqInstallFiles = (int)iesRow.Fields[2].Data; | 518 | installFilesSequence = row.FieldAsInteger(2); |
| 514 | } | 519 | } |
| 515 | if (String.Equals("DuplicateFiles", (string)iesRow[0], StringComparison.Ordinal)) | 520 | else if (String.Equals("DuplicateFiles", actionName, StringComparison.Ordinal)) |
| 516 | { | 521 | { |
| 517 | seqDuplicateFiles = (int)iesRow.Fields[2].Data; | 522 | duplicateFilesSequence = row.FieldAsInteger(2); |
| 518 | } | 523 | } |
| 519 | } | 524 | } |
| 520 | } | 525 | } |
