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

◆ ReadEndOfCentralDirectory()

void System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory ( )
inlineprivate

Definition at line 353 of file ZipArchive.cs.

354 {
355 try
356 {
358 if (!ZipHelper.SeekBackwardsToSignature(_archiveStream, 101010256u, 65539))
359 {
360 throw new InvalidDataException(System.SR.EOCDNotFound);
361 }
362 long position = _archiveStream.Position;
363 ZipEndOfCentralDirectoryBlock eocdBlock;
364 bool flag = ZipEndOfCentralDirectoryBlock.TryReadBlock(_archiveReader, out eocdBlock);
365 if (eocdBlock.NumberOfThisDisk != eocdBlock.NumberOfTheDiskWithTheStartOfTheCentralDirectory)
366 {
367 throw new InvalidDataException(System.SR.SplitSpanned);
368 }
369 _numberOfThisDisk = eocdBlock.NumberOfThisDisk;
370 _centralDirectoryStart = eocdBlock.OffsetOfStartOfCentralDirectoryWithRespectToTheStartingDiskNumber;
371 if (eocdBlock.NumberOfEntriesInTheCentralDirectory != eocdBlock.NumberOfEntriesInTheCentralDirectoryOnThisDisk)
372 {
373 throw new InvalidDataException(System.SR.SplitSpanned);
374 }
375 _expectedNumberOfEntries = eocdBlock.NumberOfEntriesInTheCentralDirectory;
376 if (_mode == ZipArchiveMode.Update)
377 {
378 _archiveComment = eocdBlock.ArchiveComment;
379 }
382 {
383 throw new InvalidDataException(System.SR.FieldTooBigOffsetToCD);
384 }
385 }
386 catch (EndOfStreamException innerException)
387 {
388 throw new InvalidDataException(System.SR.CDCorrupt, innerException);
389 }
390 catch (IOException innerException2)
391 {
392 throw new InvalidDataException(System.SR.CDCorrupt, innerException2);
393 }
394 }
void TryReadZip64EndOfCentralDirectory(ZipEndOfCentralDirectoryBlock eocd, long eocdStart)
long Seek(long offset, SeekOrigin origin)
static string EOCDNotFound
Definition SR.cs:82
static string FieldTooBigOffsetToCD
Definition SR.cs:90
static string SplitSpanned
Definition SR.cs:118
static string CDCorrupt
Definition SR.cs:54
Definition SR.cs:7

References System.IO.Compression.ZipArchive._archiveComment, System.IO.Compression.ZipArchive._archiveReader, System.IO.Compression.ZipArchive._archiveStream, System.IO.Compression.ZipArchive._centralDirectoryStart, System.IO.Compression.ZipArchive._expectedNumberOfEntries, System.IO.Compression.ZipArchive._mode, System.IO.Compression.ZipArchive._numberOfThisDisk, System.SR.CDCorrupt, System.SR.EOCDNotFound, System.SR.FieldTooBigOffsetToCD, System.L, System.IO.Stream.Length, System.IO.Stream.Position, System.IO.Stream.Seek(), System.IO.Compression.ZipHelper.SeekBackwardsToSignature(), System.SR.SplitSpanned, System.IO.Compression.ZipEndOfCentralDirectoryBlock.TryReadBlock(), and System.IO.Compression.ZipArchive.TryReadZip64EndOfCentralDirectory().

Referenced by System.IO.Compression.ZipArchive.ZipArchive().