Reapply "8.2版本上传"

This reverts commit e9af7221de.
This commit is contained in:
2025-06-18 17:39:12 +08:00
parent b19509ddb1
commit d48c1f1f7b
261 changed files with 9061 additions and 1336 deletions

View File

@@ -0,0 +1,32 @@
using System.IO;
namespace UnityFS
{
public static class StreamExtensions
{
private const int BufferSize = 81920;
public static void CopyTo(this Stream source, Stream destination, long size)
{
var buffer = new byte[BufferSize];
for (var left = size; left > 0; left -= BufferSize)
{
int toRead = BufferSize < left ? BufferSize : (int)left;
int read = source.Read(buffer, 0, toRead);
destination.Write(buffer, 0, read);
if (read != toRead)
{
return;
}
}
}
public static byte[] ReadAllBytes(this Stream source)
{
source.Position = 0;
var bytes = new byte[source.Length];
source.Read(bytes, 0, bytes.Length);
return bytes;
}
}
}