aboutsummaryrefslogtreecommitdiff
path: root/src/test/Example.Extension/ExampleExtensionFactory.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-04-22 17:19:56 -0700
committerRob Mensching <rob@firegiant.com>2021-04-29 19:53:52 -0700
commit8cf0427984a88b0b3ddfb2061e5be721afffe82e (patch)
tree22e2aaf7665d5ab6d3dc2a8ce8f05d73080d1f20 /src/test/Example.Extension/ExampleExtensionFactory.cs
parent8426095723fb8530a321260473ab543151bf8c98 (diff)
downloadwix-8cf0427984a88b0b3ddfb2061e5be721afffe82e.tar.gz
wix-8cf0427984a88b0b3ddfb2061e5be721afffe82e.tar.bz2
wix-8cf0427984a88b0b3ddfb2061e5be721afffe82e.zip
Move Core into wix
Diffstat (limited to 'src/test/Example.Extension/ExampleExtensionFactory.cs')
-rw-r--r--src/test/Example.Extension/ExampleExtensionFactory.cs54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/test/Example.Extension/ExampleExtensionFactory.cs b/src/test/Example.Extension/ExampleExtensionFactory.cs
deleted file mode 100644
index e54561ee..00000000
--- a/src/test/Example.Extension/ExampleExtensionFactory.cs
+++ /dev/null
@@ -1,54 +0,0 @@
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
3namespace Example.Extension
4{
5 using System;
6 using WixToolset.Extensibility;
7 using WixToolset.Extensibility.Services;
8
9 public class ExampleExtensionFactory : IExtensionFactory
10 {
11 private ExamplePreprocessorExtensionAndCommandLine preprocessorExtension;
12
13 public ExampleExtensionFactory(IWixToolsetCoreServiceProvider serviceProvider)
14 {
15 this.ServiceProvider = serviceProvider;
16 }
17
18 /// <summary>
19 /// This exists just to show it is possible to get a service provider to the extension factory.
20 /// </summary>
21 private IWixToolsetCoreServiceProvider ServiceProvider { get; }
22
23 public bool TryCreateExtension(Type extensionType, out object extension)
24 {
25 if (extensionType == typeof(IExtensionCommandLine) || extensionType == typeof(IPreprocessorExtension))
26 {
27 if (this.preprocessorExtension == null)
28 {
29 this.preprocessorExtension = new ExamplePreprocessorExtensionAndCommandLine();
30 }
31
32 extension = this.preprocessorExtension;
33 }
34 else if (extensionType == typeof(ICompilerExtension))
35 {
36 extension = new ExampleCompilerExtension();
37 }
38 else if (extensionType == typeof(IExtensionData))
39 {
40 extension = new ExampleExtensionData();
41 }
42 else if (extensionType == typeof(IWindowsInstallerBackendBinderExtension))
43 {
44 extension = new ExampleWindowsInstallerBackendExtension();
45 }
46 else
47 {
48 extension = null;
49 }
50
51 return extension != null;
52 }
53 }
54}