Endfield??

This commit is contained in:
Chizuui
2025-11-27 06:42:57 +07:00
parent 7ef1566d15
commit 051cb4f3e8
22 changed files with 1813 additions and 2 deletions

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeyondTools.VFS.Extensions
{
internal static class StreamExtensions
{
public static void CopyBytes(this Stream inStream, Stream outStream, long? count = null)
{
if (count == null)
{
inStream.CopyTo(outStream);
return;
}
long readBytes = 0L;
var buffer = new byte[64 * 1024];
do
{
var toRead = Math.Min((long)(count - readBytes), buffer.LongLength);
var readNow = inStream.Read(buffer, 0, (int)toRead);
if (readNow == 0)
break;
outStream.Write(buffer, 0, readNow);
readBytes += readNow;
} while (readBytes < count);
}
}
}