public static WriteBlock ( Stream stream, long numberOfEntries, long startOfCentralDirectory, long sizeOfCentralDirectory, byte archiveComment ) : void | ||
stream | Stream | |
numberOfEntries | long | |
startOfCentralDirectory | long | |
sizeOfCentralDirectory | long | |
archiveComment | byte | |
리턴 | void |
//writes eocd, and if needed, zip 64 eocd, zip64 eocd locator //should only throw an exception in extremely exceptional cases because it is called from dispose private void WriteArchiveEpilogue(long startOfCentralDirectory, long sizeOfCentralDirectory) { //determine if we need Zip 64 bool needZip64 = false; if (startOfCentralDirectory >= uint.MaxValue || sizeOfCentralDirectory >= uint.MaxValue || _entries.Count >= ZipHelper.Mask16Bit #if DEBUG_FORCE_ZIP64 || _forceZip64 #endif ) { needZip64 = true; } //if we need zip 64, write zip 64 eocd and locator if (needZip64) { long zip64EOCDRecordStart = _archiveStream.Position; Zip64EndOfCentralDirectoryRecord.WriteBlock(_archiveStream, _entries.Count, startOfCentralDirectory, sizeOfCentralDirectory); Zip64EndOfCentralDirectoryLocator.WriteBlock(_archiveStream, zip64EOCDRecordStart); } //write normal eocd ZipEndOfCentralDirectoryBlock.WriteBlock(_archiveStream, _entries.Count, startOfCentralDirectory, sizeOfCentralDirectory, _archiveComment); }
private void WriteArchiveEpilogue(long startOfCentralDirectory, long sizeOfCentralDirectory) { bool flag = false; if (startOfCentralDirectory >= (ulong)-1 || sizeOfCentralDirectory >= (ulong)-1 || this._entries.Count >= 65535) { flag = true; } if (flag) { long position = this._archiveStream.Position; Zip64EndOfCentralDirectoryRecord.WriteBlock(this._archiveStream, (long)this._entries.Count, startOfCentralDirectory, sizeOfCentralDirectory); Zip64EndOfCentralDirectoryLocator.WriteBlock(this._archiveStream, position); } ZipEndOfCentralDirectoryBlock.WriteBlock(this._archiveStream, (long)this._entries.Count, startOfCentralDirectory, sizeOfCentralDirectory, this._archiveComment); }