private void Clear() { Listeners.Reset(); lock (_syncRoot) { _lines.Clear(); } }
private void Reset() { _count = 0; try { OnResetSection(); } catch (Exception e) { Log.WarnFormat("Caught unexpected exception: {0}", e); } SynchronizeProperties(); Listeners.Reset(); }
private void OnReset(FileStream stream, out int numberOfLinesRead, out long lastPosition) { lastPosition = 0; if (stream != null) { stream.Position = 0; } numberOfLinesRead = 0; _entries.Clear(); SynchronizePropertiesWithUser(); Listeners.Reset(); }
private void OnReset(FileStream stream, out int numberOfLinesRead, out long lastPosition) { lastPosition = 0; if (stream != null) { stream.Position = 0; } numberOfLinesRead = 0; _properties.SetValue(LogFileProperties.StartTimestamp, null); _properties.SetValue(LogFileProperties.EndTimestamp, null); _maxCharactersPerLine = 0; _entries.Clear(); Listeners.Reset(); }
private void NotifyListeners(IEnumerable <LogFileSection> changes) { foreach (var section in changes) { if (section.IsInvalidate) { Listeners.Invalidate((int)section.Index, section.Count); } else if (section.IsReset) { Listeners.Reset(); } else { Listeners.OnRead((int)(section.Index + section.Count)); } } }
private void NotifyListeners(IEnumerable <LogSourceModification> changes) { foreach (var section in changes) { if (section.IsRemoved(out var removedSection)) { Listeners.Remove((int)removedSection.Index, removedSection.Count); } else if (section.IsReset()) { Listeners.Reset(); } else if (section.IsAppended(out var appendedSection)) { Listeners.OnRead((int)(appendedSection.Index + appendedSection.Count)); } } }
private void ProcessPendingSections(out bool workDone) { workDone = false; while (_pendingSections.TryDequeue(out var pair)) { // We may still have pending sections from a log file we've just removed as listener. // If that's the case, then throw away that section and go look for the next... if (!Equals(pair.Key, _finalLogSource)) { continue; } var modification = pair.Value; if (modification.IsReset()) { Listeners.Reset(); _count = 0; _maxCharactersInLine = 0; } else if (modification.IsRemoved(out var removedSection)) { Listeners.Remove((int)removedSection.Index, removedSection.Count); _count = (int)removedSection.Index; // TODO: What about max width? } else if (modification.IsAppended(out var appendedSection)) { Listeners.OnRead(appendedSection.LastIndex); _count = (int)(appendedSection.Index + appendedSection.Count); UpdateMaxWidth(appendedSection, pair.Key); } workDone = true; } if (!workDone) { Listeners.OnRead(_count); } }
private void Clear(ILogFile logFile) { var numRemoved = 0; lock (_syncRoot) { for (var i = _indices.Count - 1; i >= 0; --i) { var index = _indices[i]; var indexLogFile = _sources[index.LogFileIndex]; if (indexLogFile == logFile) { _indices.RemoveAt(i); ++numRemoved; } } } if (numRemoved > 0) { Listeners.Reset(); Listeners.OnRead(_indices.Count); } }