Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 public void Reset()
 {
     lock (_syncRoot)
     {
         _storage.SetToDefault();
     }
 }
        private bool Process(IReadOnlyList <LogSourceModification> pendingModifications)
        {
            if (pendingModifications.Count == 0)
            {
                return(false);
            }

            foreach (var modification in pendingModifications)
            {
                if (modification.IsReset())
                {
                    _count = 0;
                    Listeners.Reset();
                    _propertiesBuffer.SetToDefault(_adornedProperties);
                    SynchronizeProperties();
                }
                else if (modification.IsRemoved(out var removedSection))
                {
                    _count = (int)removedSection.Index;
                    SynchronizeProperties();
                    Listeners.Remove((int)removedSection.Index, removedSection.Count);
                }
                else if (modification.IsAppended(out var appendedSection))
                {
                    Process(appendedSection);
                    _count += appendedSection.Count;
                    SynchronizeProperties();
                    Listeners.OnRead(_count);
                }
            }

            return(true);
        }