main
cs 59 lines 1.99 KB
Raw
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 #if TODO_CONSIDER_DECOMPILER
6 using System;
7 using System.Collections;
8 using System.Diagnostics;
9 using System.Globalization;
10 using WixToolset.Data;
11 using WixToolset.Extensibility;
12 using Wix = WixToolset.Data.Serialize;
13
14 /// <summary>
15 /// The decompiler for the WiX Toolset UI Extension.
16 /// </summary>
17 public sealed class UIDecompiler : DecompilerExtension
18 {
19 private bool removeLibraryRows;
20
21 /// <summary>
22 /// Get the extensions library to be removed.
23 /// </summary>
24 /// <param name="tableDefinitions">Table definitions for library.</param>
25 /// <returns>Library to remove from decompiled output.</returns>
26 public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions)
27 {
28 return removeLibraryRows ? UIExtensionData.GetExtensionLibrary(tableDefinitions) : null;
29 }
30
31 /// <summary>
32 /// Called at the beginning of the decompilation of a database.
33 /// </summary>
34 /// <param name="tables">The collection of all tables.</param>
35 public override void Initialize(TableIndexedCollection tables)
36 {
37 Table propertyTable = tables["Property"];
38
39 if (null != propertyTable)
40 {
41 foreach (Row row in propertyTable.Rows)
42 {
43 if ("WixUI_Mode" == (string)row[0])
44 {
45 Wix.UIRef uiRef = new Wix.UIRef();
46
47 uiRef.Id = String.Concat("WixUI_", (string)row[1]);
48
49 this.Core.RootElement.AddChild(uiRef);
50 this.removeLibraryRows = true;
51
52 break;
53 }
54 }
55 }
56 }
57 }
58 #endif
59 }