diff options
Diffstat (limited to 'src/test/Example.Extension/ExampleExtensionFactory.cs')
| -rw-r--r-- | src/test/Example.Extension/ExampleExtensionFactory.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/Example.Extension/ExampleExtensionFactory.cs b/src/test/Example.Extension/ExampleExtensionFactory.cs new file mode 100644 index 00000000..9539ee85 --- /dev/null +++ b/src/test/Example.Extension/ExampleExtensionFactory.cs | |||
| @@ -0,0 +1,32 @@ | |||
| 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 | public bool TryCreateExtension(Type extensionType, out object extension) | ||
| 11 | { | ||
| 12 | if (extensionType == typeof(IPreprocessorExtension)) | ||
| 13 | { | ||
| 14 | extension = new ExamplePreprocessorExtension(); | ||
| 15 | } | ||
| 16 | else if (extensionType == typeof(ICompilerExtension)) | ||
| 17 | { | ||
| 18 | extension = new ExampleCompilerExtension(); | ||
| 19 | } | ||
| 20 | else if (extensionType == typeof(IExtensionData)) | ||
| 21 | { | ||
| 22 | extension = new ExampleExtensionData(); | ||
| 23 | } | ||
| 24 | else | ||
| 25 | { | ||
| 26 | extension = null; | ||
| 27 | } | ||
| 28 | |||
| 29 | return extension != null; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | } | ||
