From 167d26d002b1412e72d96ed2bbc0761fc0f1344b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 12 Jun 2020 12:51:28 -0700 Subject: Normalize commands to use constructors --- .../Bind/BindDatabaseCommand.cs | 82 ++++++++++------------ 1 file changed, 38 insertions(+), 44 deletions(-) (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs') diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index e0dd2b96..b3f81212 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs @@ -277,11 +277,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind // Gather information about files that do not come from merge modules. { - var command = new UpdateFileFacadesCommand(this.Messaging, section); - command.FileFacades = fileFacades; - command.UpdateFileFacades = fileFacades.Where(f => !f.FromModule); - command.OverwriteHash = true; - command.VariableCache = variableCache; + var command = new UpdateFileFacadesCommand(this.Messaging, section, fileFacades, fileFacades.Where(f => !f.FromModule), variableCache, overwriteHash: true); command.Execute(); } @@ -290,9 +286,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind Dictionary> filesByCabinetMedia; IEnumerable uncompressedFiles; { - var command = new AssignMediaCommand(section, this.Messaging); - command.FileFacades = fileFacades; - command.FilesCompressed = compressed; + var command = new AssignMediaCommand(section, this.Messaging, fileFacades, compressed); command.Execute(); assignedMediaRows = command.MediaRows; @@ -313,6 +307,42 @@ namespace WixToolset.Core.WindowsInstaller.Bind command.Execute(); } +#if TODO_FINISH_UPDATE // use tuples instead of rows + // Extended binder extensions can be called now that fields are resolved. + { + Table updatedFiles = this.Output.EnsureTable(this.TableDefinitions["WixBindUpdatedFiles"]); + + foreach (IBinderExtension extension in this.Extensions) + { + extension.AfterResolvedFields(this.Output); + } + + List updatedFileFacades = new List(); + + foreach (Row updatedFile in updatedFiles.Rows) + { + string updatedId = updatedFile.FieldAsString(0); + + FileFacade updatedFacade = fileFacades.First(f => f.File.File.Equals(updatedId)); + + updatedFileFacades.Add(updatedFacade); + } + + if (updatedFileFacades.Any()) + { + UpdateFileFacadesCommand command = new UpdateFileFacadesCommand(this.Messaging, section, fileFacades, updateFileFacades, variableCache, overwriteHash: false); + //command.FileFacades = fileFacades; + //command.UpdateFileFacades = updatedFileFacades; + //command.ModularizationGuid = modularizationGuid; + //command.Output = this.Output; + //command.OverwriteHash = true; + //command.TableDefinitions = this.TableDefinitions; + //command.VariableCache = variableCache; + command.Execute(); + } + } +#endif + // Set generated component guids. { var command = new CalculateComponentGuids(this.Messaging, this.BackendHelper, this.PathResolver, section); @@ -376,42 +406,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind } } -#if TODO_FINISH_UPDATE - // Extended binder extensions can be called now that fields are resolved. - { - Table updatedFiles = this.Output.EnsureTable(this.TableDefinitions["WixBindUpdatedFiles"]); - - foreach (IBinderExtension extension in this.Extensions) - { - extension.AfterResolvedFields(this.Output); - } - - List updatedFileFacades = new List(); - - foreach (Row updatedFile in updatedFiles.Rows) - { - string updatedId = updatedFile.FieldAsString(0); - - FileFacade updatedFacade = fileFacades.First(f => f.File.File.Equals(updatedId)); - - updatedFileFacades.Add(updatedFacade); - } - - if (updatedFileFacades.Any()) - { - UpdateFileFacadesCommand command = new UpdateFileFacadesCommand(); - command.FileFacades = fileFacades; - command.UpdateFileFacades = updatedFileFacades; - command.ModularizationGuid = modularizationGuid; - command.Output = this.Output; - command.OverwriteHash = true; - command.TableDefinitions = this.TableDefinitions; - command.VariableCache = variableCache; - command.Execute(); - } - } -#endif - // Stop processing if an error previously occurred. if (this.Messaging.EncounteredError) { -- cgit v1.2.3-55-g6feb