diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-08-20 14:22:07 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-08-20 14:25:49 -0700 |
| commit | 3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c (patch) | |
| tree | bbe907a4c5ebf7aa5e3f02141f6e3abd31cb7b5c /src/WixToolset.Extensibility/CompilerExtension.cs | |
| parent | 6dee3b45cb679786bd49a5db8fde9006d283b3e2 (diff) | |
| download | wix-3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c.tar.gz wix-3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c.tar.bz2 wix-3e1c5e3fa80a2498f7d6aac5c0f8ca9e3bd7c66c.zip | |
Move to .NET Core 2.0
Diffstat (limited to 'src/WixToolset.Extensibility/CompilerExtension.cs')
| -rw-r--r-- | src/WixToolset.Extensibility/CompilerExtension.cs | 74 |
1 files changed, 74 insertions, 0 deletions
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 @@ | |||
| 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.Extensibility | ||
| 4 | { | ||
| 5 | using System.Collections.Generic; | ||
| 6 | using System.Xml.Linq; | ||
| 7 | |||
| 8 | /// <summary> | ||
| 9 | /// Base class for creating a compiler extension. | ||
| 10 | /// </summary> | ||
| 11 | public abstract class CompilerExtension : ICompilerExtension | ||
| 12 | { | ||
| 13 | /// <summary> | ||
| 14 | /// Gets or sets the compiler core for the extension. | ||
| 15 | /// </summary> | ||
| 16 | /// <value>Compiler core for the extension.</value> | ||
| 17 | public ICompilerCore Core { get; set; } | ||
| 18 | |||
| 19 | /// <summary> | ||
| 20 | /// Gets the schema namespace for this extension. | ||
| 21 | /// </summary> | ||
| 22 | /// <value>Schema namespace supported by this extension.</value> | ||
| 23 | public XNamespace Namespace { get; protected set; } | ||
| 24 | |||
| 25 | /// <summary> | ||
| 26 | /// Called at the beginning of the compilation of a source file. | ||
| 27 | /// </summary> | ||
| 28 | public virtual void Initialize() | ||
| 29 | { | ||
| 30 | } | ||
| 31 | |||
| 32 | /// <summary> | ||
| 33 | /// Processes an attribute for the Compiler. | ||
| 34 | /// </summary> | ||
| 35 | /// <param name="parentElement">Parent element of attribute.</param> | ||
| 36 | /// <param name="attribute">Attribute to process.</param> | ||
| 37 | /// <param name="context">Extra information about the context in which this element is being parsed.</param> | ||
| 38 | public virtual void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary<string, string> context) | ||
| 39 | { | ||
| 40 | this.Core.UnexpectedAttribute(parentElement, attribute); | ||
| 41 | } | ||
| 42 | |||
| 43 | /// <summary> | ||
| 44 | /// Processes an element for the Compiler. | ||
| 45 | /// </summary> | ||
| 46 | /// <param name="parentElement">Parent element of element to process.</param> | ||
| 47 | /// <param name="element">Element to process.</param> | ||
| 48 | /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param> | ||
| 49 | public virtual void ParseElement(XElement parentElement, XElement element, IDictionary<string, string> context) | ||
| 50 | { | ||
| 51 | this.Core.UnexpectedElement(parentElement, element); | ||
| 52 | } | ||
| 53 | |||
| 54 | /// <summary> | ||
| 55 | /// Processes an element for the Compiler, with the ability to supply a component keypath. | ||
| 56 | /// </summary> | ||
| 57 | /// <param name="parentElement">Parent element of element to process.</param> | ||
| 58 | /// <param name="element">Element to process.</param> | ||
| 59 | /// <param name="keyPath">Explicit key path.</param> | ||
| 60 | /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param> | ||
| 61 | public virtual ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary<string, string> context) | ||
| 62 | { | ||
| 63 | this.ParseElement(parentElement, element, context); | ||
| 64 | return null; | ||
| 65 | } | ||
| 66 | |||
| 67 | /// <summary> | ||
| 68 | /// Called at the end of the compilation of a source file. | ||
| 69 | /// </summary> | ||
| 70 | public virtual void Finish() | ||
| 71 | { | ||
| 72 | } | ||
| 73 | } | ||
| 74 | } | ||
