From 0a50386ada4833b37a05e259e628795cc27893aa Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Tue, 27 Jan 2026 10:46:54 +0000 Subject: [PATCH] Using Constants class differently --- src/SharpCompress/Archives/ArchiveFactory.cs | 14 ++------ .../Archives/AutoArchiveFactory.cs | 7 ++-- .../Archives/IArchiveEntryExtensions.cs | 6 ++-- src/SharpCompress/Archives/Tar/TarArchive.cs | 2 +- src/SharpCompress/Archives/Zip/ZipArchive.cs | 33 +++++-------------- src/SharpCompress/Common/Constants.cs | 10 ++++++ src/SharpCompress/Factories/AceFactory.cs | 6 +--- src/SharpCompress/Factories/ArcFactory.cs | 14 +++----- src/SharpCompress/Factories/ArjFactory.cs | 6 +--- src/SharpCompress/Factories/Factory.cs | 8 ++--- src/SharpCompress/Factories/GZipFactory.cs | 7 ++-- src/SharpCompress/Factories/IFactory.cs | 6 +--- src/SharpCompress/Factories/RarFactory.cs | 7 ++-- .../Factories/SevenZipFactory.cs | 7 ++-- src/SharpCompress/Factories/TarFactory.cs | 7 ++-- .../Factories/ZStandardFactory.cs | 7 ++-- src/SharpCompress/Factories/ZipFactory.cs | 12 +++---- src/SharpCompress/Readers/AbstractReader.cs | 10 ++++-- src/SharpCompress/Readers/ReaderOptions.cs | 4 +-- src/SharpCompress/Utility.cs | 8 ++--- src/SharpCompress/Writers/GZip/GZipWriter.cs | 2 +- src/SharpCompress/Writers/Zip/ZipWriter.cs | 3 +- .../Writers/Zip/ZipWriterEntryOptions.cs | 2 +- .../Mocks/ForwardOnlyStream.cs | 6 ++-- tests/SharpCompress.Test/packages.lock.json | 12 ------- 25 files changed, 69 insertions(+), 137 deletions(-) create mode 100644 src/SharpCompress/Common/Constants.cs diff --git a/src/SharpCompress/Archives/ArchiveFactory.cs b/src/SharpCompress/Archives/ArchiveFactory.cs index 94368ece..1f4c8e6f 100644 --- a/src/SharpCompress/Archives/ArchiveFactory.cs +++ b/src/SharpCompress/Archives/ArchiveFactory.cs @@ -166,22 +166,14 @@ public static class ArchiveFactory ); } - public static bool IsArchive( - string filePath, - out ArchiveType? type, - int bufferSize = ReaderOptions.DefaultBufferSize - ) + public static bool IsArchive(string filePath, out ArchiveType? type) { filePath.NotNullOrEmpty(nameof(filePath)); using Stream s = File.OpenRead(filePath); - return IsArchive(s, out type, bufferSize); + return IsArchive(s, out type); } - public static bool IsArchive( - Stream stream, - out ArchiveType? type, - int bufferSize = ReaderOptions.DefaultBufferSize - ) + public static bool IsArchive(Stream stream, out ArchiveType? type) { type = null; stream.NotNull(nameof(stream)); diff --git a/src/SharpCompress/Archives/AutoArchiveFactory.cs b/src/SharpCompress/Archives/AutoArchiveFactory.cs index 78313df5..12b70266 100644 --- a/src/SharpCompress/Archives/AutoArchiveFactory.cs +++ b/src/SharpCompress/Archives/AutoArchiveFactory.cs @@ -14,11 +14,8 @@ class AutoArchiveFactory : IArchiveFactory public IEnumerable GetSupportedExtensions() => throw new NotSupportedException(); - public bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) => throw new NotSupportedException(); + public bool IsArchive(Stream stream, string? password = null) => + throw new NotSupportedException(); public FileInfo? GetFilePart(int index, FileInfo part1) => throw new NotSupportedException(); diff --git a/src/SharpCompress/Archives/IArchiveEntryExtensions.cs b/src/SharpCompress/Archives/IArchiveEntryExtensions.cs index af2c9be4..1460c2ec 100644 --- a/src/SharpCompress/Archives/IArchiveEntryExtensions.cs +++ b/src/SharpCompress/Archives/IArchiveEntryExtensions.cs @@ -9,8 +9,6 @@ namespace SharpCompress.Archives; public static class IArchiveEntryExtensions { - private const int BufferSize = 81920; - /// The archive entry to extract. extension(IArchiveEntry archiveEntry) { @@ -28,7 +26,7 @@ public static class IArchiveEntryExtensions using var entryStream = archiveEntry.OpenEntryStream(); var sourceStream = WrapWithProgress(entryStream, archiveEntry, progress); - sourceStream.CopyTo(streamToWriteTo, BufferSize); + sourceStream.CopyTo(streamToWriteTo, Constants.BufferSize); } /// @@ -51,7 +49,7 @@ public static class IArchiveEntryExtensions using var entryStream = await archiveEntry.OpenEntryStreamAsync(cancellationToken); var sourceStream = WrapWithProgress(entryStream, archiveEntry, progress); await sourceStream - .CopyToAsync(streamToWriteTo, BufferSize, cancellationToken) + .CopyToAsync(streamToWriteTo, Constants.BufferSize, cancellationToken) .ConfigureAwait(false); } } diff --git a/src/SharpCompress/Archives/Tar/TarArchive.cs b/src/SharpCompress/Archives/Tar/TarArchive.cs index 2754fd9b..24bf77b7 100644 --- a/src/SharpCompress/Archives/Tar/TarArchive.cs +++ b/src/SharpCompress/Archives/Tar/TarArchive.cs @@ -180,7 +180,7 @@ public class TarArchive : AbstractWritableArchive using (var entryStream = entry.OpenEntryStream()) { using var memoryStream = new MemoryStream(); - entryStream.CopyTo(memoryStream); + entryStream.CopyTo(memoryStream, Constants.BufferSize); memoryStream.Position = 0; var bytes = memoryStream.ToArray(); diff --git a/src/SharpCompress/Archives/Zip/ZipArchive.cs b/src/SharpCompress/Archives/Zip/ZipArchive.cs index 57db85c2..8a870b99 100644 --- a/src/SharpCompress/Archives/Zip/ZipArchive.cs +++ b/src/SharpCompress/Archives/Zip/ZipArchive.cs @@ -124,38 +124,27 @@ public class ZipArchive : AbstractWritableArchive ); } - public static bool IsZipFile( - string filePath, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) => IsZipFile(new FileInfo(filePath), password, bufferSize); + public static bool IsZipFile(string filePath, string? password = null) => + IsZipFile(new FileInfo(filePath), password); - public static bool IsZipFile( - FileInfo fileInfo, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) + public static bool IsZipFile(FileInfo fileInfo, string? password = null) { if (!fileInfo.Exists) { return false; } using Stream stream = fileInfo.OpenRead(); - return IsZipFile(stream, password, bufferSize); + return IsZipFile(stream, password); } - public static bool IsZipFile( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) + public static bool IsZipFile(Stream stream, string? password = null) { var headerFactory = new StreamingZipHeaderFactory(password, new ArchiveEncoding(), null); try { if (stream is not SharpCompressStream) { - stream = new SharpCompressStream(stream, bufferSize: bufferSize); + stream = new SharpCompressStream(stream, bufferSize: Constants.BufferSize); } var header = headerFactory @@ -177,18 +166,14 @@ public class ZipArchive : AbstractWritableArchive } } - public static bool IsZipMulti( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) + public static bool IsZipMulti(Stream stream, string? password = null) { var headerFactory = new StreamingZipHeaderFactory(password, new ArchiveEncoding(), null); try { if (stream is not SharpCompressStream) { - stream = new SharpCompressStream(stream, bufferSize: bufferSize); + stream = new SharpCompressStream(stream, bufferSize: Constants.BufferSize); } var header = headerFactory @@ -229,7 +214,7 @@ public class ZipArchive : AbstractWritableArchive if (streams.Count() > 1) //test part 2 - true = multipart not split { streams[1].Position += 4; //skip the POST_DATA_DESCRIPTOR to prevent an exception - var isZip = IsZipFile(streams[1], ReaderOptions.Password, ReaderOptions.BufferSize); + var isZip = IsZipFile(streams[1], ReaderOptions.Password); streams[1].Position -= 4; if (isZip) { diff --git a/src/SharpCompress/Common/Constants.cs b/src/SharpCompress/Common/Constants.cs new file mode 100644 index 00000000..08653fc6 --- /dev/null +++ b/src/SharpCompress/Common/Constants.cs @@ -0,0 +1,10 @@ +namespace SharpCompress.Common; + +public static class Constants +{ + /// + /// The default buffer size for stream operations, matching .NET's Stream.CopyTo default of 81920 bytes. + /// This can be modified globally at runtime. + /// + public static int BufferSize = 81920; +} diff --git a/src/SharpCompress/Factories/AceFactory.cs b/src/SharpCompress/Factories/AceFactory.cs index 5b80ae24..883c7a92 100644 --- a/src/SharpCompress/Factories/AceFactory.cs +++ b/src/SharpCompress/Factories/AceFactory.cs @@ -22,11 +22,7 @@ namespace SharpCompress.Factories yield return "ace"; } - public override bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) + public override bool IsArchive(Stream stream, string? password = null) { return AceHeader.IsArchive(stream); } diff --git a/src/SharpCompress/Factories/ArcFactory.cs b/src/SharpCompress/Factories/ArcFactory.cs index b5180afa..c9611d7c 100644 --- a/src/SharpCompress/Factories/ArcFactory.cs +++ b/src/SharpCompress/Factories/ArcFactory.cs @@ -23,18 +23,14 @@ namespace SharpCompress.Factories yield return "arc"; } - public override bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) + public override bool IsArchive(Stream stream, string? password = null) { //You may have to use some(paranoid) checks to ensure that you actually are - //processing an ARC file, since other archivers also adopted the idea of putting - //a 01Ah byte at offset 0, namely the Hyper archiver. To check if you have a + //processing an ARC file, since other archivers also adopted to the idea of putting + //a 01Ah byte at offset 0, namely: Hyper archiver. To check if you have a //Hyper - archive, check the next two bytes for "HP" or "ST"(or look below for - //"HYP").Also the ZOO archiver also does put a 01Ah at the start of the file, - //see the ZOO entry below. + //"HYP").Also, ZOO archiver also does put a 01Ah at the start of the file, + //see: ZOO entry below. var bytes = new byte[2]; stream.Read(bytes, 0, 2); return bytes[0] == 0x1A && bytes[1] < 10; //rather thin, but this is all we have diff --git a/src/SharpCompress/Factories/ArjFactory.cs b/src/SharpCompress/Factories/ArjFactory.cs index f6f7a393..fad03b75 100644 --- a/src/SharpCompress/Factories/ArjFactory.cs +++ b/src/SharpCompress/Factories/ArjFactory.cs @@ -22,11 +22,7 @@ namespace SharpCompress.Factories yield return "arj"; } - public override bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) + public override bool IsArchive(Stream stream, string? password = null) { return ArjHeader.IsArchive(stream); } diff --git a/src/SharpCompress/Factories/Factory.cs b/src/SharpCompress/Factories/Factory.cs index 4651ccb2..3f505d53 100644 --- a/src/SharpCompress/Factories/Factory.cs +++ b/src/SharpCompress/Factories/Factory.cs @@ -51,11 +51,7 @@ public abstract class Factory : IFactory public abstract IEnumerable GetSupportedExtensions(); /// - public abstract bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ); + public abstract bool IsArchive(Stream stream, string? password = null); /// public virtual FileInfo? GetFilePart(int index, FileInfo part1) => null; @@ -82,7 +78,7 @@ public abstract class Factory : IFactory { long pos = ((IStreamStack)stream).GetPosition(); - if (IsArchive(stream, options.Password, options.BufferSize)) + if (IsArchive(stream, options.Password)) { ((IStreamStack)stream).StackSeek(pos); reader = readerFactory.OpenReader(stream, options); diff --git a/src/SharpCompress/Factories/GZipFactory.cs b/src/SharpCompress/Factories/GZipFactory.cs index 17f344cf..89a0cdec 100644 --- a/src/SharpCompress/Factories/GZipFactory.cs +++ b/src/SharpCompress/Factories/GZipFactory.cs @@ -40,11 +40,8 @@ public class GZipFactory } /// - public override bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) => GZipArchive.IsGZipFile(stream); + public override bool IsArchive(Stream stream, string? password = null) => + GZipArchive.IsGZipFile(stream); #endregion diff --git a/src/SharpCompress/Factories/IFactory.cs b/src/SharpCompress/Factories/IFactory.cs index 63d5eeec..e95da612 100644 --- a/src/SharpCompress/Factories/IFactory.cs +++ b/src/SharpCompress/Factories/IFactory.cs @@ -36,11 +36,7 @@ public interface IFactory /// /// A stream, pointing to the beginning of the archive. /// optional password - bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ); + bool IsArchive(Stream stream, string? password = null); /// /// From a passed in archive (zip, rar, 7z, 001), return all parts. diff --git a/src/SharpCompress/Factories/RarFactory.cs b/src/SharpCompress/Factories/RarFactory.cs index 61099905..cfdb7ff2 100644 --- a/src/SharpCompress/Factories/RarFactory.cs +++ b/src/SharpCompress/Factories/RarFactory.cs @@ -29,11 +29,8 @@ public class RarFactory : Factory, IArchiveFactory, IMultiArchiveFactory, IReade } /// - public override bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) => RarArchive.IsRarFile(stream); + public override bool IsArchive(Stream stream, string? password = null) => + RarArchive.IsRarFile(stream); /// public override FileInfo? GetFilePart(int index, FileInfo part1) => diff --git a/src/SharpCompress/Factories/SevenZipFactory.cs b/src/SharpCompress/Factories/SevenZipFactory.cs index 18dedbfd..84b1d8e9 100644 --- a/src/SharpCompress/Factories/SevenZipFactory.cs +++ b/src/SharpCompress/Factories/SevenZipFactory.cs @@ -28,11 +28,8 @@ public class SevenZipFactory : Factory, IArchiveFactory, IMultiArchiveFactory } /// - public override bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) => SevenZipArchive.IsSevenZipFile(stream); + public override bool IsArchive(Stream stream, string? password = null) => + SevenZipArchive.IsSevenZipFile(stream); #endregion diff --git a/src/SharpCompress/Factories/TarFactory.cs b/src/SharpCompress/Factories/TarFactory.cs index d32020fd..225270d8 100644 --- a/src/SharpCompress/Factories/TarFactory.cs +++ b/src/SharpCompress/Factories/TarFactory.cs @@ -53,11 +53,8 @@ public class TarFactory } /// - public override bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) => TarArchive.IsTarFile(stream); + public override bool IsArchive(Stream stream, string? password = null) => + TarArchive.IsTarFile(stream); #endregion diff --git a/src/SharpCompress/Factories/ZStandardFactory.cs b/src/SharpCompress/Factories/ZStandardFactory.cs index a5c6d84f..7a26b27a 100644 --- a/src/SharpCompress/Factories/ZStandardFactory.cs +++ b/src/SharpCompress/Factories/ZStandardFactory.cs @@ -20,9 +20,6 @@ internal class ZStandardFactory : Factory yield return "zstd"; } - public override bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = 65536 - ) => ZStandardStream.IsZStandard(stream); + public override bool IsArchive(Stream stream, string? password = null) => + ZStandardStream.IsZStandard(stream); } diff --git a/src/SharpCompress/Factories/ZipFactory.cs b/src/SharpCompress/Factories/ZipFactory.cs index 5c2fcad8..1e9e06ea 100644 --- a/src/SharpCompress/Factories/ZipFactory.cs +++ b/src/SharpCompress/Factories/ZipFactory.cs @@ -39,11 +39,7 @@ public class ZipFactory } /// - public override bool IsArchive( - Stream stream, - string? password = null, - int bufferSize = ReaderOptions.DefaultBufferSize - ) + public override bool IsArchive(Stream stream, string? password = null) { var startPosition = stream.CanSeek ? stream.Position : -1; @@ -51,10 +47,10 @@ public class ZipFactory if (stream is not SharpCompressStream) // wrap to provide buffer bef { - stream = new SharpCompressStream(stream, bufferSize: bufferSize); + stream = new SharpCompressStream(stream, bufferSize: Constants.BufferSize); } - if (ZipArchive.IsZipFile(stream, password, bufferSize)) + if (ZipArchive.IsZipFile(stream, password)) { return true; } @@ -69,7 +65,7 @@ public class ZipFactory stream.Position = startPosition; //test the zip (last) file of a multipart zip - if (ZipArchive.IsZipMulti(stream, password, bufferSize)) + if (ZipArchive.IsZipMulti(stream, password)) { return true; } diff --git a/src/SharpCompress/Readers/AbstractReader.cs b/src/SharpCompress/Readers/AbstractReader.cs index cd37bb5f..c822393e 100644 --- a/src/SharpCompress/Readers/AbstractReader.cs +++ b/src/SharpCompress/Readers/AbstractReader.cs @@ -262,7 +262,7 @@ public abstract class AbstractReader : IReader { using Stream s = OpenEntryStream(); var sourceStream = WrapWithProgress(s, Entry); - sourceStream.CopyTo(writeStream, 81920); + sourceStream.CopyTo(writeStream, Constants.BufferSize); } internal async Task WriteAsync(Stream writeStream, CancellationToken cancellationToken) @@ -270,11 +270,15 @@ public abstract class AbstractReader : IReader #if NETFRAMEWORK || NETSTANDARD2_0 using Stream s = OpenEntryStream(); var sourceStream = WrapWithProgress(s, Entry); - await sourceStream.CopyToAsync(writeStream, 81920, cancellationToken).ConfigureAwait(false); + await sourceStream + .CopyToAsync(writeStream, Constants.BufferSize, cancellationToken) + .ConfigureAwait(false); #else await using Stream s = OpenEntryStream(); var sourceStream = WrapWithProgress(s, Entry); - await sourceStream.CopyToAsync(writeStream, 81920, cancellationToken).ConfigureAwait(false); + await sourceStream + .CopyToAsync(writeStream, Constants.BufferSize, cancellationToken) + .ConfigureAwait(false); #endif } diff --git a/src/SharpCompress/Readers/ReaderOptions.cs b/src/SharpCompress/Readers/ReaderOptions.cs index cedf8bed..49a91e93 100644 --- a/src/SharpCompress/Readers/ReaderOptions.cs +++ b/src/SharpCompress/Readers/ReaderOptions.cs @@ -5,8 +5,6 @@ namespace SharpCompress.Readers; public class ReaderOptions : OptionsBase { - public const int DefaultBufferSize = 0x10000; - /// /// Look for RarArchive (Check for self-extracting archives or cases where RarArchive isn't at the start of the file) /// @@ -16,7 +14,7 @@ public class ReaderOptions : OptionsBase public bool DisableCheckIncomplete { get; set; } - public int BufferSize { get; set; } = DefaultBufferSize; + public int BufferSize { get; set; } = Constants.BufferSize; /// /// Provide a hint for the extension of the archive being read, can speed up finding the correct decoder. Should be without the leading period in the form like: tar.gz or zip diff --git a/src/SharpCompress/Utility.cs b/src/SharpCompress/Utility.cs index 8f2d6788..bf9d91e1 100644 --- a/src/SharpCompress/Utility.cs +++ b/src/SharpCompress/Utility.cs @@ -11,8 +11,6 @@ namespace SharpCompress; internal static class Utility { - //80kb is a good industry standard temporary buffer size - private const int TEMP_BUFFER_SIZE = 81920; private static readonly HashSet invalidChars = new(Path.GetInvalidFileNameChars()); public static ReadOnlyCollection ToReadOnly(this IList items) => new(items); @@ -151,7 +149,7 @@ internal static class Utility public static long TransferTo(this Stream source, Stream destination, long maxLength) { - var array = ArrayPool.Shared.Rent(TEMP_BUFFER_SIZE); + var array = ArrayPool.Shared.Rent(Common.Constants.BufferSize); try { var maxReadSize = array.Length; @@ -190,7 +188,7 @@ internal static class Utility CancellationToken cancellationToken = default ) { - var array = ArrayPool.Shared.Rent(TEMP_BUFFER_SIZE); + var array = ArrayPool.Shared.Rent(Common.Constants.BufferSize); try { var maxReadSize = array.Length; @@ -268,7 +266,7 @@ internal static class Utility return; } - var array = ArrayPool.Shared.Rent(TEMP_BUFFER_SIZE); + var array = ArrayPool.Shared.Rent(Common.Constants.BufferSize); try { while (advanceAmount > 0) diff --git a/src/SharpCompress/Writers/GZip/GZipWriter.cs b/src/SharpCompress/Writers/GZip/GZipWriter.cs index ad1d59d7..68353284 100644 --- a/src/SharpCompress/Writers/GZip/GZipWriter.cs +++ b/src/SharpCompress/Writers/GZip/GZipWriter.cs @@ -48,7 +48,7 @@ public sealed class GZipWriter : AbstractWriter stream.FileName = filename; stream.LastModified = modificationTime; var progressStream = WrapWithProgress(source, filename); - progressStream.CopyTo(stream); + progressStream.CopyTo(stream, Constants.BufferSize); _wroteToStream = true; } diff --git a/src/SharpCompress/Writers/Zip/ZipWriter.cs b/src/SharpCompress/Writers/Zip/ZipWriter.cs index 8c4b96b6..e11ac01d 100644 --- a/src/SharpCompress/Writers/Zip/ZipWriter.cs +++ b/src/SharpCompress/Writers/Zip/ZipWriter.cs @@ -15,6 +15,7 @@ using SharpCompress.Compressors.LZMA; using SharpCompress.Compressors.PPMd; using SharpCompress.Compressors.ZStandard; using SharpCompress.IO; +using Constants = SharpCompress.Common.Constants; namespace SharpCompress.Writers.Zip; @@ -87,7 +88,7 @@ public class ZipWriter : AbstractWriter { using var output = WriteToStream(entryPath, zipWriterEntryOptions); var progressStream = WrapWithProgress(source, entryPath); - progressStream.CopyTo(output); + progressStream.CopyTo(output, Constants.BufferSize); } public Stream WriteToStream(string entryPath, ZipWriterEntryOptions options) diff --git a/src/SharpCompress/Writers/Zip/ZipWriterEntryOptions.cs b/src/SharpCompress/Writers/Zip/ZipWriterEntryOptions.cs index dcadb21c..f532a473 100644 --- a/src/SharpCompress/Writers/Zip/ZipWriterEntryOptions.cs +++ b/src/SharpCompress/Writers/Zip/ZipWriterEntryOptions.cs @@ -4,7 +4,7 @@ using SharpCompress.Compressors.Deflate; namespace SharpCompress.Writers.Zip; -public class ZipWriterEntryOptions +public class ZipWriterEntryOptions : OptionsBase { public CompressionType? CompressionType { get; set; } diff --git a/tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs b/tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs index 064d2066..dd9c76dc 100644 --- a/tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs +++ b/tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs @@ -2,8 +2,8 @@ using System; using System.IO; using System.Threading; using System.Threading.Tasks; +using SharpCompress.Common; using SharpCompress.IO; -using SharpCompress.Readers; namespace SharpCompress.Test.Mocks; @@ -31,8 +31,8 @@ public class ForwardOnlyStream : SharpCompressStream, IStreamStack public bool IsDisposed { get; private set; } - public ForwardOnlyStream(Stream stream, int bufferSize = ReaderOptions.DefaultBufferSize) - : base(stream, bufferSize: bufferSize) + public ForwardOnlyStream(Stream stream, int? bufferSize = null) + : base(stream, bufferSize: bufferSize ?? Constants.BufferSize) { this.stream = stream; #if DEBUG_STREAMS diff --git a/tests/SharpCompress.Test/packages.lock.json b/tests/SharpCompress.Test/packages.lock.json index 7f87d400..d36081cd 100644 --- a/tests/SharpCompress.Test/packages.lock.json +++ b/tests/SharpCompress.Test/packages.lock.json @@ -29,12 +29,6 @@ "Microsoft.NETFramework.ReferenceAssemblies.net48": "1.0.3" } }, - "Mono.Posix.NETStandard": { - "type": "Direct", - "requested": "[1.0.0, )", - "resolved": "1.0.0", - "contentHash": "vSN/L1uaVwKsiLa95bYu2SGkF0iY3xMblTfxc8alSziPuVfJpj3geVqHGAA75J7cZkMuKpFVikz82Lo6y6LLdA==" - }, "xunit": { "type": "Direct", "requested": "[2.9.3, )", @@ -222,12 +216,6 @@ "Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3" } }, - "Mono.Posix.NETStandard": { - "type": "Direct", - "requested": "[1.0.0, )", - "resolved": "1.0.0", - "contentHash": "vSN/L1uaVwKsiLa95bYu2SGkF0iY3xMblTfxc8alSziPuVfJpj3geVqHGAA75J7cZkMuKpFVikz82Lo6y6LLdA==" - }, "xunit": { "type": "Direct", "requested": "[2.9.3, )",