aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.ExtensionCache/ExtensionCacheManagerExtensionFactory.cs
blob: c38e5c7046d5abf27ea20d9e5efea9066eb9c0ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// 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 WixToolset.Core.ExtensionCache
{
    using System;
    using WixToolset.Extensibility;
    using WixToolset.Extensibility.Services;

    internal class ExtensionCacheManagerExtensionFactory : IExtensionFactory
    {
        public ExtensionCacheManagerExtensionFactory(IServiceProvider serviceProvider)
        {
            this.ServiceProvider = serviceProvider;
        }

        private IServiceProvider ServiceProvider { get; }

        public bool TryCreateExtension(Type extensionType, out object extension)
        {
            extension = null;

            if (extensionType == typeof(IExtensionCommandLine))
            {
                extension = new ExtensionCacheManagerExtensionCommandLine(this.ServiceProvider);
            }

            return extension != null;
        }
    }
}