From 9d5d059a2147aa0fe38f7103148c020b66455e83 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 12 Jan 2019 11:11:10 -0600 Subject: Import code from old v4 repo --- src/wixext/UIDecompiler.cs | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/wixext/UIDecompiler.cs (limited to 'src/wixext/UIDecompiler.cs') 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 @@ +// 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.Extensions +{ + using System; + using System.Collections; + using System.Diagnostics; + using System.Globalization; + using WixToolset.Data; + using WixToolset.Extensibility; + using Wix = WixToolset.Data.Serialize; + + /// + /// The decompiler for the WiX Toolset UI Extension. + /// + public sealed class UIDecompiler : DecompilerExtension + { + private bool removeLibraryRows; + + /// + /// Get the extensions library to be removed. + /// + /// Table definitions for library. + /// Library to remove from decompiled output. + public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) + { + return removeLibraryRows ? UIExtensionData.GetExtensionLibrary(tableDefinitions) : null; + } + + /// + /// Called at the beginning of the decompilation of a database. + /// + /// The collection of all tables. + public override void Initialize(TableIndexedCollection tables) + { + Table propertyTable = tables["Property"]; + + if (null != propertyTable) + { + foreach (Row row in propertyTable.Rows) + { + if ("WixUI_Mode" == (string)row[0]) + { + Wix.UIRef uiRef = new Wix.UIRef(); + + uiRef.Id = String.Concat("WixUI_", (string)row[1]); + + this.Core.RootElement.AddChild(uiRef); + this.removeLibraryRows = true; + + break; + } + } + } + } + } +} -- cgit v1.2.3-55-g6feb