From dbde9e7104b907bbbaea17e21247d8cafc8b3a4c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 14 Oct 2017 16:12:07 -0700 Subject: Massive refactoring to introduce the concept of IBackend --- .../WindowsInstallerBackendFactory.cs | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs (limited to 'src/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs') diff --git a/src/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs b/src/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs new file mode 100644 index 00000000..b66a4617 --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs @@ -0,0 +1,50 @@ +// 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.WindowsInstaller +{ + using System; + using System.IO; + using WixToolset.Extensibility; + + internal class WindowsInstallerBackendFactory : IBackendFactory + { + public bool TryCreateBackend(string outputType, string outputFile, IBindContext context, out IBackend backend) + { + if (String.IsNullOrEmpty(outputType)) + { + outputType = Path.GetExtension(outputFile); + } + + switch (outputType.ToLowerInvariant()) + { + case "module": + case ".msm": + backend = new MsmBackend(); + return true; + + case "msipackage": + case "product": + case ".msi": + backend = new MsiBackend(); + return true; + + case "patch": + case ".msp": + backend = new MspBackend(); + return true; + + //case "patchcreation": + //case ".pcp": + // return new PatchCreationBackend(); + + case "transform": + case ".mst": + backend = new MstBackend(); + return true; + } + + backend = null; + return false; + } + } +} -- cgit v1.2.3-55-g6feb