// Initializes new entry internal ZipArchiveEntry(ZipArchive archive, string entryName) { _archive = archive; _originallyInArchive = false; _diskNumberStart = 0; _versionMadeByPlatform = CurrentZipPlatform; _versionMadeBySpecification = ZipVersionNeededValues.Default; _versionToExtract = ZipVersionNeededValues.Default; // this must happen before following two assignment _generalPurposeBitFlag = 0; CompressionMethod = CompressionMethodValues.Deflate; _lastModified = DateTimeOffset.Now; _compressedSize = 0; // we don't know these yet _uncompressedSize = 0; _externalFileAttr = 0; _offsetOfLocalHeader = 0; _storedOffsetOfCompressedData = null; _crc32 = 0; _compressedBytes = null; _storedUncompressedData = null; _currentlyOpenForWrite = false; _everOpenedForWrite = false; _outstandingWriteStream = null; FullName = entryName; _cdUnknownExtraFields = null; _lhUnknownExtraFields = null; _fileComment = null; _compressionLevel = null; if (_storedEntryNameBytes.Length > ushort.MaxValue) { throw new ArgumentException(); } // grab the stream if we're in create mode if (_archive.Mode == ZipArchiveMode.Create) { _archive.AcquireArchiveStream(this); } }
//Initializes new entry internal ZipArchiveEntry(ZipArchive archive, String entryName) { _archive = archive; _originallyInArchive = false; _diskNumberStart = 0; _versionMadeByPlatform = CurrentZipPlatform; _versionMadeBySpecification = ZipVersionNeededValues.Default; _versionToExtract = ZipVersionNeededValues.Default; //this must happen before following two assignment _generalPurposeBitFlag = 0; CompressionMethod = CompressionMethodValues.Deflate; _lastModified = DateTimeOffset.Now; _compressedSize = 0; //we don't know these yet _uncompressedSize = 0; _offsetOfLocalHeader = 0; _storedOffsetOfCompressedData = null; _crc32 = 0; _compressedBytes = null; _storedUncompressedData = null; _currentlyOpenForWrite = false; _everOpenedForWrite = false; _outstandingWriteStream = null; FullName = entryName; _cdUnknownExtraFields = null; _lhUnknownExtraFields = null; _fileComment = null; _compressionLevel = null; if (_storedEntryNameBytes.Length > UInt16.MaxValue) throw new ArgumentException(SR.EntryNamesTooLong); //grab the stream if we're in create mode if (_archive.Mode == ZipArchiveMode.Create) { _archive.AcquireArchiveStream(this); } }