mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 07:54:39 +00:00
merge fixes
This commit is contained in:
@@ -26,7 +26,7 @@ public static class IArchiveEntryExtensions
|
||||
using (entryStream)
|
||||
{
|
||||
using Stream s = new ListeningStream(streamListener, entryStream);
|
||||
await s.TransferToAsync(streamToWriteTo);
|
||||
await s.CopyToAsync(streamToWriteTo);
|
||||
}
|
||||
streamListener.FireEntryExtractionEnd(archiveEntry);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public static class IArchiveExtensions
|
||||
|
||||
// Write file
|
||||
using var fs = File.OpenWrite(path);
|
||||
entry.WriteTo(fs);
|
||||
await entry.WriteToAsync(fs);
|
||||
|
||||
// Update progress
|
||||
bytesRead += entry.Size;
|
||||
|
||||
@@ -86,7 +86,7 @@ internal static class Utility
|
||||
|
||||
public static void Skip(this Stream source)
|
||||
{
|
||||
var buffer = GetTransferByteArray();
|
||||
var buffer = ArrayPool<byte>.Shared.Rent(TEMP_BUFFER_SIZE);
|
||||
try
|
||||
{
|
||||
do { } while (source.Read(buffer, 0, buffer.Length) == buffer.Length);
|
||||
@@ -99,7 +99,7 @@ internal static class Utility
|
||||
|
||||
public static async Task SkipAsync(this Stream source)
|
||||
{
|
||||
var buffer = GetTransferByteArray();
|
||||
var buffer = ArrayPool<byte>.Shared.Rent(TEMP_BUFFER_SIZE);
|
||||
try
|
||||
{
|
||||
do { } while (await source.ReadAsync(buffer, 0, buffer.Length) == buffer.Length);
|
||||
@@ -110,38 +110,6 @@ internal static class Utility
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Find(this Stream source, byte[] array)
|
||||
{
|
||||
var buffer = GetTransferByteArray();
|
||||
try
|
||||
{
|
||||
var count = 0;
|
||||
var len = source.Read(buffer, 0, buffer.Length);
|
||||
|
||||
do
|
||||
{
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
if (array[count] == buffer[i])
|
||||
{
|
||||
count++;
|
||||
if (count == array.Length)
|
||||
{
|
||||
source.Position = source.Position - len + i - array.Length + 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while ((len = source.Read(buffer, 0, buffer.Length)) > 0);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(buffer);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static DateTime DosDateToDateTime(ushort iDate, ushort iTime)
|
||||
{
|
||||
var year = (iDate / 512) + 1980;
|
||||
|
||||
Reference in New Issue
Block a user