From 89ff1f2af65283158e5ebe69bcc3d652b887ea34 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 28 Oct 2016 14:35:17 -0400 Subject: update components --- .../Archiving/ZipClient.cs | 189 --------------------- 1 file changed, 189 deletions(-) delete mode 100644 MediaBrowser.Common.Implementations/Archiving/ZipClient.cs (limited to 'MediaBrowser.Common.Implementations/Archiving/ZipClient.cs') diff --git a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs deleted file mode 100644 index 24e816aefe..0000000000 --- a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs +++ /dev/null @@ -1,189 +0,0 @@ -using MediaBrowser.Model.IO; -using SharpCompress.Archive.Rar; -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 -{ - /// - /// Class DotNetZipClient - /// - public class ZipClient : IZipClient - { - private readonly IFileSystem _fileSystem; - - public ZipClient(IFileSystem fileSystem) - { - _fileSystem = fileSystem; - } - - /// - /// Extracts all. - /// - /// The source file. - /// The target path. - /// if set to true [overwrite existing files]. - public void ExtractAll(string sourceFile, string targetPath, bool overwriteExistingFiles) - { - using (var fileStream = _fileSystem.OpenRead(sourceFile)) - { - ExtractAll(fileStream, targetPath, overwriteExistingFiles); - } - } - - /// - /// Extracts all. - /// - /// The source. - /// The target path. - /// if set to true [overwrite existing files]. - public void ExtractAll(Stream source, string targetPath, bool overwriteExistingFiles) - { - using (var reader = ReaderFactory.Open(source)) - { - var options = ExtractOptions.ExtractFullPath; - - if (overwriteExistingFiles) - { - options = options | ExtractOptions.Overwrite; - } - - reader.WriteAllToDirectory(targetPath, options); - } - } - - 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); - } - } - - /// - /// Extracts all from7z. - /// - /// The source file. - /// The target path. - /// if set to true [overwrite existing files]. - public void ExtractAllFrom7z(string sourceFile, string targetPath, bool overwriteExistingFiles) - { - using (var fileStream = _fileSystem.OpenRead(sourceFile)) - { - ExtractAllFrom7z(fileStream, targetPath, overwriteExistingFiles); - } - } - - /// - /// Extracts all from7z. - /// - /// The source. - /// The target path. - /// if set to true [overwrite existing files]. - public void ExtractAllFrom7z(Stream source, string targetPath, bool overwriteExistingFiles) - { - using (var archive = SevenZipArchive.Open(source)) - { - using (var reader = archive.ExtractAllEntries()) - { - var options = ExtractOptions.ExtractFullPath; - - if (overwriteExistingFiles) - { - options = options | ExtractOptions.Overwrite; - } - - reader.WriteAllToDirectory(targetPath, options); - } - } - } - - - /// - /// Extracts all from tar. - /// - /// The source file. - /// The target path. - /// if set to true [overwrite existing files]. - public void ExtractAllFromTar(string sourceFile, string targetPath, bool overwriteExistingFiles) - { - using (var fileStream = _fileSystem.OpenRead(sourceFile)) - { - ExtractAllFromTar(fileStream, targetPath, overwriteExistingFiles); - } - } - - /// - /// Extracts all from tar. - /// - /// The source. - /// The target path. - /// if set to true [overwrite existing files]. - public void ExtractAllFromTar(Stream source, string targetPath, bool overwriteExistingFiles) - { - using (var archive = TarArchive.Open(source)) - { - using (var reader = archive.ExtractAllEntries()) - { - var options = ExtractOptions.ExtractFullPath; - - if (overwriteExistingFiles) - { - options = options | ExtractOptions.Overwrite; - } - - reader.WriteAllToDirectory(targetPath, options); - } - } - } - - /// - /// Extracts all from rar. - /// - /// The source file. - /// The target path. - /// if set to true [overwrite existing files]. - public void ExtractAllFromRar(string sourceFile, string targetPath, bool overwriteExistingFiles) - { - using (var fileStream = _fileSystem.OpenRead(sourceFile)) - { - ExtractAllFromRar(fileStream, targetPath, overwriteExistingFiles); - } - } - - /// - /// Extracts all from rar. - /// - /// The source. - /// The target path. - /// if set to true [overwrite existing files]. - public void ExtractAllFromRar(Stream source, string targetPath, bool overwriteExistingFiles) - { - using (var archive = RarArchive.Open(source)) - { - using (var reader = archive.ExtractAllEntries()) - { - var options = ExtractOptions.ExtractFullPath; - - if (overwriteExistingFiles) - { - options = options | ExtractOptions.Overwrite; - } - - reader.WriteAllToDirectory(targetPath, options); - } - } - } - } -} -- cgit v1.2.3