Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
        }