private static void moveTo(Point p, MouseSpeed speed) { List <Point> wayPoints = new List <Point>(); switch (speed) { case MouseSpeed.Instant: MouseSimulater.moveTo(p); return; default: getWayPoints(Cursor.Position, p, ref wayPoints, (int)speed); foreach (Point waypoint in wayPoints) { MouseSimulater.moveTo(waypoint); Thread.Sleep(5); } return; } }
public InternalNodeSettings(System.Windows.Forms.CheckState enabled, PriorityLevel priority, Int32 repeat, Int32 offsetX, Int32 offsetY, MouseSpeed mouseSpeed) { _enabled = enabled; _priority = priority; _runs = repeat; _offsetX = offsetX; _offsetY = offsetY; _mouseSpeed = mouseSpeed; }
static public void MoveTo(Point p, MouseSpeed speed) { switch (speed) { case MouseSpeed.Instant: MouseSimulater.MoveTo(p); break; default: MouseSimulater.moveTo(p, speed); break; } }
static public void MoveTo(int x, int y, MouseSpeed speed) { MouseSimulater.MoveTo(new Point(x, y), speed); }
internal void ReadFromXml(XmlDocument doc, XmlElement rootElem) { bool elemExists = false; XmlElement elem = FindXmlElem(doc, rootElem, PixelSizeName); switch (elem.InnerText) { case Force8BitName: PixelSize = PixelSize.Force8Bit; break; case Force16BitName: PixelSize = PixelSize.Force16Bit; break; case UnspecName: PixelSize = PixelSize.Unspec; break; default: throw new FormatException("PixelSize is invalid."); } elem = FindXmlElem(doc, rootElem, IsFullScrnName); IsFullScrn = Boolean.Parse(elem.InnerText); elem = FindXmlElem(doc, rootElem, OrientationName); switch (elem.InnerText) { case PortraitName: Orientation = Orientation.Portrait; break; case Portrait180Name: Orientation = Orientation.Portrait180; break; case Landscape90Name: Orientation = Orientation.Landscape90; break; case Landscape270Name: Orientation = Orientation.Landscape270; break; default: throw new FormatException("Orientation is invalid."); } try { elem = FindXmlElem(doc, rootElem, CliScalingName); elemExists = true; } catch (FormatException) { elemExists = false; } if (elemExists) { switch (elem.InnerText) { case NoneName: CliScaling = CliScaling.None; break; case OneHalfName: CliScaling = CliScaling.OneHalf; break; case OneThirdName: CliScaling = CliScaling.OneThird; break; case OneFourthName: CliScaling = CliScaling.OneFourth; break; case OneFifthName: CliScaling = CliScaling.OneFifth; break; case DoubleName: CliScaling = CliScaling.Double; break; case AutoName: CliScaling = CliScaling.Auto; break; case CustomName: CliScaling = CliScaling.Custom; break; default: throw new FormatException("Client-side scaling setting is invalid."); } try { CliScalingWidth = UInt16.Parse(elem.GetAttribute(WidthName)); CliScalingHeight = UInt16.Parse(elem.GetAttribute(HeightName)); } catch (ArgumentNullException) { throw new FormatException("Client-side scaling setting is invalid."); } catch (OverflowException) { throw new FormatException("Client-side scaling setting is invalid."); } catch (FormatException) { throw new FormatException("Client-side scaling setting is invalid."); } } else { CliScaling = CliScaling.None; CliScalingWidth = 0; CliScalingHeight = 0; } try { elem = FindXmlElem(doc, rootElem, ServScalingName); elemExists = true; } catch (FormatException) { elemExists = false; } if (elemExists) { switch (elem.InnerText) { case DefaultName: ServScaling = ServScaling.Default; break; case NoneName: ServScaling = ServScaling.None; break; case OneHalfName: ServScaling = ServScaling.OneHalf; break; case OneThirdName: ServScaling = ServScaling.OneThird; break; case OneFourthName: ServScaling = ServScaling.OneFourth; break; case OneFifthName: ServScaling = ServScaling.OneFifth; break; case OneSixthName: ServScaling = ServScaling.OneSixth; break; case OneSeventhName: ServScaling = ServScaling.OneSeventh; break; case OneEighthName: ServScaling = ServScaling.OneEighth; break; case OneNinthName: ServScaling = ServScaling.OneNinth; break; default: throw new FormatException("Server-side scaling setting is invalid."); } } else { ServScaling = ServScaling.Default; } elem = FindXmlElem(doc, rootElem, ViewOnlyName); ViewOnly = Boolean.Parse(elem.InnerText); elem = FindXmlElem(doc, rootElem, ShareServName); ShareServ = Boolean.Parse(elem.InnerText); try { elem = FindXmlElem(doc, rootElem, ScrnUpdAlgoName); elemExists = true; } catch (FormatException) { elemExists = false; } if (elemExists) { switch (elem.InnerText) { case AsapName: ScrnUpdAlgo = ScrnUpdAlgo.Asap; break; case BatchName: ScrnUpdAlgo = ScrnUpdAlgo.Batch; break; default: throw new FormatException("Screen update setting is invalid."); } } else { ScrnUpdAlgo = ScrnUpdAlgo.Batch; } try { elem = FindXmlElem(doc, rootElem, SendMouseLocWhenIdleName); elemExists = true; } catch (FormatException) { elemExists = false; } SendMouseLocWhenIdle = elemExists? Boolean.Parse(elem.InnerText) : false; try { elem = FindXmlElem(doc, rootElem, MouseAccelModeName); elemExists = true; } catch (FormatException) { elemExists = false; } if (elemExists) { MouseAccelMode = Boolean.Parse(elem.InnerText); try { switch (elem.GetAttribute(MouseSpeedName)) { case LowName: MouseSpeed = MouseSpeed.Low; break; case NormalName: MouseSpeed = MouseSpeed.Normal; break; case HighName: MouseSpeed = MouseSpeed.High; break; default: throw new FormatException(); } } catch (ArgumentNullException) { throw new FormatException("Mouse speed setting is invalid."); } catch (OverflowException) { throw new FormatException("Mouse speed scaling setting is invalid."); } catch (FormatException) { throw new FormatException("Mouse speed scaling setting is invalid."); } } else { MouseAccelMode = true; MouseSpeed = MouseSpeed.Normal; } }