diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs index 1f2cee74..0f278640 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs | |||
@@ -8,22 +8,25 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
8 | using System.Linq; | 8 | using System.Linq; |
9 | using WixToolset.Core.Bind; | 9 | using WixToolset.Core.Bind; |
10 | using WixToolset.Data; | 10 | using WixToolset.Data; |
11 | using WixToolset.Data.Rows; | ||
12 | using WixToolset.Data.Tuples; | 11 | using WixToolset.Data.Tuples; |
12 | using WixToolset.Extensibility.Services; | ||
13 | 13 | ||
14 | /// <summary> | 14 | /// <summary> |
15 | /// AssignMediaCommand assigns files to cabs based on Media or MediaTemplate rows. | 15 | /// AssignMediaCommand assigns files to cabs based on Media or MediaTemplate rows. |
16 | /// </summary> | 16 | /// </summary> |
17 | internal class AssignMediaCommand | 17 | internal class AssignMediaCommand |
18 | { | 18 | { |
19 | public AssignMediaCommand(IntermediateSection section) | 19 | public AssignMediaCommand(IntermediateSection section, IMessaging messaging) |
20 | { | 20 | { |
21 | this.CabinetNameTemplate = "Cab{0}.cab"; | 21 | this.CabinetNameTemplate = "Cab{0}.cab"; |
22 | this.Section = section; | 22 | this.Section = section; |
23 | this.Messaging = messaging; | ||
23 | } | 24 | } |
24 | 25 | ||
25 | private IntermediateSection Section { get; } | 26 | private IntermediateSection Section { get; } |
26 | 27 | ||
28 | private IMessaging Messaging { get; } | ||
29 | |||
27 | public IEnumerable<FileFacade> FileFacades { private get; set; } | 30 | public IEnumerable<FileFacade> FileFacades { private get; set; } |
28 | 31 | ||
29 | public bool FilesCompressed { private get; set; } | 32 | public bool FilesCompressed { private get; set; } |
@@ -60,7 +63,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
60 | // If both tables are authored, it is an error. | 63 | // If both tables are authored, it is an error. |
61 | if (mediaTemplateTable.Count > 0 && mediaTable.Count > 1) | 64 | if (mediaTemplateTable.Count > 0 && mediaTable.Count > 1) |
62 | { | 65 | { |
63 | throw new WixException(WixErrors.MediaTableCollision(null)); | 66 | throw new WixException(ErrorMessages.MediaTableCollision(null)); |
64 | } | 67 | } |
65 | 68 | ||
66 | // When building merge module, all the files go to "#MergeModule.CABinet". | 69 | // When building merge module, all the files go to "#MergeModule.CABinet". |
@@ -144,11 +147,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
144 | } | 147 | } |
145 | catch (FormatException) | 148 | catch (FormatException) |
146 | { | 149 | { |
147 | throw new WixException(WixErrors.IllegalEnvironmentVariable("WIX_MUMS", mumsString)); | 150 | throw new WixException(ErrorMessages.IllegalEnvironmentVariable("WIX_MUMS", mumsString)); |
148 | } | 151 | } |
149 | catch (OverflowException) | 152 | catch (OverflowException) |
150 | { | 153 | { |
151 | throw new WixException(WixErrors.MaximumUncompressedMediaSizeTooLarge(null, maxPreCabSizeInMB)); | 154 | throw new WixException(ErrorMessages.MaximumUncompressedMediaSizeTooLarge(null, maxPreCabSizeInMB)); |
152 | } | 155 | } |
153 | 156 | ||
154 | foreach (FileFacade facade in this.FileFacades) | 157 | foreach (FileFacade facade in this.FileFacades) |
@@ -234,8 +237,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
234 | { | 237 | { |
235 | if (cabinetMediaRows.TryGetValue(mediaRow.Cabinet, out var existingRow)) | 238 | if (cabinetMediaRows.TryGetValue(mediaRow.Cabinet, out var existingRow)) |
236 | { | 239 | { |
237 | Messaging.Instance.OnMessage(WixErrors.DuplicateCabinetName(mediaRow.SourceLineNumbers, mediaRow.Cabinet)); | 240 | this.Messaging.Write(ErrorMessages.DuplicateCabinetName(mediaRow.SourceLineNumbers, mediaRow.Cabinet)); |
238 | Messaging.Instance.OnMessage(WixErrors.DuplicateCabinetName2(existingRow.SourceLineNumbers, existingRow.Cabinet)); | 241 | this.Messaging.Write(ErrorMessages.DuplicateCabinetName2(existingRow.SourceLineNumbers, existingRow.Cabinet)); |
239 | } | 242 | } |
240 | else | 243 | else |
241 | { | 244 | { |
@@ -259,7 +262,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
259 | { | 262 | { |
260 | if (!mediaRows.TryGetValue(facade.WixFile.DiskId, out var mediaRow)) | 263 | if (!mediaRows.TryGetValue(facade.WixFile.DiskId, out var mediaRow)) |
261 | { | 264 | { |
262 | Messaging.Instance.OnMessage(WixErrors.MissingMedia(facade.File.SourceLineNumbers, facade.WixFile.DiskId)); | 265 | this.Messaging.Write(ErrorMessages.MissingMedia(facade.File.SourceLineNumbers, facade.WixFile.DiskId)); |
263 | continue; | 266 | continue; |
264 | } | 267 | } |
265 | 268 | ||
@@ -279,7 +282,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
279 | } | 282 | } |
280 | else | 283 | else |
281 | { | 284 | { |
282 | Messaging.Instance.OnMessage(WixErrors.ExpectedMediaCabinet(facade.File.SourceLineNumbers, facade.File.File, facade.WixFile.DiskId)); | 285 | this.Messaging.Write(ErrorMessages.ExpectedMediaCabinet(facade.File.SourceLineNumbers, facade.File.File, facade.WixFile.DiskId)); |
283 | } | 286 | } |
284 | } | 287 | } |
285 | } | 288 | } |