public IEnumerable <T> Parse( MutagenFrame frame, BinaryMasterParseRecordDelegate <T> transl, ICollectionGetter <RecordType>?triggeringRecord = null, RecordTypeConverter?recordTypeConverter = null) { var ret = new List <T>(); while (!frame.Complete) { var nextRecord = HeaderTranslation.GetNextRecordType(frame.Reader); nextRecord = recordTypeConverter.ConvertToStandard(nextRecord); if (!triggeringRecord?.Contains(nextRecord) ?? false) { break; } if (!IsLoqui) { frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; } var startingPos = frame.Position; if (transl(frame, nextRecord, out var subIitem, recordTypeConverter)) { ret.Add(subIitem); } if (frame.Position == startingPos) { throw new ArgumentException($"Parsed item on the list consumed no data: {subIitem}"); } } return(ret); }
public ExtendedList <T> Parse( MutagenFrame reader, BinaryMasterParseRecordDelegate <T> transl, ICollectionGetter <RecordType>?triggeringRecord = null, TypedParseParams?translationParams = null) { var ret = new ExtendedList <T>(); while (!reader.Complete) { var nextRecord = HeaderTranslation.GetNextRecordType(reader.Reader); nextRecord = translationParams.ConvertToStandard(nextRecord); if (!triggeringRecord?.Contains(nextRecord) ?? false) { break; } if (!IsLoqui) { reader.Position += reader.MetaData.Constants.SubConstants.HeaderLength; } var startingPos = reader.Position; if (transl(reader, nextRecord, out var subIitem, translationParams)) { ret.Add(subIitem); } if (reader.Position == startingPos) { throw new ArgumentException($"Parsed item on the list consumed no data: {subIitem}"); } } return(ret); }