aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-12-28 21:50:02 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-12-28 21:50:02 -0500
commitc9bf564c4523798fc6b2250fba41daed4f89939d (patch)
tree19ecf4a6f7424f678cd9bbc8dc86e1c6a10775ee /MediaBrowser.Common.Implementations/Archiving/ZipClient.cs
parenta7f2bc5fda526e227e0dbdd23e0d408ed627da14 (diff)
change zip extraction to resolve osx issue
Diffstat (limited to 'MediaBrowser.Common.Implementations/Archiving/ZipClient.cs')
-rw-r--r--MediaBrowser.Common.Implementations/Archiving/ZipClient.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs
index 23d40cf67..3d759ca54 100644
--- a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs
+++ b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs
@@ -4,6 +4,7 @@ using SharpCompress.Archive.SevenZip;
using SharpCompress.Archive.Tar;
using SharpCompress.Common;
using SharpCompress.Reader;
+using SharpCompress.Reader.Zip;
using System.IO;
namespace MediaBrowser.Common.Implementations.Archiving
@@ -48,6 +49,21 @@ namespace MediaBrowser.Common.Implementations.Archiving
}
}
+ public void ExtractAllFromZip(Stream source, string targetPath, bool overwriteExistingFiles)
+ {
+ using (var reader = ZipReader.Open(source))
+ {
+ var options = ExtractOptions.ExtractFullPath;
+
+ if (overwriteExistingFiles)
+ {
+ options = options | ExtractOptions.Overwrite;
+ }
+
+ reader.WriteAllToDirectory(targetPath, options);
+ }
+ }
+
/// <summary>
/// Extracts all from7z.
/// </summary>