| 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 System.IO; |
| 7 | using WixToolset.Extensibility; |
| 8 | |
| 9 | internal class WindowsInstallerBackendFactory : IBackendFactory |
| 10 | { |
| 11 | public bool TryCreateBackend(string outputType, string outputFile, out IBackend backend) |
| 12 | { |
| 13 | if (String.IsNullOrEmpty(outputType)) |
| 14 | { |
| 15 | outputType = Path.GetExtension(outputFile); |
| 16 | } |
| 17 | |
| 18 | switch (outputType?.ToLowerInvariant()) |
| 19 | { |
| 20 | case "module": |
| 21 | case "msm": |
| 22 | case ".msm": |
| 23 | backend = new MsmBackend(); |
| 24 | return true; |
| 25 | |
| 26 | case "msipackage": |
| 27 | case "package": |
| 28 | case "product": |
| 29 | case "msi": |
| 30 | case ".msi": |
| 31 | backend = new MsiBackend(); |
| 32 | return true; |
| 33 | |
| 34 | case "msppackage": |
| 35 | case "patch": |
| 36 | case "msp": |
| 37 | case ".msp": |
| 38 | backend = new MspBackend(); |
| 39 | return true; |
| 40 | |
| 41 | //case "patchcreation": |
| 42 | //case ".pcp": |
| 43 | // return new PatchCreationBackend(); |
| 44 | } |
| 45 | |
| 46 | backend = null; |
| 47 | return false; |
| 48 | } |
| 49 | } |
| 50 | } |