From 3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 20 Aug 2017 14:22:07 -0700 Subject: Move to .NET Core 2.0 --- src/WixToolset.Extensibility/CompilerExtension.cs | 74 +++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/WixToolset.Extensibility/CompilerExtension.cs (limited to 'src/WixToolset.Extensibility/CompilerExtension.cs') diff --git a/src/WixToolset.Extensibility/CompilerExtension.cs b/src/WixToolset.Extensibility/CompilerExtension.cs new file mode 100644 index 00000000..522ffcf8 --- /dev/null +++ b/src/WixToolset.Extensibility/CompilerExtension.cs @@ -0,0 +1,74 @@ +// 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.Extensibility +{ + using System.Collections.Generic; + using System.Xml.Linq; + + /// + /// Base class for creating a compiler extension. + /// + public abstract class CompilerExtension : ICompilerExtension + { + /// + /// Gets or sets the compiler core for the extension. + /// + /// Compiler core for the extension. + public ICompilerCore Core { get; set; } + + /// + /// Gets the schema namespace for this extension. + /// + /// Schema namespace supported by this extension. + public XNamespace Namespace { get; protected set; } + + /// + /// Called at the beginning of the compilation of a source file. + /// + public virtual void Initialize() + { + } + + /// + /// Processes an attribute for the Compiler. + /// + /// Parent element of attribute. + /// Attribute to process. + /// Extra information about the context in which this element is being parsed. + public virtual void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary context) + { + this.Core.UnexpectedAttribute(parentElement, attribute); + } + + /// + /// 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 virtual void ParseElement(XElement parentElement, XElement element, IDictionary context) + { + this.Core.UnexpectedElement(parentElement, element); + } + + /// + /// Processes an element for the Compiler, with the ability to supply a component keypath. + /// + /// Parent element of element to process. + /// Element to process. + /// Explicit key path. + /// Extra information about the context in which this element is being parsed. + public virtual ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary context) + { + this.ParseElement(parentElement, element, context); + return null; + } + + /// + /// Called at the end of the compilation of a source file. + /// + public virtual void Finish() + { + } + } +} -- cgit v1.2.3-55-g6feb