diff options
| author | Rob Mensching <rob@firegiant.com> | 2019-05-22 00:58:13 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2019-05-23 16:02:37 -0700 |
| commit | d0462be8000f18aa7dc0791d02142f000bb19fbf (patch) | |
| tree | 072aabc2bd9b8f171e17654473f85c44a8a42a66 /src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs | |
| parent | 1ed894bc0f39397ec7f7f6344370fc2123420c43 (diff) | |
| download | wix-d0462be8000f18aa7dc0791d02142f000bb19fbf.tar.gz wix-d0462be8000f18aa7dc0791d02142f000bb19fbf.tar.bz2 wix-d0462be8000f18aa7dc0791d02142f000bb19fbf.zip | |
Integrate latest changes to tuple definitions
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs index 0f278640..8c6a3e67 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs | |||
| @@ -16,6 +16,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 16 | /// </summary> | 16 | /// </summary> |
| 17 | internal class AssignMediaCommand | 17 | internal class AssignMediaCommand |
| 18 | { | 18 | { |
| 19 | private const int DefaultMaximumUncompressedMediaSize = 200; // Default value is 200 MB | ||
| 20 | |||
| 19 | public AssignMediaCommand(IntermediateSection section, IMessaging messaging) | 21 | public AssignMediaCommand(IntermediateSection section, IMessaging messaging) |
| 20 | { | 22 | { |
| 21 | this.CabinetNameTemplate = "Cab{0}.cab"; | 23 | this.CabinetNameTemplate = "Cab{0}.cab"; |
| @@ -82,7 +84,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 82 | } | 84 | } |
| 83 | else | 85 | else |
| 84 | { | 86 | { |
| 85 | this.AutoAssignFiles(mediaTable, this.FileFacades, filesByCabinetMedia, mediaRows, uncompressedFiles); | 87 | this.AutoAssignFiles(mediaTable, filesByCabinetMedia, mediaRows, uncompressedFiles); |
| 86 | } | 88 | } |
| 87 | 89 | ||
| 88 | this.FileFacadesByCabinetMedia = new Dictionary<MediaTuple, IEnumerable<FileFacade>>(); | 90 | this.FileFacadesByCabinetMedia = new Dictionary<MediaTuple, IEnumerable<FileFacade>>(); |
| @@ -101,7 +103,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 101 | /// Assign files to cabinets based on MediaTemplate authoring. | 103 | /// Assign files to cabinets based on MediaTemplate authoring. |
| 102 | /// </summary> | 104 | /// </summary> |
| 103 | /// <param name="fileFacades">FileRowCollection</param> | 105 | /// <param name="fileFacades">FileRowCollection</param> |
| 104 | private void AutoAssignFiles(List<MediaTuple> mediaTable, IEnumerable<FileFacade> fileFacades, Dictionary<MediaTuple, List<FileFacade>> filesByCabinetMedia, Dictionary<int, MediaTuple> mediaRows, List<FileFacade> uncompressedFiles) | 106 | private void AutoAssignFiles(List<MediaTuple> mediaTable, Dictionary<MediaTuple, List<FileFacade>> filesByCabinetMedia, Dictionary<int, MediaTuple> mediaRows, List<FileFacade> uncompressedFiles) |
| 105 | { | 107 | { |
| 106 | const int MaxCabIndex = 999; | 108 | const int MaxCabIndex = 999; |
| 107 | 109 | ||
| @@ -140,7 +142,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 140 | } | 142 | } |
| 141 | else | 143 | else |
| 142 | { | 144 | { |
| 143 | maxPreCabSizeInMB = mediaTemplateRow.MaximumUncompressedMediaSize; | 145 | maxPreCabSizeInMB = mediaTemplateRow.MaximumUncompressedMediaSize ?? DefaultMaximumUncompressedMediaSize; |
| 144 | } | 146 | } |
| 145 | 147 | ||
| 146 | maxPreCabSizeInBytes = (ulong)maxPreCabSizeInMB * 1024 * 1024; | 148 | maxPreCabSizeInBytes = (ulong)maxPreCabSizeInMB * 1024 * 1024; |
| @@ -212,8 +214,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 212 | // If there are uncompressed files and no MediaRow, create a default one. | 214 | // If there are uncompressed files and no MediaRow, create a default one. |
| 213 | if (uncompressedFiles.Count > 0 && !this.Section.Tuples.OfType<MediaTuple>().Any()) | 215 | if (uncompressedFiles.Count > 0 && !this.Section.Tuples.OfType<MediaTuple>().Any()) |
| 214 | { | 216 | { |
| 215 | var defaultMediaRow = new MediaTuple(null, new Identifier(1, AccessModifier.Private)); | 217 | var defaultMediaRow = new MediaTuple(null, new Identifier(AccessModifier.Private, 1)) |
| 216 | defaultMediaRow.DiskId = 1; | 218 | { |
| 219 | DiskId = 1 | ||
| 220 | }; | ||
| 217 | 221 | ||
| 218 | mediaRows.Add(1, defaultMediaRow); | 222 | mediaRows.Add(1, defaultMediaRow); |
| 219 | this.Section.Tuples.Add(defaultMediaRow); | 223 | this.Section.Tuples.Add(defaultMediaRow); |
| @@ -282,7 +286,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 282 | } | 286 | } |
| 283 | else | 287 | else |
| 284 | { | 288 | { |
| 285 | this.Messaging.Write(ErrorMessages.ExpectedMediaCabinet(facade.File.SourceLineNumbers, facade.File.File, facade.WixFile.DiskId)); | 289 | this.Messaging.Write(ErrorMessages.ExpectedMediaCabinet(facade.File.SourceLineNumbers, facade.File.Id.Id, facade.WixFile.DiskId)); |
| 286 | } | 290 | } |
| 287 | } | 291 | } |
| 288 | } | 292 | } |
| @@ -294,21 +298,16 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 294 | /// <param name="mediaTable"></param> | 298 | /// <param name="mediaTable"></param> |
| 295 | /// <param name="cabIndex"></param> | 299 | /// <param name="cabIndex"></param> |
| 296 | /// <returns></returns> | 300 | /// <returns></returns> |
| 297 | private MediaTuple AddMediaRow(WixMediaTemplateTuple mediaTemplateRow, int cabIndex) | 301 | private MediaTuple AddMediaRow(WixMediaTemplateTuple mediaTemplateTuple, int cabIndex) |
| 298 | { | 302 | { |
| 299 | var currentMediaRow = new MediaTuple(mediaTemplateRow.SourceLineNumbers, new Identifier(cabIndex, AccessModifier.Private)); | 303 | var currentMediaTuple = new MediaTuple(mediaTemplateTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, cabIndex)); |
| 300 | currentMediaRow.DiskId = cabIndex; | 304 | currentMediaTuple.DiskId = cabIndex; |
| 301 | currentMediaRow.Cabinet = String.Format(CultureInfo.InvariantCulture, this.CabinetNameTemplate, cabIndex); | 305 | currentMediaTuple.Cabinet = String.Format(CultureInfo.InvariantCulture, this.CabinetNameTemplate, cabIndex); |
| 302 | 306 | currentMediaTuple.CompressionLevel = mediaTemplateTuple.CompressionLevel; | |
| 303 | this.Section.Tuples.Add(currentMediaRow); | ||
| 304 | |||
| 305 | var row = new WixMediaTuple(mediaTemplateRow.SourceLineNumbers, new Identifier(cabIndex, AccessModifier.Private)); | ||
| 306 | row.DiskId_ = cabIndex; | ||
| 307 | row.CompressionLevel = mediaTemplateRow.CompressionLevel; | ||
| 308 | 307 | ||
| 309 | this.Section.Tuples.Add(row); | 308 | this.Section.Tuples.Add(currentMediaTuple); |
| 310 | 309 | ||
| 311 | return currentMediaRow; | 310 | return currentMediaTuple; |
| 312 | } | 311 | } |
| 313 | } | 312 | } |
| 314 | } | 313 | } |
