public void Read(BinaryReader br) { Unknown1 = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); Unknown2 = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); Size = br.ReadInt32(); ID = br.ReadInt32(); Data = br.ReadBytes(Size - 12); //Console.WriteLine("Size: {0}, ID: {1}", Size, ID); }
public void Read(BinaryReader br) { StartAndEndFieldId = br.ReadBytes(16); SizeCompressed = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); byte[] DataCompressed = br.ReadBytes(SizeCompressed); SizeDecompressed = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); if (SizeDecompressed < 0) { Console.WriteLine("SizeCompressed: " + SizeCompressed + "|SizeDecompressed: " + SizeDecompressed); //throw new Exception("SizeDecompressed is wrong!"); } byte[] DataDecompressed = m_bnsDat.Deflate(DataCompressed, SizeCompressed, SizeDecompressed); FieldLookupCount = br.ReadInt32(); Fields = new BDAT_FIELDTABLE[FieldLookupCount]; Lookups = new BDAT_LOOKUPTABLE[FieldLookupCount]; //Console.WriteLine("FieldLookupCount: " + FieldLookupCount); BinaryReader mis = new BinaryReader(new MemoryStream(DataDecompressed)); int DataOffset = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); for (int i = 1; i <= FieldLookupCount; i++) { mis.BaseStream.Seek(DataOffset, SeekOrigin.Begin); //Console.WriteLine("test: " + mis.BaseStream.Position + " - " + DataOffset); Fields[i - 1] = new BDAT_FIELDTABLE(); Fields[i - 1].Read(mis); if (i < FieldLookupCount) { DataOffset = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); } else { DataOffset = SizeDecompressed; } Lookups[i - 1] = new BDAT_LOOKUPTABLE(); Lookups[i - 1].Size = DataOffset - (int)mis.BaseStream.Position; Lookups[i - 1].Read(mis); } }
public BDAT_SUBARCHIVE[] SubArchives; // * public void Read(BinaryReader br) { SubArchiveCount = br.ReadInt32(); Unknown = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); SubArchives = new BDAT_SUBARCHIVE[SubArchiveCount]; //string DebugText = ""; for (int i = 0; i < SubArchiveCount; i++) { SubArchives[i] = new BDAT_SUBARCHIVE(); SubArchives[i].Read(br); //DebugText += SubArchives[i].SizeDecompressed + "|"; } //Console.WriteLine("Count SubArchive in Archive: " + SubArchiveCount); }
public void Read(BinaryReader br) { Unknown1 = br.ReadByte(); ID = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); Unknown2 = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); Unknown3 = Ultily.ReadIntFrom2Bytes(br.ReadBytes(2)); Size = br.ReadInt32(); long offsetStart = br.BaseStream.Position; Collection = new BDAT_COLLECTION(); Collection.Read(br); long offsetEnd = br.BaseStream.Position; if (offsetStart + Size != offsetEnd) { br.BaseStream.Seek(offsetStart + Size, SeekOrigin.Begin); } }