Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ReadAllBytes()

static byte[] System.IO.File.ReadAllBytes ( string path)
inlinestatic

Definition at line 314 of file File.cs.

315 {
316 using FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1, FileOptions.SequentialScan);
317 long length = fileStream.Length;
318 if (length > int.MaxValue)
319 {
320 throw new IOException(SR.IO_FileTooLong2GB);
321 }
322 if (length == 0L)
323 {
325 }
326 int num = 0;
327 int num2 = (int)length;
328 byte[] array = new byte[num2];
329 while (num2 > 0)
330 {
331 int num3 = fileStream.Read(array, num, num2);
332 if (num3 == 0)
333 {
334 ThrowHelper.ThrowEndOfFileException();
335 }
336 num += num3;
337 num2 -= num3;
338 }
339 return array;
340 }
static byte[] ReadAllBytesUnknownLength(FileStream fs)
Definition File.cs:1015

References System.array, System.SR.IO_FileTooLong2GB, System.L, System.length, System.IO.File.ReadAllBytesUnknownLength(), and System.ThrowHelper.ThrowEndOfFileException().

Referenced by Internal.Cryptography.Pal.CertificatePal.FromBlobOrFile(), Internal.Cryptography.Pal.StorePal.FromBlobOrFile(), and Terraria.Utilities.FileUtilities.ReadAllBytes().