mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-23 07:25:11 +00:00
fixes
This commit is contained in:
@@ -33,7 +33,7 @@ internal class NonDisposingStream : Stream
|
||||
|
||||
public override bool CanRead => !_isDisposed && _stream.CanRead;
|
||||
|
||||
public override bool CanSeek => !_isDisposed && _stream.CanSeek;
|
||||
public override bool CanSeek => !_isDisposed && _stream.CanSeek && _stream is not RewindableStream;
|
||||
|
||||
public override bool CanWrite => !_isDisposed && _stream.CanWrite;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Buffers;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress;
|
||||
|
||||
@@ -12,13 +13,13 @@ public static class StreamExtensions
|
||||
{
|
||||
public void Skip(long advanceAmount)
|
||||
{
|
||||
if (stream.CanSeek)
|
||||
if (stream.CanSeek && stream is not RewindableStream)
|
||||
{
|
||||
stream.Position += advanceAmount;
|
||||
return;
|
||||
}
|
||||
|
||||
using var readOnlySubStream = new IO.ReadOnlySubStream(stream, advanceAmount);
|
||||
using var readOnlySubStream = new ReadOnlySubStream(stream, advanceAmount);
|
||||
readOnlySubStream.CopyTo(Stream.Null);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +97,16 @@ public abstract partial class RarReader : AbstractReader<RarReaderEntry, RarVolu
|
||||
}
|
||||
}
|
||||
|
||||
protected override async IAsyncEnumerable<RarReaderEntry> GetEntriesAsync(Stream stream)
|
||||
{
|
||||
volume = new RarReaderVolume(stream, Options, 0);
|
||||
await foreach (var fp in volume.ReadFilePartsAsync())
|
||||
{
|
||||
ValidateArchive(volume);
|
||||
yield return new RarReaderEntry(volume.IsSolidArchive, fp);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual IEnumerable<FilePart> CreateFilePartEnumerableForCurrentEntry() =>
|
||||
Entry.Parts;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user