aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/Archiving
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-28 14:35:17 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-28 14:35:17 -0400
commit89ff1f2af65283158e5ebe69bcc3d652b887ea34 (patch)
treeadfc3677063580b72ccf172f26a3378d91944574 /MediaBrowser.Common.Implementations/Archiving
parentf6acc5fbff081728138564867a58b7848c92c467 (diff)
update components
Diffstat (limited to 'MediaBrowser.Common.Implementations/Archiving')
-rw-r--r--MediaBrowser.Common.Implementations/Archiving/ZipClient.cs189
1 files changed, 0 insertions, 189 deletions
diff --git a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs
deleted file mode 100644
index 24e816aef..000000000
--- 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
-{
- /// <summary>
- /// Class DotNetZipClient
- /// </summary>
- public class ZipClient : IZipClient
- {
- private readonly IFileSystem _fileSystem;
-
- public ZipClient(IFileSystem fileSystem)
- {
- _fileSystem = fileSystem;
- }
-
- /// <summary>
- /// Extracts all.
- /// </summary>
- /// <param name="sourceFile">The source file.</param>
- /// <param name="targetPath">The target path.</param>
- /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
- public void ExtractAll(string sourceFile, string targetPath, bool overwriteExistingFiles)
- {
- using (var fileStream = _fileSystem.OpenRead(sourceFile))
- {
- ExtractAll(fileStream, targetPath, overwriteExistingFiles);
- }
- }
-
- /// <summary>
- /// Extracts all.
- /// </summary>
- /// <param name="source">The source.</param>
- /// <param name="targetPath">The target path.</param>
- /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
- 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);
- }
- }
-
- /// <summary>
- /// Extracts all from7z.
- /// </summary>
- /// <param name="sourceFile">The source file.</param>
- /// <param name="targetPath">The target path.</param>
- /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
- public void ExtractAllFrom7z(string sourceFile, string targetPath, bool overwriteExistingFiles)
- {
- using (var fileStream = _fileSystem.OpenRead(sourceFile))
- {
- ExtractAllFrom7z(fileStream, targetPath, overwriteExistingFiles);
- }
- }
-
- /// <summary>
- /// Extracts all from7z.
- /// </summary>
- /// <param name="source">The source.</param>
- /// <param name="targetPath">The target path.</param>
- /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
- 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);
- }
- }
- }
-
-
- /// <summary>
- /// Extracts all from tar.
- /// </summary>
- /// <param name="sourceFile">The source file.</param>
- /// <param name="targetPath">The target path.</param>
- /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
- public void ExtractAllFromTar(string sourceFile, string targetPath, bool overwriteExistingFiles)
- {
- using (var fileStream = _fileSystem.OpenRead(sourceFile))
- {
- ExtractAllFromTar(fileStream, targetPath, overwriteExistingFiles);
- }
- }
-
- /// <summary>
- /// Extracts all from tar.
- /// </summary>
- /// <param name="source">The source.</param>
- /// <param name="targetPath">The target path.</param>
- /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
- 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);
- }
- }
- }
-
- /// <summary>
- /// Extracts all from rar.
- /// </summary>
- /// <param name="sourceFile">The source file.</param>
- /// <param name="targetPath">The target path.</param>
- /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
- public void ExtractAllFromRar(string sourceFile, string targetPath, bool overwriteExistingFiles)
- {
- using (var fileStream = _fileSystem.OpenRead(sourceFile))
- {
- ExtractAllFromRar(fileStream, targetPath, overwriteExistingFiles);
- }
- }
-
- /// <summary>
- /// Extracts all from rar.
- /// </summary>
- /// <param name="source">The source.</param>
- /// <param name="targetPath">The target path.</param>
- /// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
- 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);
- }
- }
- }
- }
-}