diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2019-01-12 11:11:10 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2019-01-12 11:11:10 -0600 |
| commit | 9d5d059a2147aa0fe38f7103148c020b66455e83 (patch) | |
| tree | 7673cb14721cf21df43fdfc1c0bcad572817fecc /src/wixext/UIDecompiler.cs | |
| parent | de844c32ea0afe45a2deb1b25e6bdd267b7df103 (diff) | |
| download | wix-9d5d059a2147aa0fe38f7103148c020b66455e83.tar.gz wix-9d5d059a2147aa0fe38f7103148c020b66455e83.tar.bz2 wix-9d5d059a2147aa0fe38f7103148c020b66455e83.zip | |
Import code from old v4 repo
Diffstat (limited to 'src/wixext/UIDecompiler.cs')
| -rw-r--r-- | src/wixext/UIDecompiler.cs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/wixext/UIDecompiler.cs b/src/wixext/UIDecompiler.cs new file mode 100644 index 00000000..4bdd48fc --- /dev/null +++ b/src/wixext/UIDecompiler.cs | |||
| @@ -0,0 +1,57 @@ | |||
| 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 | |||
| 3 | namespace WixToolset.Extensions | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections; | ||
| 7 | using System.Diagnostics; | ||
| 8 | using System.Globalization; | ||
| 9 | using WixToolset.Data; | ||
| 10 | using WixToolset.Extensibility; | ||
| 11 | using Wix = WixToolset.Data.Serialize; | ||
| 12 | |||
| 13 | /// <summary> | ||
| 14 | /// The decompiler for the WiX Toolset UI Extension. | ||
| 15 | /// </summary> | ||
| 16 | public sealed class UIDecompiler : DecompilerExtension | ||
| 17 | { | ||
| 18 | private bool removeLibraryRows; | ||
| 19 | |||
| 20 | /// <summary> | ||
| 21 | /// Get the extensions library to be removed. | ||
| 22 | /// </summary> | ||
| 23 | /// <param name="tableDefinitions">Table definitions for library.</param> | ||
| 24 | /// <returns>Library to remove from decompiled output.</returns> | ||
| 25 | public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) | ||
| 26 | { | ||
| 27 | return removeLibraryRows ? UIExtensionData.GetExtensionLibrary(tableDefinitions) : null; | ||
| 28 | } | ||
| 29 | |||
| 30 | /// <summary> | ||
| 31 | /// Called at the beginning of the decompilation of a database. | ||
| 32 | /// </summary> | ||
| 33 | /// <param name="tables">The collection of all tables.</param> | ||
| 34 | public override void Initialize(TableIndexedCollection tables) | ||
| 35 | { | ||
| 36 | Table propertyTable = tables["Property"]; | ||
| 37 | |||
| 38 | if (null != propertyTable) | ||
| 39 | { | ||
| 40 | foreach (Row row in propertyTable.Rows) | ||
| 41 | { | ||
| 42 | if ("WixUI_Mode" == (string)row[0]) | ||
| 43 | { | ||
| 44 | Wix.UIRef uiRef = new Wix.UIRef(); | ||
| 45 | |||
| 46 | uiRef.Id = String.Concat("WixUI_", (string)row[1]); | ||
| 47 | |||
| 48 | this.Core.RootElement.AddChild(uiRef); | ||
| 49 | this.removeLibraryRows = true; | ||
| 50 | |||
| 51 | break; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | } | ||
| 55 | } | ||
| 56 | } | ||
| 57 | } | ||
