merge fixes

This commit is contained in:
Adam Hathcock
2025-10-23 14:48:24 +01:00
parent 773e3ac048
commit d5f93c5c08
3 changed files with 4 additions and 36 deletions

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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;