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

◆ TryGetZip64BlockFromGenericExtraField()

static bool System.IO.Compression.Zip64ExtraField.TryGetZip64BlockFromGenericExtraField ( ZipGenericExtraField extraField,
bool readUncompressedSize,
bool readCompressedSize,
bool readLocalHeaderOffset,
bool readStartDiskNumber,
out Zip64ExtraField zip64Block )
inlinestaticprivate

Definition at line 103 of file Zip64ExtraField.cs.

104 {
105 zip64Block = default(Zip64ExtraField);
106 zip64Block._compressedSize = null;
107 zip64Block._uncompressedSize = null;
108 zip64Block._localHeaderOffset = null;
109 zip64Block._startDiskNumber = null;
110 if (extraField.Tag != 1)
111 {
112 return false;
113 }
114 MemoryStream memoryStream = null;
115 try
116 {
117 memoryStream = new MemoryStream(extraField.Data);
118 using BinaryReader binaryReader = new BinaryReader(memoryStream);
119 memoryStream = null;
120 zip64Block._size = extraField.Size;
121 ushort num = 0;
123 {
124 num += 8;
125 }
127 {
128 num += 8;
129 }
131 {
132 num += 8;
133 }
135 {
136 num += 4;
137 }
138 if (num != zip64Block._size)
139 {
140 return false;
141 }
143 {
144 zip64Block._uncompressedSize = binaryReader.ReadInt64();
145 }
147 {
148 zip64Block._compressedSize = binaryReader.ReadInt64();
149 }
151 {
152 zip64Block._localHeaderOffset = binaryReader.ReadInt64();
153 }
155 {
156 zip64Block._startDiskNumber = binaryReader.ReadInt32();
157 }
158 if (zip64Block._uncompressedSize < 0)
159 {
160 throw new InvalidDataException(System.SR.FieldTooBigUncompressedSize);
161 }
162 if (zip64Block._compressedSize < 0)
163 {
164 throw new InvalidDataException(System.SR.FieldTooBigCompressedSize);
165 }
166 if (zip64Block._localHeaderOffset < 0)
167 {
168 throw new InvalidDataException(System.SR.FieldTooBigLocalHeaderOffset);
169 }
170 if (zip64Block._startDiskNumber < 0)
171 {
172 throw new InvalidDataException(System.SR.FieldTooBigStartDiskNumber);
173 }
174 return true;
175 }
176 finally
177 {
178 memoryStream?.Dispose();
179 }
180 }
static string FieldTooBigCompressedSize
Definition SR.cs:84
static string FieldTooBigStartDiskNumber
Definition SR.cs:94
static string FieldTooBigLocalHeaderOffset
Definition SR.cs:86
static string FieldTooBigUncompressedSize
Definition SR.cs:96
Definition SR.cs:7

References System.SR.FieldTooBigCompressedSize, System.SR.FieldTooBigLocalHeaderOffset, System.SR.FieldTooBigStartDiskNumber, and System.SR.FieldTooBigUncompressedSize.

Referenced by System.IO.Compression.Zip64ExtraField.GetAndRemoveZip64Block(), and System.IO.Compression.Zip64ExtraField.GetJustZip64Block().