private static async Task OnNewLineAsync(ReadOnlySequence <byte> line, ReadOnlySequence <byte> buffer, LinkedList <ReadOnlySequence <byte> > sectionLines, LogParseState state) { var currentProcessor = SectionParsers[state.Id]; if (line.AsString().Contains(currentProcessor.EndTrigger, StringComparison.InvariantCultureIgnoreCase)) { await FlushAllLinesAsync(buffer, sectionLines, state).ConfigureAwait(false); SectionParsers[state.Id].OnSectionEnd?.Invoke(state); state.Id++; return; } if (sectionLines.Count == 50) { await ProcessFirstLineInBufferAsync(buffer, sectionLines, state).ConfigureAwait(false); } sectionLines.AddLast(line); }
private static async Task OnNewLineAsync(ReadOnlySequence <byte> line, ReadOnlySequence <byte> buffer, LinkedList <ReadOnlySequence <byte> > sectionLines, LogParseState state) { var currentProcessor = SectionParsers[state.Id]; var strLine = line.AsString(); if (currentProcessor.EndTrigger.Any(et => strLine.Contains(et))) { await FlushAllLinesAsync(buffer, sectionLines, state).ConfigureAwait(false); await TaskScheduler.WaitForClearTagAsync(state).ConfigureAwait(false); SectionParsers[state.Id].OnSectionEnd?.Invoke(state); state.Id++; } if (sectionLines.Count == 50) { await ProcessFirstLineInBufferAsync(buffer, sectionLines, state).ConfigureAwait(false); } sectionLines.AddLast(line); }