public virtual TPackageInfo Filter(ref SequenceReader <byte> reader) { var package = _currentPackage; if (package == null) { package = _currentPackage = CreatePackage(); _currentPartReader = GetFirstPartReader(); } while (true) { if (_currentPartReader.Process(package, ref reader, out IPackagePartReader <TPackageInfo> nextPartReader, out bool needMoreData)) { Reset(); return(package); } if (nextPartReader != null) { _currentPartReader = nextPartReader; } if (needMoreData || reader.Remaining <= 0) { return(null); } } }
public QueryResult Filter(ref SequenceReader <byte> reader) { var package = _currentPackage; if (package == null) { package = _currentPackage = new QueryResult(); _currentPartReader = PackagePartReader.PackagePartReader.NewReader; } while (true) { if (_currentPartReader.Process(package, ref reader, out IPackagePartReader nextPartReader, out bool needMoreData)) { Reset(); return(package); } if (nextPartReader != null) { _currentPartReader = nextPartReader; } if (needMoreData || reader.Remaining <= 0) { return(null); } } }