private void FilterAllPending() { LogFileSection section; while (_pendingModifications.TryDequeue(out section)) { if (section.IsReset) { lock (_syncRoot) { _matches.Clear(); } _listeners.EmitSearchChanged(_matches); } else { AppendMatches(section); } } }
private void FilterAllPending() { while (_pendingModifications.TryDequeue(out var modification)) { if (modification.IsReset()) { lock (_syncRoot) { _matches.Clear(); } _listeners.EmitSearchChanged(_matches); } else if (modification.IsRemoved(out var removedSection)) { lock (_syncRoot) { int lastIndexInValidRange; for (lastIndexInValidRange = _matches.Count - 1; lastIndexInValidRange >= 0; --lastIndexInValidRange) { if (_matches[lastIndexInValidRange].Index < removedSection.Index) { break; } } if (lastIndexInValidRange < _matches.Count) { _matches.RemoveRange(lastIndexInValidRange + 1, _matches.Count - lastIndexInValidRange - 1); } } _listeners.EmitSearchChanged(_matches); } else if (modification.IsAppended(out var appendedSection)) { AppendMatches(appendedSection); } } }