public void Import(Stream stream) { using (JpkBinaryReader reader = new JpkBinaryReader(EndianBitConverter.Little, stream)) { this.Data = reader.ReadBytes((int)reader.BaseStream.Length); } }
public void Read(Stream stream) { using (JpkBinaryReader reader = new JpkBinaryReader(EndianBitConverter.Little, stream)) { uint magic = reader.ReadUInt32(); if (magic != 1262571594) { throw new Exception("This is not a Jpk file!"); } reader.ReadBytes(4); // unk - 0 int numEntries = reader.ReadInt32(); this.Alignment = reader.ReadInt32(); reader.ReadBytes(4); // unk - 0 int offsetToFileNames = reader.ReadInt32(); reader.ReadBytes(8); // unk - 0 for (int i = 0; i < numEntries; i++) { reader.Seek(32 + i * 32, SeekOrigin.Begin); JpkEntry entry = new JpkEntry(this); entry.Read(reader); this.Entries.Add(entry); } } }
public void Read(JpkBinaryReader reader) { this._nameOffset = reader.ReadInt32(); int dataSize = reader.ReadInt32(); this._fileOffset = reader.ReadInt32(); //reader.ReadBytes(20); skip remaining 20 bytes reader.Seek(this._nameOffset, SeekOrigin.Begin); this.Name = reader.ReadString(); reader.Seek(this._fileOffset, SeekOrigin.Begin); this.Data = reader.ReadBytes(dataSize); }