From 8e419a32572d8991e12babcd7d3a2240aac810f3 Mon Sep 17 00:00:00 2001 From: ninemine <1371605831@qq.com> Date: Wed, 3 Dec 2025 14:35:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E5=8C=96File=E4=B8=AD=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E4=BA=8C=E8=BF=9B=E5=88=B6=E7=9A=84=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Convention/[Runtime]/File.cs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/Convention/[Runtime]/File.cs b/Convention/[Runtime]/File.cs index 6cb79c8..84f0410 100644 --- a/Convention/[Runtime]/File.cs +++ b/Convention/[Runtime]/File.cs @@ -201,18 +201,7 @@ namespace Convention { if (IsFile() == false) throw new InvalidOperationException("Target is not a file"); - var file = this.OriginInfo as FileInfo; - const int BlockSize = 1024; - long FileSize = file.Length; - byte[] result = new byte[FileSize]; - long offset = 0; - using (var fs = file.OpenRead()) - { - fs.ReadAsync(result[(int)(offset)..(int)(offset + BlockSize)], 0, (int)(offset + BlockSize) - (int)(offset)); - offset += BlockSize; - offset = System.Math.Min(offset, FileSize); - } - return result; + return File.ReadAllBytes(OriginPath); } public List LoadAsCsv() @@ -340,7 +329,8 @@ namespace Convention public void SaveAsBinary(byte[] data) { - SaveDataAsBinary(OriginPath, data, (OriginInfo as FileInfo).OpenWrite()); + using var fs = (OriginInfo as FileInfo).OpenWrite(); + SaveDataAsBinary(OriginPath, data, fs); } public void SaveAsCsv(List csvData)