aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-03-14 07:38:48 -0700
committerRob Mensching <rob@firegiant.com>2021-03-14 07:47:48 -0700
commit3ccd5e439da4296d6f2b66ce47075ab20d039676 (patch)
treeb5546552613b869367d09f444492a0bbcfadcfe0 /src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
parent574785ab1421c9b67336c13ade5c2263e665ca07 (diff)
downloadwix-3ccd5e439da4296d6f2b66ce47075ab20d039676.tar.gz
wix-3ccd5e439da4296d6f2b66ce47075ab20d039676.tar.bz2
wix-3ccd5e439da4296d6f2b66ce47075ab20d039676.zip
Minimize public surface area of Core
Fixes wixtoolset/issues#6374
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
index e33b38b1..d4de2dd3 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
@@ -11,19 +11,20 @@ namespace WixToolset.Core.WindowsInstaller.Bind
11 using System.Runtime.InteropServices; 11 using System.Runtime.InteropServices;
12 using WixToolset.Data; 12 using WixToolset.Data;
13 using WixToolset.Core.Native; 13 using WixToolset.Core.Native;
14 using WixToolset.Core.Bind;
15 using WixToolset.Data.Symbols; 14 using WixToolset.Data.Symbols;
16 using WixToolset.Extensibility.Services; 15 using WixToolset.Extensibility.Services;
17 using WixToolset.Core.WindowsInstaller.Msi; 16 using WixToolset.Core.WindowsInstaller.Msi;
17 using WixToolset.Extensibility.Data;
18 18
19 /// <summary> 19 /// <summary>
20 /// Retrieve files information and extract them from merge modules. 20 /// Retrieve files information and extract them from merge modules.
21 /// </summary> 21 /// </summary>
22 internal class ExtractMergeModuleFilesCommand 22 internal class ExtractMergeModuleFilesCommand
23 { 23 {
24 public ExtractMergeModuleFilesCommand(IMessaging messaging, IEnumerable<WixMergeSymbol> wixMergeSymbols, IEnumerable<FileFacade> fileFacades, int installerVersion, string intermediateFolder, bool suppressLayout) 24 public ExtractMergeModuleFilesCommand(IMessaging messaging, IWindowsInstallerBackendHelper backendHelper, IEnumerable<WixMergeSymbol> wixMergeSymbols, IEnumerable<IFileFacade> fileFacades, int installerVersion, string intermediateFolder, bool suppressLayout)
25 { 25 {
26 this.Messaging = messaging; 26 this.Messaging = messaging;
27 this.BackendHelper = backendHelper;
27 this.WixMergeSymbols = wixMergeSymbols; 28 this.WixMergeSymbols = wixMergeSymbols;
28 this.FileFacades = fileFacades; 29 this.FileFacades = fileFacades;
29 this.OutputInstallerVersion = installerVersion; 30 this.OutputInstallerVersion = installerVersion;
@@ -33,9 +34,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
33 34
34 private IMessaging Messaging { get; } 35 private IMessaging Messaging { get; }
35 36
37 private IWindowsInstallerBackendHelper BackendHelper { get; }
38
36 private IEnumerable<WixMergeSymbol> WixMergeSymbols { get; } 39 private IEnumerable<WixMergeSymbol> WixMergeSymbols { get; }
37 40
38 private IEnumerable<FileFacade> FileFacades { get; } 41 private IEnumerable<IFileFacade> FileFacades { get; }
39 42
40 private int OutputInstallerVersion { get; } 43 private int OutputInstallerVersion { get; }
41 44
@@ -43,11 +46,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
43 46
44 private bool SuppressLayout { get; } 47 private bool SuppressLayout { get; }
45 48
46 public IEnumerable<FileFacade> MergeModulesFileFacades { get; private set; } 49 public IEnumerable<IFileFacade> MergeModulesFileFacades { get; private set; }
47 50
48 public void Execute() 51 public void Execute()
49 { 52 {
50 var mergeModulesFileFacades = new List<FileFacade>(); 53 var mergeModulesFileFacades = new List<IFileFacade>();
51 54
52 var interop = new MsmInterop(); 55 var interop = new MsmInterop();
53 var merge = interop.GetMsmMerge(); 56 var merge = interop.GetMsmMerge();
@@ -75,7 +78,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
75 this.MergeModulesFileFacades = mergeModulesFileFacades; 78 this.MergeModulesFileFacades = mergeModulesFileFacades;
76 } 79 }
77 80
78 private bool CreateFacadesForMergeModuleFiles(WixMergeSymbol wixMergeRow, List<FileFacade> mergeModulesFileFacades, Dictionary<string, FileFacade> indexedFileFacades) 81 private bool CreateFacadesForMergeModuleFiles(WixMergeSymbol wixMergeRow, List<IFileFacade> mergeModulesFileFacades, Dictionary<string, IFileFacade> indexedFileFacades)
79 { 82 {
80 var containsFiles = false; 83 var containsFiles = false;
81 84
@@ -86,7 +89,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
86 { 89 {
87 if (db.TableExists("File") && db.TableExists("Component")) 90 if (db.TableExists("File") && db.TableExists("Component"))
88 { 91 {
89 var uniqueModuleFileIdentifiers = new Dictionary<string, FileFacade>(StringComparer.OrdinalIgnoreCase); 92 var uniqueModuleFileIdentifiers = new Dictionary<string, IFileFacade>(StringComparer.OrdinalIgnoreCase);
90 93
91 using (var view = db.OpenExecuteView("SELECT `File`, `Directory_` FROM `File`, `Component` WHERE `Component_`=`Component`")) 94 using (var view = db.OpenExecuteView("SELECT `File`, `Directory_` FROM `File`, `Component` WHERE `Component_`=`Component`"))
92 { 95 {
@@ -102,7 +105,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
102 fileSymbol.DiskId = wixMergeRow.DiskId; 105 fileSymbol.DiskId = wixMergeRow.DiskId;
103 fileSymbol.Source = new IntermediateFieldPathValue { Path = Path.Combine(this.IntermediateFolder, wixMergeRow.Id.Id, record[1]) }; 106 fileSymbol.Source = new IntermediateFieldPathValue { Path = Path.Combine(this.IntermediateFolder, wixMergeRow.Id.Id, record[1]) };
104 107
105 var mergeModuleFileFacade = new FileFacade(true, fileSymbol); 108 var mergeModuleFileFacade = this.BackendHelper.CreateFileFacadeFromMergeModule(fileSymbol);
106 109
107 // If case-sensitive collision with another merge module or a user-authored file identifier. 110 // If case-sensitive collision with another merge module or a user-authored file identifier.
108 if (indexedFileFacades.TryGetValue(mergeModuleFileFacade.Id, out var collidingFacade)) 111 if (indexedFileFacades.TryGetValue(mergeModuleFileFacade.Id, out var collidingFacade))