Esempio n. 1
0
        protected ZipStreamEntry NextEntry()
        {
            if (_entryStream != null) {
                _entryStream.Dispose();
                _entryStream = null;
            }

            ZipStreamEntry entry = new ZipStreamEntry();

            entry._signature            = _reader.ReadInt32();

            if (entry.Signature != LocalFileHeaderSignature)
                return null;

            entry._version              = _reader.ReadInt16();
            entry._flags                = _reader.ReadInt16();
            entry._compression          = _reader.ReadInt16();
            entry._time                 = _reader.ReadInt16();
            entry._date                 = _reader.ReadInt16();
            entry._crc32                = _reader.ReadInt32();
            entry._compressedLength     = _reader.ReadInt32();
            entry._uncompressedLength   = _reader.ReadInt32();
            entry._nameLength           = _reader.ReadInt16();
            entry._extraLength          = _reader.ReadInt16();
            entry._fileName             = _reader.ReadBytes(entry.NameLength);
            entry._extraField           = _reader.ReadBytes(entry.ExtraLength);

            _entryStream = new LimitStream(_reader.BaseStream, entry.CompressedLength);

            if (entry.CompressionMethod == ZipStreamEntry.COMPRESS_DEFLATE) {
                _entryStream = new DeflateStream(_entryStream, CompressionMode.Decompress);
            }

            return entry;
        }
Esempio n. 2
0
        protected ZipStreamEntry NextEntry()
        {
            if (_entryStream != null)
            {
                _entryStream.Dispose();
                _entryStream = null;
            }

            ZipStreamEntry entry = new ZipStreamEntry();

            entry._signature = _reader.ReadInt32();

            if (entry.Signature != LocalFileHeaderSignature)
            {
                return(null);
            }

            entry._version            = _reader.ReadInt16();
            entry._flags              = _reader.ReadInt16();
            entry._compression        = _reader.ReadInt16();
            entry._time               = _reader.ReadInt16();
            entry._date               = _reader.ReadInt16();
            entry._crc32              = _reader.ReadInt32();
            entry._compressedLength   = _reader.ReadInt32();
            entry._uncompressedLength = _reader.ReadInt32();
            entry._nameLength         = _reader.ReadInt16();
            entry._extraLength        = _reader.ReadInt16();
            entry._fileName           = _reader.ReadBytes(entry.NameLength);
            entry._extraField         = _reader.ReadBytes(entry.ExtraLength);

            _entryStream = new LimitStream(_reader.BaseStream, entry.CompressedLength);

            if (entry.CompressionMethod == ZipStreamEntry.COMPRESS_DEFLATE)
            {
                _entryStream = new DeflateStream(_entryStream, CompressionMode.Decompress);
            }

            return(entry);
        }