private void VisitGroupCore(BethesdaGroup group) { this.OnEnterGroup(group); BethesdaGroupReader reader = new BethesdaGroupReader(group); BethesdaGroupReaderState state; while ((state = reader.Read()) != BethesdaGroupReaderState.EndOfContent) { switch (state) { case BethesdaGroupReaderState.Record: this.OnRecord(reader.CurrentRecord); break; case BethesdaGroupReaderState.Subgroup: this.VisitGroupCore(reader.CurrentSubgroup); break; } } this.OnExitGroup(group); }
public Group(BethesdaGroup copyFrom) { this.GroupType = copyFrom.GroupType; this.Label = copyFrom.Label; this.Stamp = copyFrom.Stamp; this.UNKNOWN_18 = copyFrom.UNKNOWN_18; this.Version = copyFrom.Version; this.UNKNOWN_22 = copyFrom.UNKNOWN_22; Record record = null; Record dummyRecord = null; BethesdaGroupReader reader = new BethesdaGroupReader(copyFrom); BethesdaGroupReaderState state; while ((state = reader.Read()) != BethesdaGroupReaderState.EndOfContent) { switch (state) { case BethesdaGroupReaderState.Record: this.Records.Add(record = new Record(reader.CurrentRecord) { Parent = this }); break; case BethesdaGroupReaderState.Subgroup: var currSubgroup = reader.CurrentSubgroup; switch (currSubgroup.GroupType) { case BethesdaGroupType.CellChildren: case BethesdaGroupType.CellPersistentChildren: case BethesdaGroupType.CellTemporaryChildren: case BethesdaGroupType.CellVisibleDistantChildren: case BethesdaGroupType.WorldChildren: case BethesdaGroupType.TopicChildren: break; default: record = null; break; } if (record == null) { if (dummyRecord == null) { this.Records.Add(dummyRecord = new Record { Parent = this }); } record = dummyRecord; } record.Subgroups.Add(new Group(currSubgroup) { Parent = record }); break; } } }