main
cs 33 lines 1.08 KB
Raw
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 WixToolset.Core.WindowsInstaller
4 {
5 using System;
6 using WixToolset.Extensibility;
7
8 internal class WindowsInstallerExtensionFactory : IExtensionFactory
9 {
10 public WindowsInstallerExtensionFactory(IServiceProvider serviceProvider)
11 {
12 this.ServiceProvider = serviceProvider;
13 }
14
15 private IServiceProvider ServiceProvider { get; }
16
17 public bool TryCreateExtension(Type extensionType, out object extension)
18 {
19 extension = null;
20
21 if (extensionType == typeof(IExtensionCommandLine))
22 {
23 extension = new WindowsInstallerExtensionCommandLine(this.ServiceProvider);
24 }
25 else if (extensionType == typeof(IBackendFactory))
26 {
27 extension = new WindowsInstallerBackendFactory();
28 }
29
30 return extension != null;
31 }
32 }
33 }