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

◆ SeekBackwardsToSignature()

static bool System.IO.Compression.ZipHelper.SeekBackwardsToSignature ( Stream stream,
uint signatureToFind,
int maxBytesToRead )
inlinestaticpackage

Definition at line 71 of file ZipHelper.cs.

72 {
73 int bufferPointer = 0;
74 uint num = 0u;
75 byte[] array = new byte[32];
76 bool flag = false;
77 bool flag2 = false;
78 int num2 = 0;
79 while (!flag2 && !flag && num2 <= maxBytesToRead)
80 {
81 flag = SeekBackwardsAndRead(stream, array, out bufferPointer);
82 while (bufferPointer >= 0 && !flag2)
83 {
84 num = (num << 8) | array[bufferPointer];
85 if (num == signatureToFind)
86 {
87 flag2 = true;
88 }
89 else
90 {
91 bufferPointer--;
92 }
93 }
94 num2 += array.Length;
95 }
96 if (!flag2)
97 {
98 return false;
99 }
100 stream.Seek(bufferPointer, SeekOrigin.Current);
101 return true;
102 }
static bool SeekBackwardsAndRead(Stream stream, byte[] buffer, out int bufferPointer)
Definition ZipHelper.cs:119

References System.array, System.IO.Compression.ZipHelper.SeekBackwardsAndRead(), and System.stream.

Referenced by System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory(), and System.IO.Compression.ZipArchive.TryReadZip64EndOfCentralDirectory().