public override Stream OpenEntry(ArcFile arc, Entry entry) { if (0xFF435031 != arc.File.View.ReadUInt32(entry.Offset)) { return(base.OpenEntry(arc, entry)); } var data = arc.File.View.ReadBytes(entry.Offset, entry.Size); data = PackOpener.Decompress(data) ?? data; return(new BinMemoryStream(data, entry.Name)); }
public override Stream OpenEntry(ArcFile arc, Entry entry) { if (0xFF435031 != arc.File.View.ReadUInt32(entry.Offset)) { return(base.OpenEntry(arc, entry)); } var packed = new byte[entry.Size]; arc.File.View.Read(entry.Offset, packed, 0, entry.Size); var unpacked = PackOpener.Decompress(packed); if (null == unpacked) { return(new MemoryStream(packed)); } return(new MemoryStream(unpacked)); }
public PackIndexReader(PackOpener fmt, ArcView file, long index_offset) { m_fmt = fmt; m_file = file; m_pack_version = new Version(m_file.View.ReadByte(index_offset + 0xB) - '0', m_file.View.ReadByte(index_offset + 0xD) - '0'); m_count = m_file.View.ReadInt32(index_offset + 0x10); if (!ArchiveFormat.IsSaneCount(m_count)) { throw new InvalidFormatException(); } m_index_offset = m_file.View.ReadInt64(index_offset + 0x14); if (index_offset < 0 || index_offset >= m_file.MaxOffset) { throw new InvalidFormatException(); } m_index = m_file.CreateStream(m_index_offset); m_dir = new List <Entry> (m_count); }