/// <summary> /// 按键 /// </summary> /// <param name="enumKeyboardKey"></param> private void keyoption(OptionKeys enumKeyboardKey) { if (ScreenMode == ScreenMode.Desktop) { WindowsAPI.KeyDown(enumKeyboardKey.Key); Thread.Sleep(100); WindowsAPI.KeyUp(enumKeyboardKey.Key); } else if (ScreenMode == ScreenMode.Window || ScreenMode == ScreenMode.Vriual) { string s = ""; if (enumKeyboardKey.IsDrag) { s = "shell input swipe " + (enumKeyboardKey.Position.X + Random.Next(-5, 5)).ToString() + " " + (enumKeyboardKey.Position.Y + Random.Next(-5, 5)).ToString() + " " + (enumKeyboardKey.EndPosition.X + Random.Next(-5, 5)).ToString() + " " + (enumKeyboardKey.EndPosition.Y + Random.Next(-5, 5)).ToString() + " 600"; } else { s = "shell input tap " + (enumKeyboardKey.Position.X + Random.Next(-5, 5)) + " " + (enumKeyboardKey.Position.Y + Random.Next(-5, 5)); //Write(s); } startADBEXE(s); } Thread.Sleep(Random.Next(200, 4000)); //Write("按下了 : " + enumKeyboardKey); }
/// <summary> /// 按键 /// </summary> /// <param name="enumKeyboardKey"></param> private void keyoption(OptionKeys enumKeyboardKey) { //if (Config.ScreenMode == ScreenMode.Desktop) //{ // WindowsAPI.KeyDown(enumKeyboardKey.Key); // Thread.Sleep(300); // WindowsAPI.KeyUp(enumKeyboardKey.Key); // Write("按下:" + enumKeyboardKey.Key.ToString()); //} //else if (Config.ScreenMode == ScreenMode.Window || Config.ScreenMode == ScreenMode.Vriual) //{ string s = ""; if (enumKeyboardKey.IsDrag) { s = "shell input swipe " + (enumKeyboardKey.Position.X + Random.Next(-5, 5)).ToString() + " " + (enumKeyboardKey.Position.Y + Random.Next(-5, 5)).ToString() + " " + (enumKeyboardKey.EndPosition.X + Random.Next(-5, 5)).ToString() + " " + (enumKeyboardKey.EndPosition.Y + Random.Next(-5, 5)).ToString() + " 600"; } else { s = "shell input tap " + (enumKeyboardKey.Position.X + Random.Next(-5, 5)) + " " + (enumKeyboardKey.Position.Y + Random.Next(-5, 5)); //Write(s); } Martian.startADBEXE(s, Config.VriualExePath); //} Thread.Sleep(Random.Next(Config.KeyPressWaitMinTime, Config.KeyPressWaitMaxTime)); //Write("按下了 : " + enumKeyboardKey); }