diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-05-04 22:45:02 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-05-04 22:45:02 -0700 |
| commit | fe2f7e06c595a4e7115d83c4cc8a05b28db5002a (patch) | |
| tree | 8f46339d2ccbc2ec97c9e77e857bd72f07412a2e /src/ext/DirectX/wixext | |
| parent | 232ea0120f67d4d445fd5fbb09a8852b2668310a (diff) | |
| download | wix-fe2f7e06c595a4e7115d83c4cc8a05b28db5002a.tar.gz wix-fe2f7e06c595a4e7115d83c4cc8a05b28db5002a.tar.bz2 wix-fe2f7e06c595a4e7115d83c4cc8a05b28db5002a.zip | |
Move DirectX.wixext into ext
Diffstat (limited to 'src/ext/DirectX/wixext')
| -rw-r--r-- | src/ext/DirectX/wixext/DirectXDecompiler.cs | 72 | ||||
| -rw-r--r-- | src/ext/DirectX/wixext/DirectXExtensionData.cs | 24 | ||||
| -rw-r--r-- | src/ext/DirectX/wixext/DirectXExtensionFactory.cs | 16 | ||||
| -rw-r--r-- | src/ext/DirectX/wixext/WixToolset.DirectX.wixext.csproj | 31 | ||||
| -rw-r--r-- | src/ext/DirectX/wixext/WixToolset.DirectX.wixext.targets | 11 |
5 files changed, 154 insertions, 0 deletions
diff --git a/src/ext/DirectX/wixext/DirectXDecompiler.cs b/src/ext/DirectX/wixext/DirectXDecompiler.cs new file mode 100644 index 00000000..03f90163 --- /dev/null +++ b/src/ext/DirectX/wixext/DirectXDecompiler.cs | |||
| @@ -0,0 +1,72 @@ | |||
| 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.DirectX | ||
| 4 | { | ||
| 5 | #if TODO_CONSIDER_DECOMPILER | ||
| 6 | using System; | ||
| 7 | using System.Text; | ||
| 8 | using WixToolset.Data; | ||
| 9 | using WixToolset.Extensibility; | ||
| 10 | using Wix = WixToolset.Data.Serialize; | ||
| 11 | |||
| 12 | /// <summary> | ||
| 13 | /// The WiX Toolset DirectX Extension. | ||
| 14 | /// </summary> | ||
| 15 | public sealed class DirectXDecompiler : DecompilerExtension | ||
| 16 | { | ||
| 17 | /// <summary> | ||
| 18 | /// Get the extensions library to be removed. | ||
| 19 | /// </summary> | ||
| 20 | /// <param name="tableDefinitions">Table definitions for library.</param> | ||
| 21 | /// <returns>Library to remove from decompiled output.</returns> | ||
| 22 | public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) | ||
| 23 | { | ||
| 24 | return DirectXExtensionData.GetExtensionLibrary(tableDefinitions); | ||
| 25 | } | ||
| 26 | |||
| 27 | /// <summary> | ||
| 28 | /// Called at the beginning of the decompilation of a database. | ||
| 29 | /// </summary> | ||
| 30 | /// <param name="tables">The collection of all tables.</param> | ||
| 31 | public override void Initialize(TableIndexedCollection tables) | ||
| 32 | { | ||
| 33 | Table propertyTable = tables["Property"]; | ||
| 34 | |||
| 35 | if (null != propertyTable) | ||
| 36 | { | ||
| 37 | foreach (Row row in propertyTable.Rows) | ||
| 38 | { | ||
| 39 | if ("SecureCustomProperties" == row[0].ToString()) | ||
| 40 | { | ||
| 41 | // if we've referenced any of the DirectX properties, add | ||
| 42 | // a PropertyRef to pick up the CA from the extension and then remove | ||
| 43 | // it from the SecureCustomExtensions property so we don't get duplicates | ||
| 44 | StringBuilder remainingProperties = new StringBuilder(); | ||
| 45 | string[] secureCustomProperties = row[1].ToString().Split(';'); | ||
| 46 | foreach (string property in secureCustomProperties) | ||
| 47 | { | ||
| 48 | if (property.StartsWith("WIX_DIRECTX_")) | ||
| 49 | { | ||
| 50 | Wix.PropertyRef propertyRef = new Wix.PropertyRef(); | ||
| 51 | propertyRef.Id = property; | ||
| 52 | this.Core.RootElement.AddChild(propertyRef); | ||
| 53 | } | ||
| 54 | else | ||
| 55 | { | ||
| 56 | if (0 < remainingProperties.Length) | ||
| 57 | { | ||
| 58 | remainingProperties.Append(";"); | ||
| 59 | } | ||
| 60 | remainingProperties.Append(property); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | |||
| 64 | row[1] = remainingProperties.ToString(); | ||
| 65 | break; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | } | ||
| 69 | } | ||
| 70 | } | ||
| 71 | #endif | ||
| 72 | } | ||
diff --git a/src/ext/DirectX/wixext/DirectXExtensionData.cs b/src/ext/DirectX/wixext/DirectXExtensionData.cs new file mode 100644 index 00000000..d61af23f --- /dev/null +++ b/src/ext/DirectX/wixext/DirectXExtensionData.cs | |||
| @@ -0,0 +1,24 @@ | |||
| 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.DirectX | ||
| 4 | { | ||
| 5 | using WixToolset.Data; | ||
| 6 | using WixToolset.Extensibility; | ||
| 7 | |||
| 8 | /// <summary> | ||
| 9 | /// The WiX Toolset DirectX Extension. | ||
| 10 | /// </summary> | ||
| 11 | public sealed class DirectXExtensionData : BaseExtensionData | ||
| 12 | { | ||
| 13 | /// <summary> | ||
| 14 | /// Gets the default culture. | ||
| 15 | /// </summary> | ||
| 16 | /// <value>The default culture.</value> | ||
| 17 | public override string DefaultCulture => "en-US"; | ||
| 18 | |||
| 19 | public override Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) | ||
| 20 | { | ||
| 21 | return Intermediate.Load(typeof(DirectXExtensionData).Assembly, "WixToolset.DirectX.directx.wixlib", symbolDefinitions); | ||
| 22 | } | ||
| 23 | } | ||
| 24 | } | ||
diff --git a/src/ext/DirectX/wixext/DirectXExtensionFactory.cs b/src/ext/DirectX/wixext/DirectXExtensionFactory.cs new file mode 100644 index 00000000..fb7f84aa --- /dev/null +++ b/src/ext/DirectX/wixext/DirectXExtensionFactory.cs | |||
| @@ -0,0 +1,16 @@ | |||
| 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.DirectX | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using WixToolset.Extensibility; | ||
| 8 | |||
| 9 | public class DirectXExtensionFactory : BaseExtensionFactory | ||
| 10 | { | ||
| 11 | protected override IReadOnlyCollection<Type> ExtensionTypes => new[] | ||
| 12 | { | ||
| 13 | typeof(DirectXExtensionData), | ||
| 14 | }; | ||
| 15 | } | ||
| 16 | } | ||
diff --git a/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.csproj b/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.csproj new file mode 100644 index 00000000..a848ff9a --- /dev/null +++ b/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.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 | <Project Sdk="Microsoft.NET.Sdk"> | ||
| 5 | <PropertyGroup> | ||
| 6 | <TargetFramework>netstandard2.0</TargetFramework> | ||
| 7 | <RootNamespace>WixToolset.DirectX</RootNamespace> | ||
| 8 | <Description>WiX Toolset DirectX Extension</Description> | ||
| 9 | <Title>WiX Toolset DirectX Extension</Title> | ||
| 10 | <IsTool>true</IsTool> | ||
| 11 | <ContentTargetFolders>build</ContentTargetFolders> | ||
| 12 | </PropertyGroup> | ||
| 13 | |||
| 14 | <ItemGroup> | ||
| 15 | <Content Include="$(MSBuildThisFileName).targets" /> | ||
| 16 | <EmbeddedResource Include="$(OutputPath)..\directx.wixlib" /> | ||
| 17 | </ItemGroup> | ||
| 18 | |||
| 19 | <ItemGroup> | ||
| 20 | <PackageReference Include="WixToolset.Data" Version="4.0.*" PrivateAssets="all" /> | ||
| 21 | <PackageReference Include="WixToolset.Extensibility" Version="4.0.*" PrivateAssets="all" /> | ||
| 22 | </ItemGroup> | ||
| 23 | |||
| 24 | <ItemGroup> | ||
| 25 | <ProjectReference Include="..\wixlib\directx.wixproj" ReferenceOutputAssembly="false" Condition=" '$(NCrunch)'=='' " /> | ||
| 26 | </ItemGroup> | ||
| 27 | |||
| 28 | <ItemGroup> | ||
| 29 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> | ||
| 30 | </ItemGroup> | ||
| 31 | </Project> | ||
diff --git a/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.targets b/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.targets new file mode 100644 index 00000000..4e27a6da --- /dev/null +++ b/src/ext/DirectX/wixext/WixToolset.DirectX.wixext.targets | |||
| @@ -0,0 +1,11 @@ | |||
| 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 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
| 5 | <PropertyGroup> | ||
| 6 | <WixToolsetDirectXWixextPath Condition=" '$(WixToolsetDirectXWixextPath)' == '' ">$(MSBuildThisFileDirectory)..\tools\WixToolset.DirectX.wixext.dll</WixToolsetDirectXWixextPath> | ||
| 7 | </PropertyGroup> | ||
| 8 | <ItemGroup> | ||
| 9 | <WixExtension Include="$(WixToolsetDirectXWixextPath)" /> | ||
| 10 | </ItemGroup> | ||
| 11 | </Project> | ||
