diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-10-14 16:12:07 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-10-14 16:12:07 -0700 |
| commit | dbde9e7104b907bbbaea17e21247d8cafc8b3a4c (patch) | |
| tree | 0f5fbbb6fe12c6b2e5e622a0e18ce4c5b4eb2b96 /src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs | |
| parent | fbf986eb97f68396797a89fc7d40dec07b775440 (diff) | |
| download | wix-dbde9e7104b907bbbaea17e21247d8cafc8b3a4c.tar.gz wix-dbde9e7104b907bbbaea17e21247d8cafc8b3a4c.tar.bz2 wix-dbde9e7104b907bbbaea17e21247d8cafc8b3a4c.zip | |
Massive refactoring to introduce the concept of IBackend
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 | } | ||
