From 5ba862bfa618c89a563d555e8ce7b44a904df406 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 6 Dec 2017 11:39:26 -0800 Subject: Add support for loading Intermediates from extensions --- .../Example.Extension/ExampleExtensionFactory.cs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/test/TestData/Example.Extension/ExampleExtensionFactory.cs (limited to 'src/test/TestData/Example.Extension/ExampleExtensionFactory.cs') 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 @@ +// 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 Example.Extension +{ + using System; + using WixToolset.Extensibility; + + public class ExampleExtensionFactory : IExtensionFactory + { + private ExamplePreprocessorExtensionAndCommandLine preprocessorExtension; + + public bool TryCreateExtension(Type extensionType, out object extension) + { + if (extensionType == typeof(IExtensionCommandLine) || extensionType == typeof(IPreprocessorExtension)) + { + if (preprocessorExtension == null) + { + preprocessorExtension = new ExamplePreprocessorExtensionAndCommandLine(); + } + + extension = preprocessorExtension; + } + else if (extensionType == typeof(ICompilerExtension)) + { + extension = new ExampleCompilerExtension(); + } + else if (extensionType == typeof(IExtensionData)) + { + extension = new ExampleExtensionData(); + } + else + { + extension = null; + } + + return extension != null; + } + } +} -- cgit v1.2.3-55-g6feb