diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs new file mode 100644 index 00000000..f04dcefe --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs | |||
@@ -0,0 +1,53 @@ | |||
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.Unbind | ||
4 | { | ||
5 | using System; | ||
6 | using System.ComponentModel; | ||
7 | using WixToolset.Core.Native; | ||
8 | using WixToolset.Data; | ||
9 | using WixToolset.Extensibility; | ||
10 | using WixToolset.Msi; | ||
11 | |||
12 | internal class UnbindMsiOrMsmCommand | ||
13 | { | ||
14 | public UnbindMsiOrMsmCommand(IUnbindContext context) | ||
15 | { | ||
16 | this.Context = context; | ||
17 | } | ||
18 | |||
19 | public IUnbindContext Context { get; } | ||
20 | |||
21 | public Output Execute() | ||
22 | { | ||
23 | Output output; | ||
24 | |||
25 | try | ||
26 | { | ||
27 | using (Database database = new Database(this.Context.InputFilePath, OpenDatabase.ReadOnly)) | ||
28 | { | ||
29 | var unbindCommand = new UnbindDatabaseCommand(this.Context.Messaging, database, this.Context.InputFilePath, OutputType.Product, this.Context.ExportBasePath, this.Context.IntermediateFolder, this.Context.IsAdminImage, this.Context.SuppressDemodularization, skipSummaryInfo: false); | ||
30 | output = unbindCommand.Execute(); | ||
31 | |||
32 | // extract the files from the cabinets | ||
33 | if (!String.IsNullOrEmpty(this.Context.ExportBasePath) && !this.Context.SuppressExtractCabinets) | ||
34 | { | ||
35 | var extractCommand = new ExtractCabinetsCommand(output, database, this.Context.InputFilePath, this.Context.ExportBasePath, this.Context.IntermediateFolder); | ||
36 | extractCommand.Execute(); | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | catch (Win32Exception e) | ||
41 | { | ||
42 | if (0x6E == e.NativeErrorCode) // ERROR_OPEN_FAILED | ||
43 | { | ||
44 | throw new WixException(WixErrors.OpenDatabaseFailed(this.Context.InputFilePath)); | ||
45 | } | ||
46 | |||
47 | throw; | ||
48 | } | ||
49 | |||
50 | return output; | ||
51 | } | ||
52 | } | ||
53 | } | ||