/// <summary> /// Resets the rotor so that the given character is visible in the window. /// Does not raise the <see cref="HitNotch"/> event. /// </summary> /// <param name="window">The charcter desired to be in the window</param> public void Reset(char window) { var offset = Indexing.IndexOf(window); Indexing.Rotate(offset); Wiring.Rotate(offset); }
/// <summary> /// Rotates the wheel, forward or backwards. /// </summary> /// <param name="forward">If true, rotates the wheel counterclockwise</param> public void Rotate(bool forward = true) { int offset = forward ? 1 : -1; Indexing.Rotate(offset); Wiring.Rotate(offset); if (_raiseHitNotch) { HitNotch?.Invoke(this, forward); _raiseHitNotch = false; } else if (IsTurnOver()) { _raiseHitNotch = true; } }