aboutsummaryrefslogtreecommitdiff
path: root/src/wixext/UIDecompiler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/wixext/UIDecompiler.cs')
-rw-r--r--src/wixext/UIDecompiler.cs57
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
3namespace 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}