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 --- .../PreprocessorExtension.cs | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 src/WixToolset.Extensibility/PreprocessorExtension.cs (limited to 'src/WixToolset.Extensibility/PreprocessorExtension.cs') diff --git a/src/WixToolset.Extensibility/PreprocessorExtension.cs b/src/WixToolset.Extensibility/PreprocessorExtension.cs new file mode 100644 index 00000000..2af30a95 --- /dev/null +++ b/src/WixToolset.Extensibility/PreprocessorExtension.cs @@ -0,0 +1,99 @@ +// 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.Xml.Linq; + using WixToolset.Data; + + /// + /// Base class for creating a preprocessor extension. + /// + public abstract class PreprocessorExtension : IPreprocessorExtension + { + /// + /// Gets or sets the preprocessor core for the extension. + /// + /// Preprocessor core for the extension. + public IPreprocessorCore Core { get; set; } + + /// + /// Gets or sets the variable prefixes for the extension. + /// + /// The variable prefixes for the extension. + public virtual string[] Prefixes + { + get { return null; } + } + + /// + /// Called at the beginning of the preprocessing of a source file. + /// + public virtual void Initialize() + { + } + + /// + /// Gets the value of a variable whose prefix matches the extension. + /// + /// The prefix of the variable to be processed by the extension. + /// The name of the variable. + /// The value of the variable or null if the variable is undefined. + public virtual string GetVariableValue(string prefix, string name) + { + return null; + } + + /// + /// Evaluates a function defined in the extension. + /// + /// The prefix of the function to be processed by the extension. + /// The name of the function. + /// The list of arguments. + /// The value of the function or null if the function is not defined. + public virtual string EvaluateFunction(string prefix, string function, string[] args) + { + return null; + } + + /// + /// Processes a pragma defined in the extension. + /// + /// The location of this pragma's PI. + /// The prefix of the pragma to be processed by the extension. + /// The name of the pragma. + /// The pragma's arguments. + /// The parent node of the pragma. + /// false if the pragma is not defined. + /// Don't return false for any condition except for unrecognized pragmas. Throw errors that are fatal to the compile. use core.OnMessage for warnings and messages. + public virtual bool ProcessPragma(SourceLineNumber sourceLineNumbers, string prefix, string pragma, string args, XContainer parent) + { + return false; + } + + /// + /// Preprocess a document after normal preprocessing has completed. + /// + /// The document to preprocess. + public virtual void PreprocessDocument(XDocument document) + { + } + + /// + /// Preprocesses a parameter. + /// + /// Name of parameter that matches extension. + /// The value of the parameter after processing. + /// By default this method will cause an error if its called. + public virtual string PreprocessParameter(string name) + { + return null; + } + + /// + /// Called at the end of the preprocessing of a source file. + /// + public virtual void Finish() + { + } + } +} -- cgit v1.2.3-55-g6feb