示例#1
0
        public void OnLogFileModified(ILogSource logSource, LogSourceModification modification)
        {
            lock (_pendingSections)
            {
                if (modification.IsReset())
                {
                    _pendingSections.Clear();
                }

                _pendingSections.Add(new KeyValuePair <ILogSource, LogSourceModification>(_logSource, modification));
            }
        }
 public void OnLogFileModified(ILogSource logSource, LogSourceModification modification)
 {
     lock (_syncRoot)
     {
         if (modification.IsReset())
         {
             _buffer.Clear();
         }
         else if (modification.IsRemoved(out var removedSection))
         {
             _buffer.ResizeTo((int)removedSection.Index);
         }
         else if (modification.IsAppended(out var appendedSection))
         {
             _buffer.ResizeTo((int)(appendedSection.Index + appendedSection.Count));
         }
     }
 }
示例#3
0
        public void OnLogFileModified(ILogSource logSource, LogSourceModification modification)
        {
            lock (_syncRoot)
            {
                if (!_dataSourcesByLogFile.ContainsKey(logSource))
                {
                    return;
                }

                if (!modification.IsReset())
                {
                    return;
                }

                var toRemove = _bookmarks.Keys.Where(x => x.DataSource.UnfilteredLogSource == logSource).ToList();
                Remove(toRemove);
                Update();
            }
        }
 private void Update(ILogSource logSource, LogSourceModification modification)
 {
     try
     {
         if (modification.IsReset())
         {
             Clear(logSource);
         }
         else if (modification.IsRemoved(out var removedSection))
         {
             Remove(logSource, removedSection.Index);
         }
         else if (modification.IsAppended(out var appendedSection))
         {
             Add(logSource, appendedSection);
         }
     }
     catch (Exception e)
     {
         Log.ErrorFormat("Caught unexpected exception: {0}", e);
     }
 }