Use DotNetZip for BZ2 as it's twice as fast.

This commit is contained in:
2021-09-15 19:20:50 +01:00
parent 71cc849c49
commit f843e1bb0f
3 changed files with 7 additions and 8 deletions

View File

@@ -88,6 +88,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetZip" Version="1.15.0" />
<PackageReference Include="SharpCompress" Version="0.29.0" />
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.1" PrivateAssets="all" />
</ItemGroup>

View File

@@ -34,8 +34,7 @@ using System;
using System.IO;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using SharpCompress.Compressors;
using SharpCompress.Compressors.BZip2;
using Ionic.BZip2;
namespace Aaru.Filters
{
@@ -157,7 +156,7 @@ namespace Aaru.Filters
BasePath = null;
CreationTime = DateTime.UtcNow;
LastWriteTime = CreationTime;
_innerStream = new ForcedSeekStream<BZip2Stream>(_dataStream, CompressionMode.Decompress, false);
_innerStream = new ForcedSeekStream<BZip2InputStream>(_dataStream, false);
DataForkLength = _innerStream.Length;
return Errno.NoError;
@@ -170,7 +169,7 @@ namespace Aaru.Filters
BasePath = null;
CreationTime = DateTime.UtcNow;
LastWriteTime = CreationTime;
_innerStream = new ForcedSeekStream<BZip2Stream>(_dataStream, CompressionMode.Decompress, false);
_innerStream = new ForcedSeekStream<BZip2InputStream>(_dataStream, false);
DataForkLength = _innerStream.Length;
return Errno.NoError;
@@ -185,7 +184,7 @@ namespace Aaru.Filters
var fi = new FileInfo(path);
CreationTime = fi.CreationTimeUtc;
LastWriteTime = fi.LastWriteTimeUtc;
_innerStream = new ForcedSeekStream<BZip2Stream>(_dataStream, CompressionMode.Decompress, false);
_innerStream = new ForcedSeekStream<BZip2InputStream>(_dataStream, false);
DataForkLength = _innerStream.Length;
return Errno.NoError;

View File

@@ -45,7 +45,7 @@ using Claunia.PropertyList;
using Claunia.RsrcFork;
using Ionic.Zlib;
using SharpCompress.Compressors.ADC;
using SharpCompress.Compressors.BZip2;
using Ionic.BZip2;
using Version = Resources.Version;
#pragma warning disable 612
@@ -446,8 +446,7 @@ namespace Aaru.DiscImages
break;
case CHUNK_TYPE_BZIP:
decStream = new BZip2Stream(cmpMs, SharpCompress.Compressors.CompressionMode.Decompress,
false);
decStream = new BZip2InputStream(cmpMs, false);
break;
case CHUNK_TYPE_RLE: break;