public void Read(PsoDataReader reader) { Entries = new List <IPsoValue>(); for (int i = 0; i < numberOfEntries; i++) { var entry = PsoTypeBuilder.Make(pso, structureInfo, entryInfo); entry.Read(reader); Entries.Add(entry); } }
public void Read(PsoDataReader reader) { var blockIndexAndOffset = reader.ReadUInt32(); var BlockIndex = (int)(blockIndexAndOffset & 0x00000FFF); var Offset = (int)((blockIndexAndOffset & 0xFFFFF000) >> 12); var zero_4h = reader.ReadUInt32(); if (zero_4h != 0) { throw new Exception("zero_4h should be 0"); } var size1 = reader.ReadUInt16(); var size2 = reader.ReadUInt16(); if (size1 != size2) { throw new Exception("size1 should be size2"); } var NumberOfEntries = size1; var zero_Ch = reader.ReadUInt32(); if (zero_Ch != 0) { throw new Exception("zero_Ch should be 0"); } if (BlockIndex > 0) { // read reference data... var backupOfSection = reader.CurrentSectionIndex; var backupOfPosition = reader.Position; reader.SetSectionIndex(BlockIndex - 1); reader.Position = Offset; Entries = new List <IPsoValue>(); for (int i = 0; i < NumberOfEntries; i++) { var entry = PsoTypeBuilder.Make(pso, structureInfo, entryInfo); entry.Read(reader); Entries.Add(entry); } reader.SetSectionIndex(backupOfSection); reader.Position = backupOfPosition; } else { Entries = null; } }
public void Read(PsoDataReader reader) { long backupOfPosition = reader.Position; this.Values = new Dictionary <int, IPsoValue>(); for (int i = 0; i < structureInfo.Entries.Count; i++) { // skip unnamed entries... var x1 = structureInfo.Entries[i]; if (x1.EntryNameHash == 0x100) { continue; } reader.Position = backupOfPosition + x1.DataOffset; var value = PsoTypeBuilder.Make(pso, structureInfo, x1); value.Read(reader); Values.Add(x1.EntryNameHash, value); } reader.Position = backupOfPosition + structureInfo.StructureLength; }