Exemplo n.º 1
0
 private void WriteCompressedSizeCRC(Int32 value, byte[] crc,
     ZipEntry entry)
 {
     entry.CompressedSize = value;
     entry.SetCrc(crc);
     baseStream.Seek(offset, SeekOrigin.Begin);
     WriteLeInt32(entry.CompressedSize);
     WriteBytes(crc);
     //Remove the recorded offset
     offset = -1;
     baseStream.Seek(0, SeekOrigin.End);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Open the next entry from the zip archive, and return its 
        /// description. The method expects the pointer to be intact.
        /// </summary>
        private ZipEntry GetNextEntry()
        {
            ZipEntry currentEntry = null;
            Int32 size = ReadLeInt32();
            if (size == -1)
                return new ZipEntry(String.Empty);

            Int32 csize = ReadLeInt32();
            byte[] crc = new byte[16];
            ReadBuf(crc, crc.Length);

            Int32 dostime = ReadLeInt32();
            Int16 nameLength = ReadLeInt16();

            byte[] buffer = new byte[nameLength];
            ReadBuf(buffer, nameLength);
            string name = ConvertToString(buffer);

            currentEntry = new ZipEntry(name);
            currentEntry.Size = size;
            currentEntry.CompressedSize = csize;
            currentEntry.SetCrc(crc);
            currentEntry.DosTime = dostime;

            return currentEntry;
        }