aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Cab/WixExtractCab.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Cab/WixExtractCab.cs')
-rw-r--r--src/WixToolset.Core/Cab/WixExtractCab.cs75
1 files changed, 0 insertions, 75 deletions
diff --git a/src/WixToolset.Core/Cab/WixExtractCab.cs b/src/WixToolset.Core/Cab/WixExtractCab.cs
deleted file mode 100644
index e776b08e..00000000
--- a/src/WixToolset.Core/Cab/WixExtractCab.cs
+++ /dev/null
@@ -1,75 +0,0 @@
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
3namespace WixToolset.Core.Cab
4{
5 using System;
6 using WixToolset.Core.Native;
7
8 /// <summary>
9 /// Wrapper class around interop with wixcab.dll to extract files from a cabinet.
10 /// </summary>
11 public sealed class WixExtractCab : IDisposable
12 {
13 private bool disposed;
14
15 /// <summary>
16 /// Creates a cabinet extractor.
17 /// </summary>
18 public WixExtractCab()
19 {
20 NativeMethods.ExtractCabBegin();
21 }
22
23 /// <summary>
24 /// Destructor for cabinet extraction.
25 /// </summary>
26 ~WixExtractCab()
27 {
28 this.Dispose();
29 }
30
31 /// <summary>
32 /// Extracts all the files from a cabinet to a directory.
33 /// </summary>
34 /// <param name="cabinetFile">Cabinet file to extract from.</param>
35 /// <param name="extractDir">Directory to extract files to.</param>
36 public void Extract(string cabinetFile, string extractDir)
37 {
38 if (null == cabinetFile)
39 {
40 throw new ArgumentNullException("cabinetFile");
41 }
42
43 if (null == extractDir)
44 {
45 throw new ArgumentNullException("extractDir");
46 }
47
48 if (this.disposed)
49 {
50 throw new ObjectDisposedException("WixExtractCab");
51 }
52
53 if (!extractDir.EndsWith("\\", StringComparison.Ordinal))
54 {
55 extractDir = String.Concat(extractDir, "\\");
56 }
57
58 NativeMethods.ExtractCab(cabinetFile, extractDir);
59 }
60
61 /// <summary>
62 /// Disposes the managed and unmanaged objects in this object.
63 /// </summary>
64 public void Dispose()
65 {
66 if (!this.disposed)
67 {
68 NativeMethods.ExtractCabFinish();
69
70 GC.SuppressFinalize(this);
71 this.disposed = true;
72 }
73 }
74 }
75}