diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.cs')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.cs | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.cs index 9bbb4763..70ba971f 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesCommand.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; |
@@ -8,57 +8,50 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
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; | 11 | using WixToolset.Data.Tuples; |
12 | 12 | ||
13 | internal class GetFileFacadesCommand | 13 | internal class GetFileFacadesCommand |
14 | { | 14 | { |
15 | public Table FileTable { private get; set; } | 15 | public GetFileFacadesCommand(IntermediateSection section) |
16 | 16 | { | |
17 | public Table WixFileTable { private get; set; } | 17 | this.Section = section; |
18 | 18 | } | |
19 | public Table WixDeltaPatchFileTable { private get; set; } | ||
20 | 19 | ||
21 | public Table WixDeltaPatchSymbolPathsTable { private get; set; } | 20 | private IntermediateSection Section { get; } |
22 | 21 | ||
23 | public List<FileFacade> FileFacades { get; private set; } | 22 | public List<FileFacade> FileFacades { get; private set; } |
24 | 23 | ||
25 | public void Execute() | 24 | public void Execute() |
26 | { | 25 | { |
27 | throw new NotImplementedException(); | 26 | var facades = new List<FileFacade>(); |
28 | #if TODO | ||
29 | List<FileFacade> facades = new List<FileFacade>(this.FileTable.Rows.Count); | ||
30 | 27 | ||
31 | RowDictionary<WixFileRow> wixFiles = new RowDictionary<WixFileRow>(this.WixFileTable); | 28 | var wixFiles = this.Section.Tuples.OfType<WixFileTuple>().ToDictionary(t => t.File_); |
32 | RowDictionary<WixDeltaPatchFileRow> deltaPatchFiles = new RowDictionary<WixDeltaPatchFileRow>(this.WixDeltaPatchFileTable); | 29 | var deltaPatchFiles = this.Section.Tuples.OfType<WixDeltaPatchFileTuple>().ToDictionary(t => t.File_); |
33 | 30 | ||
34 | foreach (FileRow file in this.FileTable.Rows) | 31 | foreach (var file in this.Section.Tuples.OfType<FileTuple>()) |
35 | { | 32 | { |
36 | WixDeltaPatchFileRow deltaPatchFile = null; | 33 | var wixFile = wixFiles[file.File]; |
37 | 34 | ||
38 | deltaPatchFiles.TryGetValue(file.File, out deltaPatchFile); | 35 | deltaPatchFiles.TryGetValue(file.File, out var deltaPatchFile); |
39 | 36 | ||
40 | facades.Add(new FileFacade(file, wixFiles[file.File], deltaPatchFile)); | 37 | facades.Add(new FileFacade(file, wixFile, deltaPatchFile)); |
41 | } | 38 | } |
42 | 39 | ||
43 | if (null != this.WixDeltaPatchSymbolPathsTable) | 40 | this.ResolveDeltaPatchSymbolPaths(deltaPatchFiles, facades); |
44 | { | ||
45 | this.ResolveDeltaPatchSymbolPaths(deltaPatchFiles, facades); | ||
46 | } | ||
47 | 41 | ||
48 | this.FileFacades = facades; | 42 | this.FileFacades = facades; |
49 | #endif | ||
50 | } | 43 | } |
51 | 44 | ||
52 | /// <summary> | 45 | /// <summary> |
53 | /// Merge data from the WixPatchSymbolPaths rows into the WixDeltaPatchFile rows. | 46 | /// Merge data from the WixPatchSymbolPaths rows into the WixDeltaPatchFile rows. |
54 | /// </summary> | 47 | /// </summary> |
55 | public RowDictionary<WixDeltaPatchFileRow> ResolveDeltaPatchSymbolPaths(RowDictionary<WixDeltaPatchFileRow> deltaPatchFiles, IEnumerable<FileFacade> facades) | 48 | public void ResolveDeltaPatchSymbolPaths(Dictionary<string, WixDeltaPatchFileTuple> deltaPatchFiles, IEnumerable<FileFacade> facades) |
56 | { | 49 | { |
57 | ILookup<string, FileFacade> filesByComponent = null; | 50 | ILookup<string, FileFacade> filesByComponent = null; |
58 | ILookup<string, FileFacade> filesByDirectory = null; | 51 | ILookup<string, FileFacade> filesByDirectory = null; |
59 | ILookup<string, FileFacade> filesByDiskId = null; | 52 | ILookup<string, FileFacade> filesByDiskId = null; |
60 | 53 | ||
61 | foreach (WixDeltaPatchSymbolPathsRow row in this.WixDeltaPatchSymbolPathsTable.RowsAs<WixDeltaPatchSymbolPathsRow>().OrderBy(r => r.Type)) | 54 | foreach (var row in this.Section.Tuples.OfType<WixDeltaPatchSymbolPathsTuple>().OrderBy(r => r.Type)) |
62 | { | 55 | { |
63 | switch (row.Type) | 56 | switch (row.Type) |
64 | { | 57 | { |
@@ -72,7 +65,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
72 | filesByComponent = facades.ToLookup(f => f.File.Component_); | 65 | filesByComponent = facades.ToLookup(f => f.File.Component_); |
73 | } | 66 | } |
74 | 67 | ||
75 | foreach (FileFacade facade in filesByComponent[row.Id]) | 68 | foreach (var facade in filesByComponent[row.Id]) |
76 | { | 69 | { |
77 | this.MergeSymbolPaths(row, deltaPatchFiles[facade.File.File]); | 70 | this.MergeSymbolPaths(row, deltaPatchFiles[facade.File.File]); |
78 | } | 71 | } |
@@ -84,7 +77,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
84 | filesByDirectory = facades.ToLookup(f => f.WixFile.Directory_); | 77 | filesByDirectory = facades.ToLookup(f => f.WixFile.Directory_); |
85 | } | 78 | } |
86 | 79 | ||
87 | foreach (FileFacade facade in filesByDirectory[row.Id]) | 80 | foreach (var facade in filesByDirectory[row.Id]) |
88 | { | 81 | { |
89 | this.MergeSymbolPaths(row, deltaPatchFiles[facade.File.File]); | 82 | this.MergeSymbolPaths(row, deltaPatchFiles[facade.File.File]); |
90 | } | 83 | } |
@@ -96,14 +89,14 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
96 | filesByDiskId = facades.ToLookup(f => f.WixFile.DiskId.ToString(CultureInfo.InvariantCulture)); | 89 | filesByDiskId = facades.ToLookup(f => f.WixFile.DiskId.ToString(CultureInfo.InvariantCulture)); |
97 | } | 90 | } |
98 | 91 | ||
99 | foreach (FileFacade facade in filesByDiskId[row.Id]) | 92 | foreach (var facade in filesByDiskId[row.Id]) |
100 | { | 93 | { |
101 | this.MergeSymbolPaths(row, deltaPatchFiles[facade.File.File]); | 94 | this.MergeSymbolPaths(row, deltaPatchFiles[facade.File.File]); |
102 | } | 95 | } |
103 | break; | 96 | break; |
104 | 97 | ||
105 | case SymbolPathType.Product: | 98 | case SymbolPathType.Product: |
106 | foreach (WixDeltaPatchFileRow fileRow in deltaPatchFiles.Values) | 99 | foreach (var fileRow in deltaPatchFiles.Values) |
107 | { | 100 | { |
108 | this.MergeSymbolPaths(row, fileRow); | 101 | this.MergeSymbolPaths(row, fileRow); |
109 | } | 102 | } |
@@ -114,8 +107,6 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
114 | break; | 107 | break; |
115 | } | 108 | } |
116 | } | 109 | } |
117 | |||
118 | return deltaPatchFiles; | ||
119 | } | 110 | } |
120 | 111 | ||
121 | /// <summary> | 112 | /// <summary> |
@@ -124,17 +115,18 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
124 | /// <param name="row">Row from the WixPatchSymbolsPaths table.</param> | 115 | /// <param name="row">Row from the WixPatchSymbolsPaths table.</param> |
125 | /// <param name="file">FileRow into which to set symbol information.</param> | 116 | /// <param name="file">FileRow into which to set symbol information.</param> |
126 | /// <comment>This includes PreviousData as well.</comment> | 117 | /// <comment>This includes PreviousData as well.</comment> |
127 | private void MergeSymbolPaths(WixDeltaPatchSymbolPathsRow row, WixDeltaPatchFileRow file) | 118 | private void MergeSymbolPaths(WixDeltaPatchSymbolPathsTuple row, WixDeltaPatchFileTuple file) |
128 | { | 119 | { |
129 | if (null == file.Symbols) | 120 | if (file.SymbolPaths is null) |
130 | { | 121 | { |
131 | file.Symbols = row.SymbolPaths; | 122 | file.SymbolPaths = row.SymbolPaths; |
132 | } | 123 | } |
133 | else | 124 | else |
134 | { | 125 | { |
135 | file.Symbols = String.Concat(file.Symbols, ";", row.SymbolPaths); | 126 | file.SymbolPaths = String.Concat(file.SymbolPaths, ";", row.SymbolPaths); |
136 | } | 127 | } |
137 | 128 | ||
129 | #if REVISIT_FOR_PATCHING | ||
138 | Field field = row.Fields[2]; | 130 | Field field = row.Fields[2]; |
139 | if (null != field.PreviousData) | 131 | if (null != field.PreviousData) |
140 | { | 132 | { |
@@ -147,6 +139,7 @@ namespace WixToolset.Core.WindowsInstaller.Databases | |||
147 | file.PreviousSymbols = String.Concat(file.PreviousSymbols, ";", field.PreviousData); | 139 | file.PreviousSymbols = String.Concat(file.PreviousSymbols, ";", field.PreviousData); |
148 | } | 140 | } |
149 | } | 141 | } |
142 | #endif | ||
150 | } | 143 | } |
151 | } | 144 | } |
152 | } | 145 | } |