diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs index 02015744..b5a436c5 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixToolset.Core.WindowsInstaller.Databases | 3 | namespace WixToolset.Core.WindowsInstaller.Bind |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
@@ -10,10 +10,10 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
10 | using System.Runtime.InteropServices; | 10 | using System.Runtime.InteropServices; |
11 | using System.Threading; | 11 | using System.Threading; |
12 | using WixToolset.Core.Bind; | 12 | using WixToolset.Core.Bind; |
13 | using WixToolset.Core.WindowsInstaller.Bind; | ||
14 | using WixToolset.Data; | 13 | using WixToolset.Data; |
15 | using WixToolset.Data.Bind; | 14 | using WixToolset.Data.Bind; |
16 | using WixToolset.Data.Rows; | 15 | using WixToolset.Data.Rows; |
16 | using WixToolset.Data.Tuples; | ||
17 | using WixToolset.Extensibility; | 17 | using WixToolset.Extensibility; |
18 | 18 | ||
19 | /// <summary> | 19 | /// <summary> |
@@ -60,9 +60,9 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
60 | 60 | ||
61 | public bool Compressed { private get; set; } | 61 | public bool Compressed { private get; set; } |
62 | 62 | ||
63 | public Dictionary<MediaRow, IEnumerable<FileFacade>> FileRowsByCabinet { private get; set; } | 63 | public Dictionary<MediaTuple, IEnumerable<FileFacade>> FileRowsByCabinet { private get; set; } |
64 | 64 | ||
65 | public Func<MediaRow, string, string, string> ResolveMedia { private get; set; } | 65 | public Func<MediaTuple, string, string, string> ResolveMedia { private get; set; } |
66 | 66 | ||
67 | public TableDefinitionCollection TableDefinitions { private get; set; } | 67 | public TableDefinitionCollection TableDefinitions { private get; set; } |
68 | 68 | ||
@@ -77,7 +77,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
77 | /// <returns>The uncompressed file rows.</returns> | 77 | /// <returns>The uncompressed file rows.</returns> |
78 | public void Execute() | 78 | public void Execute() |
79 | { | 79 | { |
80 | RowDictionary<WixMediaRow> wixMediaRows = new RowDictionary<WixMediaRow>(this.WixMediaTable); | 80 | var wixMediaRows = new RowDictionary<WixMediaRow>(this.WixMediaTable); |
81 | 81 | ||
82 | this.lastCabinetAddedToMediaTable = new Dictionary<string, string>(); | 82 | this.lastCabinetAddedToMediaTable = new Dictionary<string, string>(); |
83 | 83 | ||
@@ -87,22 +87,19 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
87 | CabinetBuilder cabinetBuilder = new CabinetBuilder(this.CabbingThreadCount, Marshal.GetFunctionPointerForDelegate(this.newCabNamesCallBack)); | 87 | CabinetBuilder cabinetBuilder = new CabinetBuilder(this.CabbingThreadCount, Marshal.GetFunctionPointerForDelegate(this.newCabNamesCallBack)); |
88 | 88 | ||
89 | // Supply Compile MediaTemplate Attributes to Cabinet Builder | 89 | // Supply Compile MediaTemplate Attributes to Cabinet Builder |
90 | int MaximumCabinetSizeForLargeFileSplitting; | 90 | this.GetMediaTemplateAttributes(out var MaximumCabinetSizeForLargeFileSplitting, out var MaximumUncompressedMediaSize); |
91 | int MaximumUncompressedMediaSize; | ||
92 | this.GetMediaTemplateAttributes(out MaximumCabinetSizeForLargeFileSplitting, out MaximumUncompressedMediaSize); | ||
93 | cabinetBuilder.MaximumCabinetSizeForLargeFileSplitting = MaximumCabinetSizeForLargeFileSplitting; | 91 | cabinetBuilder.MaximumCabinetSizeForLargeFileSplitting = MaximumCabinetSizeForLargeFileSplitting; |
94 | cabinetBuilder.MaximumUncompressedMediaSize = MaximumUncompressedMediaSize; | 92 | cabinetBuilder.MaximumUncompressedMediaSize = MaximumUncompressedMediaSize; |
95 | 93 | ||
96 | foreach (var entry in this.FileRowsByCabinet) | 94 | foreach (var entry in this.FileRowsByCabinet) |
97 | { | 95 | { |
98 | MediaRow mediaRow = entry.Key; | 96 | var mediaRow = entry.Key; |
99 | IEnumerable<FileFacade> files = entry.Value; | 97 | IEnumerable<FileFacade> files = entry.Value; |
100 | CompressionLevel compressionLevel = this.DefaultCompressionLevel; | 98 | CompressionLevel compressionLevel = this.DefaultCompressionLevel; |
101 | 99 | ||
102 | WixMediaRow wixMediaRow = null; | ||
103 | string mediaLayoutFolder = null; | 100 | string mediaLayoutFolder = null; |
104 | 101 | ||
105 | if (wixMediaRows.TryGetValue(mediaRow.GetKey(), out wixMediaRow)) | 102 | if (wixMediaRows.TryGetValue(mediaRow.Id.Id, out var wixMediaRow)) |
106 | { | 103 | { |
107 | mediaLayoutFolder = wixMediaRow.Layout; | 104 | mediaLayoutFolder = wixMediaRow.Layout; |
108 | 105 | ||
@@ -185,7 +182,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
185 | /// <param name="fileFacades">Collection of files in this cabinet.</param> | 182 | /// <param name="fileFacades">Collection of files in this cabinet.</param> |
186 | /// <param name="fileTransfers">Array of files to be transfered.</param> | 183 | /// <param name="fileTransfers">Array of files to be transfered.</param> |
187 | /// <returns>created CabinetWorkItem object</returns> | 184 | /// <returns>created CabinetWorkItem object</returns> |
188 | private CabinetWorkItem CreateCabinetWorkItem(Output output, string cabinetDir, MediaRow mediaRow, CompressionLevel compressionLevel, IEnumerable<FileFacade> fileFacades, List<FileTransfer> fileTransfers) | 185 | private CabinetWorkItem CreateCabinetWorkItem(Output output, string cabinetDir, MediaTuple mediaRow, CompressionLevel compressionLevel, IEnumerable<FileFacade> fileFacades, List<FileTransfer> fileTransfers) |
189 | { | 186 | { |
190 | CabinetWorkItem cabinetWorkItem = null; | 187 | CabinetWorkItem cabinetWorkItem = null; |
191 | string tempCabinetFileX = Path.Combine(this.TempFilesLocation, mediaRow.Cabinet); | 188 | string tempCabinetFileX = Path.Combine(this.TempFilesLocation, mediaRow.Cabinet); |
@@ -254,8 +251,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
254 | else | 251 | else |
255 | { | 252 | { |
256 | string destinationPath = Path.Combine(cabinetDir, mediaRow.Cabinet); | 253 | string destinationPath = Path.Combine(cabinetDir, mediaRow.Cabinet); |
257 | FileTransfer transfer; | 254 | if (FileTransfer.TryCreate(resolvedCabinet.Path, destinationPath, CabinetBuildOption.BuildAndMove == resolvedCabinet.BuildOption, "Cabinet", mediaRow.SourceLineNumbers, out var transfer)) |
258 | if (FileTransfer.TryCreate(resolvedCabinet.Path, destinationPath, CabinetBuildOption.BuildAndMove == resolvedCabinet.BuildOption, "Cabinet", mediaRow.SourceLineNumbers, out transfer)) | ||
259 | { | 255 | { |
260 | transfer.Built = true; | 256 | transfer.Built = true; |
261 | fileTransfers.Add(transfer); | 257 | fileTransfers.Add(transfer); |