diff options
author | Bob Arnson <bob@firegiant.com> | 2022-01-30 17:02:13 -0500 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2022-01-30 17:50:26 -0500 |
commit | bfe5ab76b5ecc1a21078534e6fba90d12cfd3c00 (patch) | |
tree | d05102b0868f2b375d7692c5a47cd0b541d31524 /src/ext/DirectX/wixext/DirectXCompiler.cs | |
parent | 7ce477c6863c74ef0a50d117d8c28b2f19971b42 (diff) | |
download | wix-bfe5ab76b5ecc1a21078534e6fba90d12cfd3c00.tar.gz wix-bfe5ab76b5ecc1a21078534e6fba90d12cfd3c00.tar.bz2 wix-bfe5ab76b5ecc1a21078534e6fba90d12cfd3c00.zip |
Add platform-specific CAs and compiler extension.
https://github.com/wixtoolset/issues/issues/5933
Diffstat (limited to 'src/ext/DirectX/wixext/DirectXCompiler.cs')
-rw-r--r-- | src/ext/DirectX/wixext/DirectXCompiler.cs | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/ext/DirectX/wixext/DirectXCompiler.cs b/src/ext/DirectX/wixext/DirectXCompiler.cs new file mode 100644 index 00000000..968683bd --- /dev/null +++ b/src/ext/DirectX/wixext/DirectXCompiler.cs | |||
@@ -0,0 +1,70 @@ | |||
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 System.Xml.Linq; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Extensibility; | ||
10 | using WixToolset.Extensibility.Data; | ||
11 | |||
12 | /// <summary> | ||
13 | /// The compiler for the WiX Toolset DirectX Extension. | ||
14 | /// </summary> | ||
15 | public sealed class DirectXCompiler : BaseCompilerExtension | ||
16 | { | ||
17 | public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/directx"; | ||
18 | |||
19 | /// <summary> | ||
20 | /// Processes an element for the Compiler. | ||
21 | /// </summary> | ||
22 | /// <param name="parentElement">Parent element of element to process.</param> | ||
23 | /// <param name="element">Element to process.</param> | ||
24 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | ||
25 | public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context) | ||
26 | { | ||
27 | switch (parentElement.Name.LocalName) | ||
28 | { | ||
29 | case "Fragment": | ||
30 | case "Module": | ||
31 | case "Package": | ||
32 | case "UI": | ||
33 | this.AddCustomActionReference(intermediate, section, element, parentElement); | ||
34 | break; | ||
35 | default: | ||
36 | this.ParseHelper.UnexpectedElement(parentElement, element); | ||
37 | break; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | private void AddCustomActionReference(Intermediate intermediate, IntermediateSection section, XElement element, XElement parentElement) | ||
42 | { | ||
43 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | ||
44 | |||
45 | switch (element.Name.LocalName) | ||
46 | { | ||
47 | case "GetCapabilities": | ||
48 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4QueryDirectXCaps", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); | ||
49 | break; | ||
50 | default: | ||
51 | this.ParseHelper.UnexpectedElement(parentElement, element); | ||
52 | break; | ||
53 | } | ||
54 | |||
55 | foreach (var attrib in element.Attributes()) | ||
56 | { | ||
57 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) | ||
58 | { | ||
59 | // no attributes today | ||
60 | } | ||
61 | else | ||
62 | { | ||
63 | this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); | ||
68 | } | ||
69 | } | ||
70 | } | ||