private void restoreStateTo(double time) { states.RemoveAll(state => state.Time > time); currentState = states.LastOrDefault(); CountPresses = currentState?.Count ?? 0; }
private void saveState() { if (currentState == null || currentState.Time < Clock.CurrentTime) { states.Add(currentState = new KeyCounterState(Clock.CurrentTime, CountPresses)); } }