private void Validate(ref LineViewSnapshot snapshot, string paramName) { if (_options.SnapshotsComparer.Equals(snapshot, default(LineViewSnapshot))) { throw new ArgumentNullException(nameof(paramName)); } }
public bool TryRedo(LineViewSnapshot currentSnapshot, out LineViewSnapshot nextSnapshot) { Validate(ref currentSnapshot, nameof(currentSnapshot)); TryAddSnapshotInternal(ref currentSnapshot); if (_iterator.MoveToNext()) { nextSnapshot = _iterator.Current; return(true); } nextSnapshot = default(LineViewSnapshot); return(false); }
public bool TryUndo(LineViewSnapshot currentSnapshot, out LineViewSnapshot prevSnapshot) { Validate(ref currentSnapshot, nameof(currentSnapshot)); TryAddSnapshotInternal(ref currentSnapshot); if (_iterator.MoveToPrev()) { prevSnapshot = _iterator.Current; return(true); } prevSnapshot = default(LineViewSnapshot); return(false); }
private bool TryAddSnapshotInternal(ref LineViewSnapshot snapshot) { if (EqualsToCurrentSnapshot(ref snapshot)) { return(false); } if (_iterator.HasNext()) { _snapshots.TrimTo(_iterator.Index + 1); } _snapshots.Add(snapshot); _iterator.MoveToLast(); return(true); }
private bool EqualsToCurrentSnapshot(ref LineViewSnapshot snapshot) { return(_snapshots.Count > 0 && _options.SnapshotsComparer.Equals(snapshot, _iterator.Current)); }
public bool TryAddSnapshot(LineViewSnapshot snapshot) { Validate(ref snapshot, nameof(snapshot)); return(TryAddSnapshotInternal(ref snapshot)); }