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/ExampleExtensionFactory.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/ExampleExtensionFactory.cs')
| -rw-r--r-- | src/test/TestData/Example.Extension/ExampleExtensionFactory.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs b/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs new file mode 100644 index 00000000..b91d06e9 --- /dev/null +++ b/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs | |||
| @@ -0,0 +1,39 @@ | |||
| 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 WixToolset.Extensibility; | ||
| 7 | |||
| 8 | public class ExampleExtensionFactory : IExtensionFactory | ||
| 9 | { | ||
| 10 | private ExamplePreprocessorExtensionAndCommandLine preprocessorExtension; | ||
| 11 | |||
| 12 | public bool TryCreateExtension(Type extensionType, out object extension) | ||
| 13 | { | ||
| 14 | if (extensionType == typeof(IExtensionCommandLine) || extensionType == typeof(IPreprocessorExtension)) | ||
| 15 | { | ||
| 16 | if (preprocessorExtension == null) | ||
| 17 | { | ||
| 18 | preprocessorExtension = new ExamplePreprocessorExtensionAndCommandLine(); | ||
| 19 | } | ||
| 20 | |||
| 21 | extension = preprocessorExtension; | ||
| 22 | } | ||
| 23 | else if (extensionType == typeof(ICompilerExtension)) | ||
| 24 | { | ||
| 25 | extension = new ExampleCompilerExtension(); | ||
| 26 | } | ||
| 27 | else if (extensionType == typeof(IExtensionData)) | ||
| 28 | { | ||
| 29 | extension = new ExampleExtensionData(); | ||
| 30 | } | ||
| 31 | else | ||
| 32 | { | ||
| 33 | extension = null; | ||
| 34 | } | ||
| 35 | |||
| 36 | return extension != null; | ||
| 37 | } | ||
| 38 | } | ||
| 39 | } | ||
