public PakEntry(UE_Reader reader, PakIndex index) { Index = index; Filename = reader.ReadString(); long start_position = reader.BaseStream.Position; Position = reader.ReadInt64(); if (Position < 0) { reader.BaseStream.Position += 0x2A; HeaderSize = reader.BaseStream.Position - start_position; return; } Size = reader.ReadInt64(); UncompressedSize = reader.ReadInt64(); CompressionMethodIndex = reader.ReadByte(); Hash = reader.ReadBytes(20); PakCompressedBlockCount = reader.ReadInt32(); Blocks = new PakCompressedBlock[PakCompressedBlockCount]; for (int i = 0; i < Blocks.Length; i++) { Blocks[i] = new PakCompressedBlock(reader); } Encrypted = reader.ReadByte() > 0; // need UE Viewer source reference if (PakCompressedBlockCount > 0) { CompressionBlockSize = reader.ReadInt32(); } HeaderSize = reader.BaseStream.Position - start_position; }
static byte[] ReadBlock(UE_Reader reader, PakEntry entry, PakCompressedBlock b_info) { reader.BaseStream.Position = entry.Position + b_info.CompressedStart; long length = b_info.CompressedEnd - b_info.CompressedStart; return(reader.ReadBytes((int)length)); }