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 | |
| 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')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/CopyTransformDataCommand.cs | 79 | ||||
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs | 13 |
2 files changed, 46 insertions, 46 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 | } |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs index 23a5fcba..e9b0d612 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs | |||
| @@ -18,16 +18,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 18 | this.Section = section; | 18 | this.Section = section; |
| 19 | 19 | ||
| 20 | this.RelativeActionsForActions = new Dictionary<string, RelativeActions>(); | 20 | this.RelativeActionsForActions = new Dictionary<string, RelativeActions>(); |
| 21 | |||
| 22 | this.StandardActionsById = WindowsInstallerStandard.StandardActions().ToDictionary(a => a.Id.Id); | ||
| 23 | } | 21 | } |
| 24 | 22 | ||
| 25 | private IntermediateSection Section { get; } | 23 | private IntermediateSection Section { get; } |
| 26 | 24 | ||
| 27 | private Dictionary<string, RelativeActions> RelativeActionsForActions { get; } | 25 | private Dictionary<string, RelativeActions> RelativeActionsForActions { get; } |
| 28 | 26 | ||
| 29 | private Dictionary<string, WixActionTuple> StandardActionsById { get; } | ||
| 30 | |||
| 31 | public IMessaging Messaging { private get; set; } | 27 | public IMessaging Messaging { private get; set; } |
| 32 | 28 | ||
| 33 | /// <summary> | 29 | /// <summary> |
| @@ -63,7 +59,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 63 | // Unsequenced action (allowed for certain standard actions). | 59 | // Unsequenced action (allowed for certain standard actions). |
| 64 | if (null == actionTuple.Before && null == actionTuple.After && !actionTuple.Sequence.HasValue) | 60 | if (null == actionTuple.Before && null == actionTuple.After && !actionTuple.Sequence.HasValue) |
| 65 | { | 61 | { |
| 66 | if (this.StandardActionsById.TryGetValue(actionTuple.Id.Id, out var standardAction)) | 62 | if (WindowsInstallerStandard.TryGetStandardAction(actionTuple.Id.Id, out var standardAction)) |
| 67 | { | 63 | { |
| 68 | // Populate the sequence from the standard action | 64 | // Populate the sequence from the standard action |
| 69 | actionTuple.Sequence = standardAction.Sequence; | 65 | actionTuple.Sequence = standardAction.Sequence; |
| @@ -154,7 +150,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 154 | // on the presence of a particular table. | 150 | // on the presence of a particular table. |
| 155 | if (requiredActionTuples.ContainsKey("InstallExecuteSequence/DuplicateFiles") && !requiredActionTuples.ContainsKey("InstallExecuteSequence/InstallFiles")) | 151 | if (requiredActionTuples.ContainsKey("InstallExecuteSequence/DuplicateFiles") && !requiredActionTuples.ContainsKey("InstallExecuteSequence/InstallFiles")) |
| 156 | { | 152 | { |
| 157 | var standardAction = this.StandardActionsById["InstallExecuteSequence/InstallFiles"]; | 153 | WindowsInstallerStandard.TryGetStandardAction("InstallExecuteSequence/InstallFiles", out var standardAction); |
| 158 | requiredActionTuples.Add(standardAction.Id.Id, standardAction); | 154 | requiredActionTuples.Add(standardAction.Id.Id, standardAction); |
| 159 | } | 155 | } |
| 160 | 156 | ||
| @@ -201,8 +197,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 201 | 197 | ||
| 202 | foreach (var actionId in requiredActionIds) | 198 | foreach (var actionId in requiredActionIds) |
| 203 | { | 199 | { |
| 204 | var standardAction = this.StandardActionsById[actionId]; | 200 | WindowsInstallerStandard.TryGetStandardAction(actionId, out var standardAction); |
| 205 | |||
| 206 | overridableActionTuples.Add(standardAction.Id.Id, standardAction); | 201 | overridableActionTuples.Add(standardAction.Id.Id, standardAction); |
| 207 | } | 202 | } |
| 208 | 203 | ||
| @@ -597,7 +592,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 597 | if (!requiredActionTuples.TryGetValue(parentActionKey, out var parentActionTuple)) | 592 | if (!requiredActionTuples.TryGetValue(parentActionKey, out var parentActionTuple)) |
| 598 | { | 593 | { |
| 599 | // If the missing parent action is a standard action (with a suggested sequence number), add it. | 594 | // If the missing parent action is a standard action (with a suggested sequence number), add it. |
| 600 | if (this.StandardActionsById.TryGetValue(parentActionKey, out parentActionTuple)) | 595 | if (WindowsInstallerStandard.TryGetStandardAction(parentActionKey, out parentActionTuple)) |
| 601 | { | 596 | { |
| 602 | // Create a clone to avoid modifying the static copy of the object. | 597 | // Create a clone to avoid modifying the static copy of the object. |
| 603 | // TODO: consider this: parentActionTuple = parentActionTuple.Clone(); | 598 | // TODO: consider this: parentActionTuple = parentActionTuple.Clone(); |
