aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-11 21:49:09 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-12 12:46:21 +1000
commit6d8b6f79b44b6a41a630aa3aad5a3c7f16701798 (patch)
treeb82ede9934cb7777a19e74a912c68481e76c21cd /src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
parentdf69d4172d3117d8b66ba51fa5ae7f4be538700d (diff)
downloadwix-6d8b6f79b44b6a41a630aa3aad5a3c7f16701798.tar.gz
wix-6d8b6f79b44b6a41a630aa3aad5a3c7f16701798.tar.bz2
wix-6d8b6f79b44b6a41a630aa3aad5a3c7f16701798.zip
General cleanup.
Try not to send strings to specify the tuple or table. Try to avoid using the Set method on tuples. Always create new tuples and add them to the section in the same line.
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
index 2bfd587f..ae7e5788 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/AssignMediaCommand.cs
@@ -71,12 +71,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
71 // When building merge module, all the files go to "#MergeModule.CABinet". 71 // When building merge module, all the files go to "#MergeModule.CABinet".
72 if (SectionType.Module == this.Section.Type) 72 if (SectionType.Module == this.Section.Type)
73 { 73 {
74 var mergeModuleMediaRow = new MediaTuple(); 74 var mergeModuleMediaTuple = this.Section.AddTuple(new MediaTuple
75 mergeModuleMediaRow.Cabinet = "#MergeModule.CABinet"; 75 {
76 76 Cabinet = "#MergeModule.CABinet",
77 this.Section.Tuples.Add(mergeModuleMediaRow); 77 });
78 78
79 filesByCabinetMedia.Add(mergeModuleMediaRow, new List<FileFacade>(this.FileFacades)); 79 filesByCabinetMedia.Add(mergeModuleMediaTuple, new List<FileFacade>(this.FileFacades));
80 } 80 }
81 else if (mediaTemplateTable.Count == 0) 81 else if (mediaTemplateTable.Count == 0)
82 { 82 {
@@ -212,13 +212,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
212 // If there are uncompressed files and no MediaRow, create a default one. 212 // If there are uncompressed files and no MediaRow, create a default one.
213 if (uncompressedFiles.Count > 0 && !this.Section.Tuples.OfType<MediaTuple>().Any()) 213 if (uncompressedFiles.Count > 0 && !this.Section.Tuples.OfType<MediaTuple>().Any())
214 { 214 {
215 var defaultMediaRow = new MediaTuple(null, new Identifier(AccessModifier.Private, 1)) 215 var defaultMediaRow = this.Section.AddTuple(new MediaTuple(null, new Identifier(AccessModifier.Private, 1))
216 { 216 {
217 DiskId = 1 217 DiskId = 1,
218 }; 218 });
219 219
220 mediaRows.Add(1, defaultMediaRow); 220 mediaRows.Add(1, defaultMediaRow);
221 this.Section.Tuples.Add(defaultMediaRow);
222 } 221 }
223 } 222 }
224 223
@@ -298,14 +297,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind
298 /// <returns></returns> 297 /// <returns></returns>
299 private MediaTuple AddMediaRow(WixMediaTemplateTuple mediaTemplateTuple, int cabIndex) 298 private MediaTuple AddMediaRow(WixMediaTemplateTuple mediaTemplateTuple, int cabIndex)
300 { 299 {
301 var currentMediaTuple = new MediaTuple(mediaTemplateTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, cabIndex)); 300 return this.Section.AddTuple(new MediaTuple(mediaTemplateTuple.SourceLineNumbers, new Identifier(AccessModifier.Private, cabIndex))
302 currentMediaTuple.DiskId = cabIndex; 301 {
303 currentMediaTuple.Cabinet = String.Format(CultureInfo.InvariantCulture, this.CabinetNameTemplate, cabIndex); 302 DiskId = cabIndex,
304 currentMediaTuple.CompressionLevel = mediaTemplateTuple.CompressionLevel; 303 Cabinet = String.Format(CultureInfo.InvariantCulture, this.CabinetNameTemplate, cabIndex),
305 304 CompressionLevel = mediaTemplateTuple.CompressionLevel,
306 this.Section.Tuples.Add(currentMediaTuple); 305 });
307
308 return currentMediaTuple;
309 } 306 }
310 } 307 }
311} 308}