public byte[] ExtractFile(ArchiveFile entry) { if (!Contains(entry.Name)) { return(null); } FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read); BinaryReader reader = new BinaryReader(stream); reader.BaseStream.Seek(entry.StartAddress, SeekOrigin.Begin); byte[] fileData = reader.ReadBytes((int)entry.FileSize); reader.Close(); return(fileData); }
public byte[] ExtractFile(ArchiveFile entry) { if (!Contains(entry.Name)) return null; FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read); BinaryReader reader = new BinaryReader(stream); reader.BaseStream.Seek(entry.StartAddress, SeekOrigin.Begin); byte[] fileData = reader.ReadBytes((int)entry.FileSize); reader.Close(); return fileData; }