/// <summary> /// Processes as many pending modifications as are available, removes existing indices if necessary and /// establishes the boundaries of the source log file. /// </summary> /// <param name="token"></param> /// <returns></returns> private bool ProcessModifications(CancellationToken token) { bool performedWork = false; while (_pendingModifications.TryDequeue(out var modification) && !token.IsCancellationRequested) { if (modification.IsReset()) { Clear(); _lastLogBuffer.Clear(); _currentSourceIndex = 0; } else if (modification.IsRemoved(out var removedSection)) { LogLineIndex startIndex = removedSection.Index; _fullSourceSection = new LogSourceSection(0, (int)startIndex); if (_currentSourceIndex > _fullSourceSection.LastIndex) { _currentSourceIndex = (int)removedSection.Index; } RemoveFrom(_currentSourceIndex); RemoveLinesFrom(_lastLogBuffer, _currentSourceIndex); } else if (modification.IsAppended(out var appendedSection)) { _fullSourceSection = LogSourceSection.MinimumBoundingLine(_fullSourceSection, appendedSection); } performedWork = true; } return(performedWork); }
/// <inheritdoc /> public void Dispose() { // https://github.com/Kittyfisto/Tailviewer/issues/282 _listeners.Clear(); _properties.Clear(); lock (_syncRoot) { _logBuffer.Clear(); } }
protected override void DisposeAdditional() { lock (_syncRoot) { _entries.Clear(); _localProperties.Clear(); _properties.Clear(); } base.DisposeAdditional(); }
protected override void OnResetSection() { lock (_syncRoot) { _buffer.Clear(); } }