| 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.ExtensionCache |
| 4 | { |
| 5 | using System; |
| 6 | using WixToolset.Extensibility; |
| 7 | using WixToolset.Extensibility.Services; |
| 8 | |
| 9 | internal class ExtensionCacheManagerExtensionFactory : IExtensionFactory |
| 10 | { |
| 11 | public ExtensionCacheManagerExtensionFactory(IServiceProvider serviceProvider) |
| 12 | { |
| 13 | this.ServiceProvider = serviceProvider; |
| 14 | } |
| 15 | |
| 16 | private IServiceProvider ServiceProvider { get; } |
| 17 | |
| 18 | public bool TryCreateExtension(Type extensionType, out object extension) |
| 19 | { |
| 20 | extension = null; |
| 21 | |
| 22 | if (extensionType == typeof(IExtensionCommandLine)) |
| 23 | { |
| 24 | extension = new ExtensionCacheManagerExtensionCommandLine(this.ServiceProvider); |
| 25 | } |
| 26 | |
| 27 | return extension != null; |
| 28 | } |
| 29 | } |
| 30 | } |