public override void Run(string param) { Process[] proc = GetPlayer(); if (proc.Length != 0) { string[] pos = param.Split('x'); if (pos.Length != 2) { Console.WriteLine("The click position should be 2-dimensional, separated with an \"x\"."); return; } if (int.TryParse(pos[0].Trim(), out int x) && int.TryParse(pos[1].Trim(), out int y)) { KeyPressTool.PressSystemKey(Keys.Alt, proc[0].MainWindowHandle); Thread.Sleep(100); ClickOnPointTool.ClickOnPoint(proc[0].MainWindowHandle, new Point(x, y)); } else { Console.WriteLine("The dimensions of the position were not valid integers."); } } else { Console.WriteLine("MPC-HC is not running."); } }
public override void Run(string key) { key = key.ToLower(); foreach (string target in Enum.GetNames(typeof(Keys))) { if (key.Equals(target.ToLower())) { KeyPressTool.PressKey((Keys)Enum.Parse(typeof(Keys), target)); return; } } Console.Write("The supplied key is not supported or isn't a valid key. The supported keys are: "); Console.WriteLine(string.Join(", ", Enum.GetNames(typeof(Keys)))); }