From 592c6e2f7407c291a7bf9ef4c8ce50da9798cc68 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 3 May 2021 17:00:34 -0700 Subject: Move UI.wixext into ext --- src/ext/UI/wixext/UIDecompiler.cs | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/ext/UI/wixext/UIDecompiler.cs (limited to 'src/ext/UI/wixext/UIDecompiler.cs') diff --git a/src/ext/UI/wixext/UIDecompiler.cs b/src/ext/UI/wixext/UIDecompiler.cs new file mode 100644 index 00000000..2493e7c7 --- /dev/null +++ b/src/ext/UI/wixext/UIDecompiler.cs @@ -0,0 +1,59 @@ +// 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 +{ +#if TODO_CONSIDER_DECOMPILER + 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; + } + } + } + } + } +#endif +} -- cgit v1.2.3-55-g6feb