internal Module(AssetLoader loader) : base(loader) { loader.Progress = 0; Reader = loader.Reader; var tes4Record = new RecordHeader(Reader); tes4Record.RequireType("TES4"); using (RecordReader reader = tes4Record.OpenReader(Reader)) { while (reader.ReadField()) { switch (reader.Field.Type) { case "HEDR": reader.RequireFieldSize(12); Version = reader.ReadSingle(); RecordCount = reader.ReadInt32(); NextAvailableObjectId = reader.ReadFormId(); break; case "CNAM": Author = reader.ReadStringBody(); break; case "SNAM": Description = reader.ReadStringBody(); break; case "MAST": MastersMutable.Add(reader.ReadStringBody()); break; case "DATA": // File size of a MAST - always 0, probably vestigial. long fileSize = reader.ReadInt64OrInt32Body(); if (fileSize != 0) { throw new InvalidDataException(); } break; case "ONAM": OverridesMutable.Capacity = reader.Field.Size / 4; for (int index = 0, count = reader.Field.Size / 4; index < count; index++) { OverridesMutable.Add(reader.ReadFormId()); } break; case "INTV": InternalVersion = reader.ReadInt32Body(); break; case "INCC": InternalCC = reader.ReadInt32Body(); break; default: throw reader.UnknownFieldException(); } } } while (!loader.AtEnd) { loader.SetProgressToPosition(); AddChild(Group.ReadGroup(this)); } }
public RecordReader(RecordHeader record, BinaryReader reader) { this.record = record; this.field = new RecordField(); if (record.IsCompressed) { this.reader = null; this.compressedReader = reader; this.endOffset = -1; } else { this.reader = reader; this.compressedReader = null; this.endOffset = record.EndOffset; } }
internal Module(AssetLoader loader) : base(loader) { loader.Progress = 0; Reader = loader.Reader; var tes4Record = new RecordHeader(Reader); tes4Record.RequireType("TES4"); using (RecordReader reader = tes4Record.OpenReader(Reader)) { while (reader.ReadField()) { switch (reader.Field.Type) { case "HEDR": reader.RequireFieldSize(12); Version = reader.ReadSingle(); RecordCount = reader.ReadInt32(); NextAvailableObjectId = reader.ReadFormId(); break; case "CNAM": Author = reader.ReadStringBody(); break; case "SNAM": Description = reader.ReadStringBody(); break; case "MAST": MastersMutable.Add(reader.ReadStringBody()); break; case "DATA": // File size of a MAST - always 0, probably vestigial. long fileSize = reader.ReadInt64OrInt32Body(); if (fileSize != 0) throw new InvalidDataException(); break; case "ONAM": OverridesMutable.Capacity = reader.Field.Size / 4; for (int index = 0, count = reader.Field.Size / 4; index < count; index++) OverridesMutable.Add(reader.ReadFormId()); break; case "INTV": InternalVersion = reader.ReadInt32Body(); break; case "INCC": InternalCC = reader.ReadInt32Body(); break; default: throw reader.UnknownFieldException(); } } } while (!loader.AtEnd) { loader.SetProgressToPosition(); AddChild(Group.ReadGroup(this)); } }
public RecordReader(RecordHeader record, BinaryReader reader) { this.record = record; this.field = new RecordField(); if (record.IsCompressed) { this.reader = null; this.compressedReader = reader; this.endOffset = -1; } else { this.reader = reader; this.compressedReader = null; this.endOffset = record.EndOffset; } }
internal Record(Module module, RecordReader reader) : base(module.Manager, "") { Header = reader.Record; Name = Header.Type; }