mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-21 08:15:28 +03:00
switch to sharp compress to add 7z support
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Ionic.Zip;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Reader;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.ServerApplication.Implementations
|
||||
@@ -19,10 +20,7 @@ namespace MediaBrowser.ServerApplication.Implementations
|
||||
{
|
||||
using (var fileStream = File.OpenRead(sourceFile))
|
||||
{
|
||||
using (var zipFile = ZipFile.Read(fileStream))
|
||||
{
|
||||
zipFile.ExtractAll(targetPath, overwriteExistingFiles ? ExtractExistingFileAction.OverwriteSilently : ExtractExistingFileAction.DoNotOverwrite);
|
||||
}
|
||||
ExtractAll(fileStream, targetPath, overwriteExistingFiles);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +32,16 @@ namespace MediaBrowser.ServerApplication.Implementations
|
||||
/// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
|
||||
public void ExtractAll(Stream source, string targetPath, bool overwriteExistingFiles)
|
||||
{
|
||||
using (var zipFile = ZipFile.Read(source))
|
||||
using (var reader = ReaderFactory.Open(source))
|
||||
{
|
||||
zipFile.ExtractAll(targetPath, overwriteExistingFiles ? ExtractExistingFileAction.OverwriteSilently : ExtractExistingFileAction.DoNotOverwrite);
|
||||
var options = ExtractOptions.ExtractFullPath;
|
||||
|
||||
if (overwriteExistingFiles)
|
||||
{
|
||||
options = options | ExtractOptions.Overwrite;
|
||||
}
|
||||
|
||||
reader.WriteAllToDirectory(targetPath, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user