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> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DotNetZip" Version="1.15.0" />
<PackageReference Include="SharpCompress" Version="0.29.0" /> <PackageReference Include="SharpCompress" Version="0.29.0" />
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.1" PrivateAssets="all" /> <PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.1" PrivateAssets="all" />
</ItemGroup> </ItemGroup>

View File

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

View File

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