From 9f8cb5374481b6c8a06eb2739858332350f72666 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 11 Nov 2017 01:45:59 -0800 Subject: Additional IR updates --- .../Bind/ProcessUncompressedFilesCommand.cs | 36 ++++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs') diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs index b3c09b9e..d71724d1 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs @@ -1,39 +1,42 @@ // 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. -namespace WixToolset.Core.WindowsInstaller.Databases +namespace WixToolset.Core.WindowsInstaller.Bind { using System; - using System.Collections; using System.Collections.Generic; using System.IO; using WixToolset.Data; - using WixToolset.Data.Rows; using WixToolset.Msi; using WixToolset.Core.Native; using WixToolset.Bind; using WixToolset.Core.Bind; using WixToolset.Data.Bind; + using WixToolset.Data.Tuples; + using System.Linq; /// /// Defines the file transfers necessary to layout the uncompressed files. /// internal class ProcessUncompressedFilesCommand { + public ProcessUncompressedFilesCommand(IntermediateSection section) + { + this.Section = section; + } + + private IntermediateSection Section { get; } + public string DatabasePath { private get; set; } public IEnumerable FileFacades { private get; set; } - public RowDictionary MediaRows { private get; set; } - public string LayoutDirectory { private get; set; } public bool Compressed { private get; set; } public bool LongNamesInImage { private get; set; } - public Func ResolveMedia { private get; set; } - - public Table WixMediaTable { private get; set; } + public Func ResolveMedia { private get; set; } public IEnumerable FileTransfers { get; private set; } @@ -41,9 +44,11 @@ namespace WixToolset.Core.WindowsInstaller.Databases { List fileTransfers = new List(); - Hashtable directories = new Hashtable(); + var directories = new Dictionary(); - RowDictionary wixMediaRows = new RowDictionary(this.WixMediaTable); + var mediaRows = this.Section.Tuples.OfType().ToDictionary(t => t.DiskId); + + var wixMediaRows = this.Section.Tuples.OfType().ToDictionary(t => t.DiskId_); using (Database db = new Database(this.DatabasePath, OpenDatabase.ReadOnly)) { @@ -72,18 +77,16 @@ namespace WixToolset.Core.WindowsInstaller.Databases // for each file in the array of uncompressed files foreach (FileFacade facade in this.FileFacades) { - MediaRow mediaRow = this.MediaRows.Get(facade.WixFile.DiskId); + var mediaTuple = mediaRows[facade.WixFile.DiskId]; string relativeFileLayoutPath = null; - - WixMediaRow wixMediaRow = null; string mediaLayoutFolder = null; - if (wixMediaRows.TryGetValue(mediaRow.GetKey(), out wixMediaRow)) + if (wixMediaRows.TryGetValue(facade.WixFile.DiskId, out var wixMediaRow)) { mediaLayoutFolder = wixMediaRow.Layout; } - string mediaLayoutDirectory = this.ResolveMedia(mediaRow, mediaLayoutFolder, this.LayoutDirectory); + var mediaLayoutDirectory = this.ResolveMedia(mediaTuple, mediaLayoutFolder, this.LayoutDirectory); // setup up the query record and find the appropriate file in the // previously executed file view @@ -102,8 +105,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases // finally put together the base media layout path and the relative file layout path string fileLayoutPath = Path.Combine(mediaLayoutDirectory, relativeFileLayoutPath); - FileTransfer transfer; - if (FileTransfer.TryCreate(facade.WixFile.Source, fileLayoutPath, false, "File", facade.File.SourceLineNumbers, out transfer)) + if (FileTransfer.TryCreate(facade.WixFile.Source, fileLayoutPath, false, "File", facade.File.SourceLineNumbers, out var transfer)) { fileTransfers.Add(transfer); } -- cgit v1.2.3-55-g6feb