public extern static bool GetCursorPos(out MousePositions lpPoint);
public void UpdateState(MousePositions mousePosition) { var now = DateTime.Now.Ticks; switch (this.State) { case States.Unknown: if (mousePosition == MousePositions.Outside) { this.State = States.Outside1; this.Ticks = now; } break; case States.Outside1: if (mousePosition == MousePositions.Left) { this.State = States.InsideLeft1; this.Ticks = now; } else if (mousePosition == MousePositions.Right) { this.State = States.InsideRight1; this.Ticks = now; } break; case States.InsideLeft1: if (mousePosition == MousePositions.Outside) { this.State = States.OutsideLeft2; this.Ticks = now; } else if (mousePosition == MousePositions.Right) { this.State = States.Unknown; this.Ticks = now; } break; case States.InsideRight1: if (mousePosition == MousePositions.Outside) { this.State = States.OutsideRight2; this.Ticks = now; } else if (mousePosition == MousePositions.Left) { this.State = States.Unknown; this.Ticks = now; } break; case States.OutsideLeft2: if (mousePosition == MousePositions.Left) { this.State = States.InsideLeft2; this.Ticks = now; } else if (mousePosition == MousePositions.Right) { this.State = States.InsideRight1; this.Ticks = now; } break; case States.OutsideRight2: if (mousePosition == MousePositions.Left) { this.State = States.InsideLeft1; this.Ticks = now; } else if (mousePosition == MousePositions.Right) { this.State = States.InsideRight2; this.Ticks = now; } break; case States.InsideLeft2: // Allow the timer to resolve the state (Knock Left) break; case States.InsideRight2: // Allow the timer to resolve the state (Knock Right) break; default: // Allow the timer to resolve the state (reset to Unknown) break; } }