diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-05-30 14:53:05 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-05-30 15:07:21 -0700 |
| commit | d529525a1e331f3ef9ec2707791c99bd78fdd82f (patch) | |
| tree | 1d9fe1f0c0ee9850371c916802eb03ec9dc37a87 /src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs | |
| parent | 9c54d2fce80983bbee5f0f113b5aa30f22bc8a23 (diff) | |
| download | wix-d529525a1e331f3ef9ec2707791c99bd78fdd82f.tar.gz wix-d529525a1e331f3ef9ec2707791c99bd78fdd82f.tar.bz2 wix-d529525a1e331f3ef9ec2707791c99bd78fdd82f.zip | |
Basic patching support
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs index ffe26249..ac98c82d 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindTransformCommand.cs | |||
| @@ -3,23 +3,21 @@ | |||
| 3 | namespace WixToolset.Core.WindowsInstaller.Bind | 3 | namespace WixToolset.Core.WindowsInstaller.Bind |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | ||
| 7 | using System.Globalization; | 6 | using System.Globalization; |
| 8 | using System.IO; | 7 | using System.IO; |
| 9 | using WixToolset.Core.WindowsInstaller.Msi; | 8 | using WixToolset.Core.WindowsInstaller.Msi; |
| 10 | using WixToolset.Data; | 9 | using WixToolset.Data; |
| 11 | using WixToolset.Data.Tuples; | 10 | using WixToolset.Data.Tuples; |
| 12 | using WixToolset.Data.WindowsInstaller; | 11 | using WixToolset.Data.WindowsInstaller; |
| 13 | using WixToolset.Extensibility; | ||
| 14 | using WixToolset.Extensibility.Services; | 12 | using WixToolset.Extensibility.Services; |
| 15 | 13 | ||
| 16 | internal class BindTransformCommand | 14 | internal class BindTransformCommand |
| 17 | { | 15 | { |
| 18 | public BindTransformCommand(IMessaging messaging, IBackendHelper backendHelper, IEnumerable<IFileSystemExtension> extensions, string intermediateFolder, WindowsInstallerData transform, string outputPath, TableDefinitionCollection tableDefinitions) | 16 | public BindTransformCommand(IMessaging messaging, IBackendHelper backendHelper, FileSystemManager fileSystemManager, string intermediateFolder, WindowsInstallerData transform, string outputPath, TableDefinitionCollection tableDefinitions) |
| 19 | { | 17 | { |
| 20 | this.Messaging = messaging; | 18 | this.Messaging = messaging; |
| 21 | this.BackendHelper = backendHelper; | 19 | this.BackendHelper = backendHelper; |
| 22 | this.Extensions = extensions; | 20 | this.FileSystemManager = fileSystemManager; |
| 23 | this.IntermediateFolder = intermediateFolder; | 21 | this.IntermediateFolder = intermediateFolder; |
| 24 | this.Transform = transform; | 22 | this.Transform = transform; |
| 25 | this.OutputPath = outputPath; | 23 | this.OutputPath = outputPath; |
| @@ -30,7 +28,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 30 | 28 | ||
| 31 | private IBackendHelper BackendHelper { get; } | 29 | private IBackendHelper BackendHelper { get; } |
| 32 | 30 | ||
| 33 | private IEnumerable<IFileSystemExtension> Extensions { get; } | 31 | private FileSystemManager FileSystemManager { get; } |
| 34 | 32 | ||
| 35 | private TableDefinitionCollection TableDefinitions { get; } | 33 | private TableDefinitionCollection TableDefinitions { get; } |
| 36 | 34 | ||
| @@ -353,7 +351,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 353 | targetRow[i] = emptyFile; | 351 | targetRow[i] = emptyFile; |
| 354 | modifiedRow = true; | 352 | modifiedRow = true; |
| 355 | } | 353 | } |
| 356 | else if (!this.CompareFiles(objectField.PreviousData, (string)objectField.Data)) | 354 | else if (!this.FileSystemManager.CompareFiles(objectField.PreviousData, (string)objectField.Data)) |
| 357 | { | 355 | { |
| 358 | targetRow[i] = objectField.PreviousData; | 356 | targetRow[i] = objectField.PreviousData; |
| 359 | modifiedRow = true; | 357 | modifiedRow = true; |
| @@ -438,29 +436,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 438 | } | 436 | } |
| 439 | } | 437 | } |
| 440 | 438 | ||
| 441 | private bool CompareFiles(string targetFile, string updatedFile) | ||
| 442 | { | ||
| 443 | bool? compared = null; | ||
| 444 | foreach (var extension in this.Extensions) | ||
| 445 | { | ||
| 446 | compared = extension.CompareFiles(targetFile, updatedFile); | ||
| 447 | if (compared.HasValue) | ||
| 448 | { | ||
| 449 | break; | ||
| 450 | } | ||
| 451 | } | ||
| 452 | |||
| 453 | if (!compared.HasValue) | ||
| 454 | { | ||
| 455 | throw new InvalidOperationException(); // TODO: something needs to be said here that none of the binder file managers returned a result. | ||
| 456 | } | ||
| 457 | |||
| 458 | return compared.Value; | ||
| 459 | } | ||
| 460 | |||
| 461 | private void GenerateDatabase(WindowsInstallerData output, string outputPath, bool keepAddedColumns) | 439 | private void GenerateDatabase(WindowsInstallerData output, string outputPath, bool keepAddedColumns) |
| 462 | { | 440 | { |
| 463 | var command = new GenerateDatabaseCommand(this.Messaging, this.BackendHelper, this.Extensions, output, outputPath, this.TableDefinitions, this.IntermediateFolder, codepage: -1, keepAddedColumns, suppressAddingValidationRows: true, useSubdirectory: true ); | 441 | var command = new GenerateDatabaseCommand(this.Messaging, this.BackendHelper, this.FileSystemManager, output, outputPath, this.TableDefinitions, this.IntermediateFolder, codepage: -1, keepAddedColumns, suppressAddingValidationRows: true, useSubdirectory: true); |
| 464 | command.Execute(); | 442 | command.Execute(); |
| 465 | } | 443 | } |
| 466 | } | 444 | } |
