| 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.Burn |
| 4 | { |
| 5 | using System; |
| 6 | using WixToolset.Extensibility; |
| 7 | |
| 8 | internal class BurnExtensionFactory : IExtensionFactory |
| 9 | { |
| 10 | public BurnExtensionFactory(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 BurnExtensionCommandLine(this.ServiceProvider); |
| 24 | } |
| 25 | else if (extensionType == typeof(IBackendFactory)) |
| 26 | { |
| 27 | extension = new BurnBackendFactory(); |
| 28 | } |
| 29 | |
| 30 | return extension != null; |
| 31 | } |
| 32 | } |
| 33 | } |