static extern int unzGetCurrentFileInfo64_64( IntPtr handle, out ZipEntryInfo64 entryInfoPtr, byte[] entryNameBuffer, uint entryNameBufferLength, byte[] extraField, uint extraFieldLength, byte[] commentBuffer, uint commentBufferLength);
static internal int unzGetCurrentFileInfo64( IntPtr handle, out ZipEntryInfo64 entryInfoPtr, byte[] entryNameBuffer, uint entryNameBufferLength, byte[] extraField, uint extraFieldLength, byte[] commentBuffer, uint commentBufferLength) { if (Is64) { return(unzGetCurrentFileInfo64_64(handle, out entryInfoPtr, entryNameBuffer, entryNameBufferLength, extraField, extraFieldLength, commentBuffer, commentBufferLength)); } else { return(unzGetCurrentFileInfo64_32(handle, out entryInfoPtr, entryNameBuffer, entryNameBufferLength, extraField, extraFieldLength, commentBuffer, commentBufferLength)); } }
/// <summary>Creates a new Zip file entry reading values from a zip file.</summary> internal ZipEntry(IntPtr handle) { ZipEntryInfo64 entryInfo = new ZipEntryInfo64(); int result = Minizip.unzGetCurrentFileInfo64(handle, out entryInfo, null, 0, null, 0, null, 0); if (result != 0) { throw new ZipException("Could not read entry from zip file " + Name, result); } _extraField = new byte[entryInfo.ExtraFieldLength]; byte[] entryNameBuffer = new byte[entryInfo.FileNameLength]; byte[] commentBuffer = new byte[entryInfo.CommentLength]; result = Minizip.unzGetCurrentFileInfo64(handle, out entryInfo, entryNameBuffer, (uint)entryNameBuffer.Length, _extraField, (uint)_extraField.Length, commentBuffer, (uint)commentBuffer.Length); if (result != 0) { throw new ZipException("Could not read entry from zip file " + Name, result); } this._UTF8Encoding = BitFlag.IsSet(entryInfo.Flag, ZipEntryFlag.UTF8); Encoding encoding = this._UTF8Encoding ? Encoding.UTF8 : Minizip.OEMEncoding; _name = encoding.GetString(entryNameBuffer); //null or empty string if empty buffer? _comment = encoding.GetString(commentBuffer); _crc = entryInfo.Crc; _compressedLength = (long)entryInfo.CompressedSize; _uncompressedLength = (long)entryInfo.UncompressedSize; _method = (CompressionMethod)entryInfo.CompressionMethod; _modifiedTime = entryInfo.ZipDateTime; _fileAttributes = (FileAttributes)entryInfo.ExternalFileAttributes; _isDirectory = InterpretIsDirectory(); }