aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2020-06-12 12:51:28 -0700
committerRob Mensching <rob@firegiant.com>2020-06-13 09:22:27 -0700
commit167d26d002b1412e72d96ed2bbc0761fc0f1344b (patch)
tree184212c1e347c6c876f629ca3b3e86445e877204
parent86b7ea7a411813e03a2b238ca5c24fcebc947209 (diff)
downloadwix-167d26d002b1412e72d96ed2bbc0761fc0f1344b.tar.gz
wix-167d26d002b1412e72d96ed2bbc0761fc0f1344b.tar.bz2
wix-167d26d002b1412e72d96ed2bbc0761fc0f1344b.zip
Normalize commands to use constructors
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs8
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs82
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs14
3 files changed, 52 insertions, 52 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
index ae7e5788..1d677a70 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
@@ -18,20 +18,22 @@ namespace WixToolset.Core.WindowsInstaller.Bind
18 { 18 {
19 private const int DefaultMaximumUncompressedMediaSize = 200; // Default value is 200 MB 19 private const int DefaultMaximumUncompressedMediaSize = 200; // Default value is 200 MB
20 20
21 public AssignMediaCommand(IntermediateSection section, IMessaging messaging) 21 public AssignMediaCommand(IntermediateSection section, IMessaging messaging, IEnumerable<FileFacade> fileFacades, bool compressed)
22 { 22 {
23 this.CabinetNameTemplate = "Cab{0}.cab"; 23 this.CabinetNameTemplate = "Cab{0}.cab";
24 this.Section = section; 24 this.Section = section;
25 this.Messaging = messaging; 25 this.Messaging = messaging;
26 this.FileFacades = fileFacades;
27 this.FilesCompressed = compressed;
26 } 28 }
27 29
28 private IntermediateSection Section { get; } 30 private IntermediateSection Section { get; }
29 31
30 private IMessaging Messaging { get; } 32 private IMessaging Messaging { get; }
31 33
32 public IEnumerable<FileFacade> FileFacades { private get; set; } 34 private IEnumerable<FileFacade> FileFacades { get; }
33 35
34 public bool FilesCompressed { private get; set; } 36 private bool FilesCompressed { get; }
35 37
36 public string CabinetNameTemplate { private get; set; } 38 public string CabinetNameTemplate { private get; set; }
37 39
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
277 277
278 // Gather information about files that do not come from merge modules. 278 // Gather information about files that do not come from merge modules.
279 { 279 {
280 var command = new UpdateFileFacadesCommand(this.Messaging, section); 280 var command = new UpdateFileFacadesCommand(this.Messaging, section, fileFacades, fileFacades.Where(f => !f.FromModule), variableCache, overwriteHash: true);
281 command.FileFacades = fileFacades;
282 command.UpdateFileFacades = fileFacades.Where(f => !f.FromModule);
283 command.OverwriteHash = true;
284 command.VariableCache = variableCache;
285 command.Execute(); 281 command.Execute();
286 } 282 }
287 283
@@ -290,9 +286,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
290 Dictionary<MediaTuple, IEnumerable<FileFacade>> filesByCabinetMedia; 286 Dictionary<MediaTuple, IEnumerable<FileFacade>> filesByCabinetMedia;
291 IEnumerable<FileFacade> uncompressedFiles; 287 IEnumerable<FileFacade> uncompressedFiles;
292 { 288 {
293 var command = new AssignMediaCommand(section, this.Messaging); 289 var command = new AssignMediaCommand(section, this.Messaging, fileFacades, compressed);
294 command.FileFacades = fileFacades;
295 command.FilesCompressed = compressed;
296 command.Execute(); 290 command.Execute();
297 291
298 assignedMediaRows = command.MediaRows; 292 assignedMediaRows = command.MediaRows;
@@ -313,6 +307,42 @@ namespace WixToolset.Core.WindowsInstaller.Bind
313 command.Execute(); 307 command.Execute();
314 } 308 }
315 309
310#if TODO_FINISH_UPDATE // use tuples instead of rows
311 // Extended binder extensions can be called now that fields are resolved.
312 {
313 Table updatedFiles = this.Output.EnsureTable(this.TableDefinitions["WixBindUpdatedFiles"]);
314
315 foreach (IBinderExtension extension in this.Extensions)
316 {
317 extension.AfterResolvedFields(this.Output);
318 }
319
320 List<FileFacade> updatedFileFacades = new List<FileFacade>();
321
322 foreach (Row updatedFile in updatedFiles.Rows)
323 {
324 string updatedId = updatedFile.FieldAsString(0);
325
326 FileFacade updatedFacade = fileFacades.First(f => f.File.File.Equals(updatedId));
327
328 updatedFileFacades.Add(updatedFacade);
329 }
330
331 if (updatedFileFacades.Any())
332 {
333 UpdateFileFacadesCommand command = new UpdateFileFacadesCommand(this.Messaging, section, fileFacades, updateFileFacades, variableCache, overwriteHash: false);
334 //command.FileFacades = fileFacades;
335 //command.UpdateFileFacades = updatedFileFacades;
336 //command.ModularizationGuid = modularizationGuid;
337 //command.Output = this.Output;
338 //command.OverwriteHash = true;
339 //command.TableDefinitions = this.TableDefinitions;
340 //command.VariableCache = variableCache;
341 command.Execute();
342 }
343 }
344#endif
345
316 // Set generated component guids. 346 // Set generated component guids.
317 { 347 {
318 var command = new CalculateComponentGuids(this.Messaging, this.BackendHelper, this.PathResolver, section); 348 var command = new CalculateComponentGuids(this.Messaging, this.BackendHelper, this.PathResolver, section);
@@ -376,42 +406,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
376 } 406 }
377 } 407 }
378 408
379#if TODO_FINISH_UPDATE
380 // Extended binder extensions can be called now that fields are resolved.
381 {
382 Table updatedFiles = this.Output.EnsureTable(this.TableDefinitions["WixBindUpdatedFiles"]);
383
384 foreach (IBinderExtension extension in this.Extensions)
385 {
386 extension.AfterResolvedFields(this.Output);
387 }
388
389 List<FileFacade> updatedFileFacades = new List<FileFacade>();
390
391 foreach (Row updatedFile in updatedFiles.Rows)
392 {
393 string updatedId = updatedFile.FieldAsString(0);
394
395 FileFacade updatedFacade = fileFacades.First(f => f.File.File.Equals(updatedId));
396
397 updatedFileFacades.Add(updatedFacade);
398 }
399
400 if (updatedFileFacades.Any())
401 {
402 UpdateFileFacadesCommand command = new UpdateFileFacadesCommand();
403 command.FileFacades = fileFacades;
404 command.UpdateFileFacades = updatedFileFacades;
405 command.ModularizationGuid = modularizationGuid;
406 command.Output = this.Output;
407 command.OverwriteHash = true;
408 command.TableDefinitions = this.TableDefinitions;
409 command.VariableCache = variableCache;
410 command.Execute();
411 }
412 }
413#endif
414
415 // Stop processing if an error previously occurred. 409 // Stop processing if an error previously occurred.
416 if (this.Messaging.EncounteredError) 410 if (this.Messaging.EncounteredError)
417 { 411 {
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
index 63a8b3d9..75bcfe17 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/UpdateFileFacadesCommand.cs
@@ -19,23 +19,27 @@ namespace WixToolset.Core.WindowsInstaller.Bind
19 /// </summary> 19 /// </summary>
20 internal class UpdateFileFacadesCommand 20 internal class UpdateFileFacadesCommand
21 { 21 {
22 public UpdateFileFacadesCommand(IMessaging messaging, IntermediateSection section) 22 public UpdateFileFacadesCommand(IMessaging messaging, IntermediateSection section, IEnumerable<FileFacade> fileFacades, IEnumerable<FileFacade> updateFileFacades, IDictionary<string, string> variableCache, bool overwriteHash)
23 { 23 {
24 this.Messaging = messaging; 24 this.Messaging = messaging;
25 this.Section = section; 25 this.Section = section;
26 this.FileFacades = fileFacades;
27 this.UpdateFileFacades = updateFileFacades;
28 this.VariableCache = variableCache;
29 this.OverwriteHash = overwriteHash;
26 } 30 }
27 31
28 private IMessaging Messaging { get; } 32 private IMessaging Messaging { get; }
29 33
30 private IntermediateSection Section { get; } 34 private IntermediateSection Section { get; }
31 35
32 public IEnumerable<FileFacade> FileFacades { private get; set; } 36 private IEnumerable<FileFacade> FileFacades { get; }
33 37
34 public IEnumerable<FileFacade> UpdateFileFacades { private get; set; } 38 private IEnumerable<FileFacade> UpdateFileFacades { get; }
35 39
36 public bool OverwriteHash { private get; set; } 40 private bool OverwriteHash { get; }
37 41
38 public IDictionary<string, string> VariableCache { private get; set; } 42 private IDictionary<string, string> VariableCache { get; }
39 43
40 public void Execute() 44 public void Execute()
41 { 45 {