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 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)); } }