// 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. namespace WixToolset.DirectX { using System; using System.Collections.Generic; using System.Xml.Linq; using WixToolset.Data; using WixToolset.Extensibility; using WixToolset.Extensibility.Data; /// /// The compiler for the WiX Toolset DirectX Extension. /// public sealed class DirectXCompiler : BaseCompilerExtension { public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/directx"; /// /// Processes an element for the Compiler. /// /// Parent element of element to process. /// Element to process. /// Extra information about the context in which this element is being parsed. public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { switch (parentElement.Name.LocalName) { case "Fragment": case "Module": case "Package": case "UI": this.AddCustomActionReference(intermediate, section, element, parentElement); break; default: this.ParseHelper.UnexpectedElement(parentElement, element); break; } } private void AddCustomActionReference(Intermediate intermediate, IntermediateSection section, XElement element, XElement parentElement) { var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); switch (element.Name.LocalName) { case "GetCapabilities": this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4QueryDirectXCaps", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); break; default: this.ParseHelper.UnexpectedElement(parentElement, element); break; } foreach (var attrib in element.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) { // no attributes today } else { this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib); } } this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); } } }