aboutsummaryrefslogtreecommitdiff
path: root/src/wixext
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2019-01-12 11:11:10 -0600
committerSean Hall <r.sean.hall@gmail.com>2019-01-12 11:11:10 -0600
commit9d5d059a2147aa0fe38f7103148c020b66455e83 (patch)
tree7673cb14721cf21df43fdfc1c0bcad572817fecc /src/wixext
parentde844c32ea0afe45a2deb1b25e6bdd267b7df103 (diff)
downloadwix-9d5d059a2147aa0fe38f7103148c020b66455e83.tar.gz
wix-9d5d059a2147aa0fe38f7103148c020b66455e83.tar.bz2
wix-9d5d059a2147aa0fe38f7103148c020b66455e83.zip
Import code from old v4 repo
Diffstat (limited to 'src/wixext')
-rw-r--r--src/wixext/UIDecompiler.cs57
-rw-r--r--src/wixext/UIExtensionData.cs43
-rw-r--r--src/wixext/WixUIExtension.csproj31
3 files changed, 131 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}
diff --git a/src/wixext/UIExtensionData.cs b/src/wixext/UIExtensionData.cs
new file mode 100644
index 00000000..a833b82b
--- /dev/null
+++ b/src/wixext/UIExtensionData.cs
@@ -0,0 +1,43 @@
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.Reflection;
7 using WixToolset.Data;
8 using WixToolset.Extensibility;
9
10 /// <summary>
11 /// The WiX Toolset UI Extension.
12 /// </summary>
13 public sealed class UIExtensionData : ExtensionData
14 {
15 /// <summary>
16 /// Gets the default culture.
17 /// </summary>
18 /// <value>The default culture.</value>
19 public override string DefaultCulture
20 {
21 get { return "en-us"; }
22 }
23
24 /// <summary>
25 /// Gets the library associated with this extension.
26 /// </summary>
27 /// <param name="tableDefinitions">The table definitions to use while loading the library.</param>
28 /// <returns>The loaded library.</returns>
29 public override Library GetLibrary(TableDefinitionCollection tableDefinitions)
30 {
31 return UIExtensionData.GetExtensionLibrary(tableDefinitions);
32 }
33
34 /// <summary>
35 /// Internal mechanism to access the extension's library.
36 /// </summary>
37 /// <returns>Extension's library.</returns>
38 internal static Library GetExtensionLibrary(TableDefinitionCollection tableDefinitions)
39 {
40 return ExtensionData.LoadLibraryHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.ui.wixlib", tableDefinitions);
41 }
42 }
43}
diff --git a/src/wixext/WixUIExtension.csproj b/src/wixext/WixUIExtension.csproj
new file mode 100644
index 00000000..ba1b5c58
--- /dev/null
+++ b/src/wixext/WixUIExtension.csproj
@@ -0,0 +1,31 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- 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. -->
3
4
5<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
6 <PropertyGroup>
7 <ProjectGuid>{33F6ABF5-FA13-4B73-99FA-F9BBA894DD9A}</ProjectGuid>
8 <AssemblyName>WixUIExtension</AssemblyName>
9 <OutputType>Library</OutputType>
10 <RootNamespace>WixToolset.Extensions</RootNamespace>
11 </PropertyGroup>
12 <ItemGroup>
13 <Compile Include="AssemblyInfo.cs" />
14 <Compile Include="UIDecompiler.cs" />
15 <Compile Include="UIExtensionData.cs" />
16 <EmbeddedResource Include="$(OutputPath)ui.wixlib">
17 <Link>Data\ui.wixlib</Link>
18 </EmbeddedResource>
19 </ItemGroup>
20 <ItemGroup>
21 <Reference Include="System" />
22 <Reference Include="System.Xml" />
23 <ProjectReference Include="..\..\..\libs\WixToolset.Data\WixToolset.Data.csproj" />
24 <ProjectReference Include="..\..\..\libs\WixToolset.Extensibility\WixToolset.Extensibility.csproj" />
25 <ProjectReference Include="..\..\..\tools\wix\Wix.csproj" />
26 <ProjectReference Include="..\wixlib\UIExtension.wixproj">
27 <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
28 </ProjectReference>
29 </ItemGroup>
30 <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.targets" />
31</Project>