diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-12-06 11:39:26 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-12-06 11:40:03 -0800 |
| commit | 5ba862bfa618c89a563d555e8ce7b44a904df406 (patch) | |
| tree | cc2655422be3eec1f200efcbc0e562349c229274 /src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs | |
| parent | e53afb01c6e01bb9e6521fa77d31e575abc73f9c (diff) | |
| download | wix-5ba862bfa618c89a563d555e8ce7b44a904df406.tar.gz wix-5ba862bfa618c89a563d555e8ce7b44a904df406.tar.bz2 wix-5ba862bfa618c89a563d555e8ce7b44a904df406.zip | |
Add support for loading Intermediates from extensions
Diffstat (limited to 'src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs')
| -rw-r--r-- | src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs b/src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs new file mode 100644 index 00000000..53394ea3 --- /dev/null +++ b/src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs | |||
| @@ -0,0 +1,46 @@ | |||
| 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 Example.Extension | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using WixToolset.Extensibility; | ||
| 8 | using WixToolset.Extensibility.Services; | ||
| 9 | |||
| 10 | internal class ExamplePreprocessorExtensionAndCommandLine : BasePreprocessorExtension, IExtensionCommandLine | ||
| 11 | { | ||
| 12 | private string exampleValueFromCommandLine; | ||
| 13 | |||
| 14 | public IEnumerable<ExtensionCommandLineSwitch> CommandLineSwitches => throw new NotImplementedException(); | ||
| 15 | |||
| 16 | public ExamplePreprocessorExtensionAndCommandLine() | ||
| 17 | { | ||
| 18 | this.Prefixes = new[] { "ex" }; | ||
| 19 | } | ||
| 20 | |||
| 21 | public void PreParse(ICommandLineContext context) | ||
| 22 | { | ||
| 23 | } | ||
| 24 | |||
| 25 | public bool TryParseArgument(IParseCommandLine parseCommandLine, string arg) | ||
| 26 | { | ||
| 27 | if (parseCommandLine.IsSwitch(arg) && arg.Substring(1).Equals("example", StringComparison.OrdinalIgnoreCase)) | ||
| 28 | { | ||
| 29 | parseCommandLine.GetNextArgumentOrError(ref this.exampleValueFromCommandLine); | ||
| 30 | return true; | ||
| 31 | } | ||
| 32 | |||
| 33 | return false; | ||
| 34 | } | ||
| 35 | |||
| 36 | public override string GetVariableValue(string prefix, string name) | ||
| 37 | { | ||
| 38 | if (prefix == "ex" && "test".Equals(name, StringComparison.OrdinalIgnoreCase)) | ||
| 39 | { | ||
| 40 | return String.IsNullOrWhiteSpace(this.exampleValueFromCommandLine) ? "(null)" : this.exampleValueFromCommandLine; | ||
| 41 | } | ||
| 42 | |||
| 43 | return null; | ||
| 44 | } | ||
| 45 | } | ||
| 46 | } \ No newline at end of file | ||
