public override void Read(ReadArgs args) { args.SetValues(); args.CurrentSeqNo = ExpectNextSeqNo(args); int readChar = args.ReadOne(); if (readChar == iRefPrefix) { args.State = ReaderInstance.Singleton; } else if (readChar == iArray) { readChar = args.ReadOne(); if (readChar != iFieldSep) { throw Error.Unexpected(ErrorCode.UnexpectedChars, FieldSeparator, readChar); } ArrayRecord rec = new ArrayRecord(args.CurrentSeqNo); args.SetupRecord(rec); args.Read.Read(rec); args.State = ReaderField.Singleton; } else if (readChar == iStringEncl) { args.State = ReaderTypeDef.Singleton; } else { throw new Error(ErrorCode.UnknownRecordType).AddData(ErrorDataKeys.Actual, readChar); } }
public void Read(StreamReader sr, IRead callback) { ReadArgs args = new ReadArgs(sr, callback); do { args.State.Read(args); } while (args.State != ReaderEnd.Singleton); args.SetValues(); }