public PUBDEFRecord(RecordReader reader, RecordContext context) : base(reader, context) { int baseGroupIndex = reader.ReadIndex(); if (baseGroupIndex > context.Groups.Count) { throw new InvalidDataException("GroupIndex is out of range."); } if (baseGroupIndex > 0) { this.BaseGroup = context.Groups[baseGroupIndex - 1]; } int baseSegmentIndex = reader.ReadIndex(); if (baseSegmentIndex > context.Segments.Count) { throw new InvalidDataException("SegmentIndex is out of range."); } if (baseSegmentIndex == 0) { this.BaseFrame = reader.ReadUInt16(); } else { this.BaseSegment = context.Segments[baseSegmentIndex - 1]; } int startIndex = context.PublicNames.Count; while (!reader.IsEOF) { PublicNameDefinition def = new PublicNameDefinition(); def.DefinedBy = reader.RecordNumber; def.BaseGroup = BaseGroup; def.BaseSegment = BaseSegment; def.BaseFrame = BaseFrame; def.Name = reader.ReadPrefixedString(); def.Offset = (int)reader.ReadUInt16Or32(); def.TypeIndex = reader.ReadIndex(); context.PublicNames.Add(def); } int endIndex = context.PublicNames.Count; this.Definitions = context.PublicNames.Slice( startIndex, endIndex - startIndex); }
public PUBDEFRecord(RecordReader reader, RecordContext context) : base(reader, context) { int baseGroupIndex = reader.ReadIndex(); if (baseGroupIndex > context.Groups.Count) throw new InvalidDataException("GroupIndex is out of range."); if (baseGroupIndex > 0) this.BaseGroup = context.Groups[baseGroupIndex - 1]; int baseSegmentIndex = reader.ReadIndex(); if (baseSegmentIndex > context.Segments.Count) throw new InvalidDataException("SegmentIndex is out of range."); if (baseSegmentIndex == 0) this.BaseFrame = reader.ReadUInt16(); else this.BaseSegment = context.Segments[baseSegmentIndex - 1]; int startIndex = context.PublicNames.Count; while (!reader.IsEOF) { PublicNameDefinition def = new PublicNameDefinition(); def.DefinedBy = reader.RecordNumber; def.BaseGroup = BaseGroup; def.BaseSegment = BaseSegment; def.BaseFrame = BaseFrame; def.Name = reader.ReadPrefixedString(); def.Offset = (int)reader.ReadUInt16Or32(); def.TypeIndex = reader.ReadIndex(); context.PublicNames.Add(def); } int endIndex = context.PublicNames.Count; this.Definitions = context.PublicNames.Slice( startIndex, endIndex - startIndex); }