switch to sharp compress to add 7z support
This commit is contained in:
parent
baa5be2157
commit
c905051b16
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ using MediaBrowser.Model.Logging;
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
|
@ -168,6 +168,9 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\ServiceStack.Text.3.9.62\lib\net35\ServiceStack.Text.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpCompress">
|
||||
<HintPath>..\packages\sharpcompress.0.10.1.3\lib\net40\SharpCompress.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimpleInjector, Version=2.3.5.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\SimpleInjector.2.3.5\lib\net40-client\SimpleInjector.dll</HintPath>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.44" targetFramework="net45" />
|
||||
<package id="ServiceStack.Redis" version="3.9.44" targetFramework="net45" />
|
||||
<package id="ServiceStack.Text" version="3.9.62" targetFramework="net45" />
|
||||
<package id="sharpcompress" version="0.10.1.3" targetFramework="net45" />
|
||||
<package id="SimpleInjector" version="2.3.5" targetFramework="net45" />
|
||||
<package id="System.Data.SQLite.x86" version="1.0.88.0" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user