mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
fix disposal and other simple issues
This commit is contained in:
@@ -34,7 +34,7 @@ public partial class TarArchive
|
||||
new SourceStream(
|
||||
fileInfo,
|
||||
i => ArchiveVolumeFactory.GetFilePart(i, fileInfo),
|
||||
readerOptions ?? new ReaderOptions() { LeaveStreamOpen = false}
|
||||
readerOptions ?? new ReaderOptions() { LeaveStreamOpen = false }
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public partial class TarArchive
|
||||
new SourceStream(
|
||||
files[0],
|
||||
i => i < files.Length ? files[i] : null,
|
||||
readerOptions ?? new ReaderOptions() { LeaveStreamOpen = false}
|
||||
readerOptions ?? new ReaderOptions() { LeaveStreamOpen = false }
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public partial class ZipArchive
|
||||
public static IWritableArchive OpenArchive(string filePath, ReaderOptions? readerOptions = null)
|
||||
{
|
||||
filePath.NotNullOrEmpty(nameof(filePath));
|
||||
return OpenArchive(new FileInfo(filePath), readerOptions ?? new ReaderOptions());
|
||||
return OpenArchive(new FileInfo(filePath), readerOptions);
|
||||
}
|
||||
|
||||
public static IWritableArchive OpenArchive(
|
||||
@@ -35,6 +35,9 @@ public partial class ZipArchive
|
||||
fileInfo,
|
||||
i => ZipArchiveVolumeFactory.GetFilePart(i, fileInfo),
|
||||
readerOptions ?? new ReaderOptions()
|
||||
{
|
||||
LeaveStreamOpen = false
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -51,6 +54,9 @@ public partial class ZipArchive
|
||||
files[0],
|
||||
i => i < files.Length ? files[i] : null,
|
||||
readerOptions ?? new ReaderOptions()
|
||||
{
|
||||
LeaveStreamOpen = false
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -81,7 +87,7 @@ public partial class ZipArchive
|
||||
}
|
||||
|
||||
return new ZipArchive(
|
||||
new SourceStream(stream, i => null, readerOptions ?? new ReaderOptions())
|
||||
new SourceStream(stream, i => null, readerOptions ?? new ReaderOptions())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ internal abstract partial class ZipFilePart
|
||||
}
|
||||
case ZipCompressionMethod.BZip2:
|
||||
{
|
||||
return BZip2Stream.Create(stream, CompressionMode.Decompress, false);
|
||||
return await BZip2Stream.CreateAsync(stream, CompressionMode.Decompress, false, cancellationToken: cancellationToken);
|
||||
}
|
||||
case ZipCompressionMethod.LZMA:
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ public abstract partial class AbstractWriter
|
||||
await Task.CompletedTask.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public ValueTask DisposeAsync()
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ public partial class ZipWriter : AbstractWriter
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
if (isDisposing && OutputStream is not null)
|
||||
if (isDisposing)
|
||||
{
|
||||
ulong size = 0;
|
||||
foreach (var entry in entries)
|
||||
|
||||
Reference in New Issue
Block a user