public byte[] Unpack() { var memory = new BinaryStream(1024); using (var bs = new BinaryStream(Data)) { for (int i = 1; i < Blocks.Count; i++) { var block = Blocks[i - 1]; var next = Blocks[i]; var size = (int)(next.VirtualOffset - block.VirtualOffset); bs.Seek(block.FileOffset - 4, SeekOrigin.Begin); memory.Seek(block.VirtualOffset, SeekOrigin.Begin); if (block.IsCompressed == true) { var zlib = new InflaterInputStream(bs); zlib.CopyTo(memory); } else { var buffer = bs.ReadBytes(size); memory.Write(buffer, 0, size); } } } return(memory.ToArray()); }