diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 40643abd..a0146fda 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs | |||
@@ -93,7 +93,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
93 | 93 | ||
94 | private string ModularizationGuid { get; set; } | 94 | private string ModularizationGuid { get; set; } |
95 | 95 | ||
96 | public XElement UIElement | 96 | private XElement UIElement |
97 | { | 97 | { |
98 | get | 98 | get |
99 | { | 99 | { |
@@ -107,12 +107,11 @@ namespace WixToolset.Core.WindowsInstaller | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | public Dictionary<string, XElement> Singletons { get; } = new Dictionary<string, XElement>(); | 110 | private Dictionary<string, XElement> Singletons { get; } = new Dictionary<string, XElement>(); |
111 | 111 | ||
112 | public Dictionary<string, XElement> IndexedElements { get; } = new Dictionary<string, XElement>(); | 112 | private Dictionary<string, XElement> IndexedElements { get; } = new Dictionary<string, XElement>(); |
113 | |||
114 | public Dictionary<string, XElement> PatchTargetFiles { get; } = new Dictionary<string, XElement>(); | ||
115 | 113 | ||
114 | private Dictionary<string, XElement> PatchTargetFiles { get; } = new Dictionary<string, XElement>(); | ||
116 | 115 | ||
117 | /// <summary> | 116 | /// <summary> |
118 | /// Decompile the database file. | 117 | /// Decompile the database file. |
@@ -215,12 +214,30 @@ namespace WixToolset.Core.WindowsInstaller | |||
215 | } | 214 | } |
216 | #endif | 215 | #endif |
217 | 216 | ||
217 | internal static Platform? GetPlatformFromTemplateSummaryInformation(string[] template) | ||
218 | { | ||
219 | if (null != template && 1 < template.Length && null != template[0] && 0 < template[0].Length) | ||
220 | { | ||
221 | switch (template[0]) | ||
222 | { | ||
223 | case "Intel": | ||
224 | return Platform.X86; | ||
225 | case "x64": | ||
226 | return Platform.X64; | ||
227 | case "Arm64": | ||
228 | return Platform.ARM64; | ||
229 | } | ||
230 | } | ||
231 | |||
232 | return null; | ||
233 | } | ||
234 | |||
218 | /// <summary> | 235 | /// <summary> |
219 | /// Gets the element corresponding to the row it came from. | 236 | /// Gets the element corresponding to the row it came from. |
220 | /// </summary> | 237 | /// </summary> |
221 | /// <param name="row">The row corresponding to the element.</param> | 238 | /// <param name="row">The row corresponding to the element.</param> |
222 | /// <returns>The indexed element.</returns> | 239 | /// <returns>The indexed element.</returns> |
223 | public XElement GetIndexedElement(WixToolset.Data.WindowsInstaller.Row row) => this.GetIndexedElement(row.TableDefinition.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)); | 240 | private XElement GetIndexedElement(WixToolset.Data.WindowsInstaller.Row row) => this.GetIndexedElement(row.TableDefinition.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)); |
224 | 241 | ||
225 | /// <summary> | 242 | /// <summary> |
226 | /// Gets the element corresponding to the primary key of the given table. | 243 | /// Gets the element corresponding to the primary key of the given table. |
@@ -228,7 +245,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
228 | /// <param name="table">The table corresponding to the element.</param> | 245 | /// <param name="table">The table corresponding to the element.</param> |
229 | /// <param name="primaryKey">The primary key corresponding to the element.</param> | 246 | /// <param name="primaryKey">The primary key corresponding to the element.</param> |
230 | /// <returns>The indexed element.</returns> | 247 | /// <returns>The indexed element.</returns> |
231 | public XElement GetIndexedElement(string table, params string[] primaryKey) => this.IndexedElements[String.Concat(table, ':', String.Join(DecompilerConstants.PrimaryKeyDelimiterString, primaryKey))]; | 248 | private XElement GetIndexedElement(string table, params string[] primaryKey) => this.IndexedElements[String.Concat(table, ':', String.Join(DecompilerConstants.PrimaryKeyDelimiterString, primaryKey))]; |
232 | 249 | ||
233 | /// <summary> | 250 | /// <summary> |
234 | /// Gets the element corresponding to the primary key of the given table. | 251 | /// Gets the element corresponding to the primary key of the given table. |
@@ -236,7 +253,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
236 | /// <param name="table">The table corresponding to the element.</param> | 253 | /// <param name="table">The table corresponding to the element.</param> |
237 | /// <param name="primaryKey">The primary key corresponding to the element.</param> | 254 | /// <param name="primaryKey">The primary key corresponding to the element.</param> |
238 | /// <returns>The indexed element.</returns> | 255 | /// <returns>The indexed element.</returns> |
239 | public bool TryGetIndexedElement(WixToolset.Data.WindowsInstaller.Row row, out XElement xElement) => this.TryGetIndexedElement(row.TableDefinition.Name, out xElement, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)); | 256 | private bool TryGetIndexedElement(WixToolset.Data.WindowsInstaller.Row row, out XElement xElement) => this.TryGetIndexedElement(row.TableDefinition.Name, out xElement, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)); |
240 | 257 | ||
241 | /// <summary> | 258 | /// <summary> |
242 | /// Gets the element corresponding to the primary key of the given table. | 259 | /// Gets the element corresponding to the primary key of the given table. |
@@ -244,14 +261,14 @@ namespace WixToolset.Core.WindowsInstaller | |||
244 | /// <param name="table">The table corresponding to the element.</param> | 261 | /// <param name="table">The table corresponding to the element.</param> |
245 | /// <param name="primaryKey">The primary key corresponding to the element.</param> | 262 | /// <param name="primaryKey">The primary key corresponding to the element.</param> |
246 | /// <returns>The indexed element.</returns> | 263 | /// <returns>The indexed element.</returns> |
247 | public bool TryGetIndexedElement(string table, out XElement xElement, params string[] primaryKey) => this.IndexedElements.TryGetValue(String.Concat(table, ':', String.Join(DecompilerConstants.PrimaryKeyDelimiterString, primaryKey)), out xElement); | 264 | private bool TryGetIndexedElement(string table, out XElement xElement, params string[] primaryKey) => this.IndexedElements.TryGetValue(String.Concat(table, ':', String.Join(DecompilerConstants.PrimaryKeyDelimiterString, primaryKey)), out xElement); |
248 | 265 | ||
249 | /// <summary> | 266 | /// <summary> |
250 | /// Index an element by its corresponding row. | 267 | /// Index an element by its corresponding row. |
251 | /// </summary> | 268 | /// </summary> |
252 | /// <param name="row">The row corresponding to the element.</param> | 269 | /// <param name="row">The row corresponding to the element.</param> |
253 | /// <param name="element">The element to index.</param> | 270 | /// <param name="element">The element to index.</param> |
254 | public void IndexElement(WixToolset.Data.WindowsInstaller.Row row, XElement element) | 271 | private void IndexElement(WixToolset.Data.WindowsInstaller.Row row, XElement element) |
255 | { | 272 | { |
256 | this.IndexedElements.Add(String.Concat(row.TableDefinition.Name, ':', row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)), element); | 273 | this.IndexedElements.Add(String.Concat(row.TableDefinition.Name, ':', row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter)), element); |
257 | } | 274 | } |
@@ -261,7 +278,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
261 | /// </summary> | 278 | /// </summary> |
262 | /// <param name="row">The row corresponding to the element.</param> | 279 | /// <param name="row">The row corresponding to the element.</param> |
263 | /// <param name="element">The element to index.</param> | 280 | /// <param name="element">The element to index.</param> |
264 | public void IndexElement(XElement element, string table, params string[] primaryKey) | 281 | private void IndexElement(XElement element, string table, params string[] primaryKey) |
265 | { | 282 | { |
266 | this.IndexedElements.Add(String.Concat(table, ':', String.Join(DecompilerConstants.PrimaryKeyDelimiterString, primaryKey)), element); | 283 | this.IndexedElements.Add(String.Concat(table, ':', String.Join(DecompilerConstants.PrimaryKeyDelimiterString, primaryKey)), element); |
267 | } | 284 | } |
@@ -3004,20 +3021,10 @@ namespace WixToolset.Core.WindowsInstaller | |||
3004 | xPackage.SetAttributeValue("Languages", template[template.Length - 1]); | 3021 | xPackage.SetAttributeValue("Languages", template[template.Length - 1]); |
3005 | } | 3022 | } |
3006 | 3023 | ||
3007 | if (1 < template.Length && null != template[0] && 0 < template[0].Length) | 3024 | var platform = GetPlatformFromTemplateSummaryInformation(template).ToString().ToLowerInvariant(); |
3025 | if (!String.IsNullOrEmpty(platform)) | ||
3008 | { | 3026 | { |
3009 | switch (template[0]) | 3027 | xPackage.SetAttributeValue("Platform", platform); |
3010 | { | ||
3011 | case "Intel": | ||
3012 | xPackage.SetAttributeValue("Platform", "x86"); | ||
3013 | break; | ||
3014 | case "x64": | ||
3015 | xPackage.SetAttributeValue("Platform", "x64"); | ||
3016 | break; | ||
3017 | case "Arm64": | ||
3018 | xPackage.SetAttributeValue("Platform", "arm64"); | ||
3019 | break; | ||
3020 | } | ||
3021 | } | 3028 | } |
3022 | break; | 3029 | break; |
3023 | case 9: | 3030 | case 9: |