public void Write(EndianStream ew) { ew.Write(signature); ew.Write(diskNumber); ew.Write(startDiskNumber); ew.Write(entriesOnDisk); ew.Write(EntriesInDirectory); ew.Write(directorySize); ew.Write(DirectoryOffset); ew.Write(commentLength); ew.Write(comment); }
public ZipEndLocator(EndianStream er) { stream = er; signature = er.ReadInt32(); diskNumber = er.ReadInt16(); startDiskNumber = er.ReadInt16(); entriesOnDisk = er.ReadInt16(); EntriesInDirectory = er.ReadInt16(); directorySize = er.ReadInt32(); DirectoryOffset = er.ReadInt32(); commentLength = er.ReadInt16(); comment = er.ReadASCII(commentLength); }
public ZipFileRecord(EndianStream er) { stream = er; signature = er.ReadInt32(); version = er.ReadInt16(); flags = er.ReadInt16(); compression = (CompressionType)er.ReadInt16(); fileTime = er.ReadInt16(); fileDate = er.ReadInt16(); Crc = er.ReadUInt32(); CompressedSize = er.ReadInt32(); UncompressedSize = er.ReadInt32(); fileNameLength = er.ReadInt16(); extraFieldLength = er.ReadInt16(); fileName = er.ReadASCII(fileNameLength); extraField = er.ReadASCII(extraFieldLength); data = er.ReadBytes(CompressedSize); }
public LZX(string file) { File = new FileStream(file, FileMode.Open, FileAccess.ReadWrite, FileShare.None); io = new EndianStream(File, false); // Read it to make sure its a PkZip file io.Seek((int)io.Length - 0x16, SeekOrigin.Begin); if (io.ReadInt32() != 0x06054B50) throw new Exception("This is not a PkZip File!"); // Lets read the structure io.Seek((int)io.Length - 0x16, SeekOrigin.Begin); ZipEndLocator el = new ZipEndLocator(io); // Now that we have this info lets read our directory entries entries = new List<ZipDirEntry>(); io.Seek(el.DirectoryOffset, SeekOrigin.Begin); for (int i = 0; i < el.EntriesInDirectory; i++) { entries.Add(new ZipDirEntry(io)); } }
public ZipDirEntry(EndianStream es) { stream = es; offset = (int)es.Position; signature = es.ReadInt32(); versionMadeBy = es.ReadInt16(); versionToExtract = es.ReadInt16(); flags = es.ReadInt16(); compression = (CompressionType)es.ReadInt16(); fileTime = es.ReadInt16(); fileDate = es.ReadInt16(); crc = es.ReadUInt32(); compressedSize = es.ReadInt32(); uncompressedSize = es.ReadInt32(); fileNameLength = es.ReadInt16(); extraFieldLength = es.ReadInt16(); fileCommentLength = es.ReadInt16(); diskNumberStart = es.ReadInt16(); internalAttributes = es.ReadInt16(); externalAttributes = es.ReadInt32(); headerOffset = es.ReadInt32(); fileName = es.ReadASCII(fileNameLength); extraField = es.ReadASCII(extraFieldLength); }