. NET develops a one-hop Helper Program, which is assisted by. net.
The source code has been packaged and downloaded in the running environment.
Function for executing the adb command
/// <Summary> /// execute the adb command /// </summary> /// <param name = "arguments"> </param> /// <param name = "ischeck"> </param> // <returns> </returns> private string javasadb (string arguments, bool ischeck = true) {if (ischeck &&! HasAndroid) {return string. empty;} string ret = string. empty; using (Process p = new Process () {p. startInfo. fileName = Program. adbPath; // @ "C: \ Android \ sdk \ platform-tools \ adb.exe"; p. startInfo. arguments = arguments; p. startInfo. useShellExecute = false; p. startInfo. redirectStandardInput = true; // redirect standard input p. startInfo. redirectStandardOutput = true; // redirect standard output p. startInfo. redirectStandardError = true; // redirect error output p. startInfo. createNoWindow = true; p. start (); ret = p. standardOutput. readToEnd (); p. close ();} return ret ;}
Image Click Event
/// <Summary> /// black bottom position /// </summary> Point Start; /// <summary> /// specifies the center or white Point of the image. /// </summary> Point End; private void picturebox#click (object sender, EventArgs e) {var me = (System. windows. forms. mouseEventArgs) (e); if (me. button = MouseButtons. left) // press the Left button to indicate the coordinates of the Black Bottom {Start = (System. windows. forms. mouseEventArgs) (e )). location;} else if (me. button = MouseButtons. right) // Right-click the coordinates at the bottom of the black circle {End = (System. windows. forms. mouseEventArgs) (e )). location; // calculate the distance between two points. double value = Math. sqrt (Math. abs (Start. x-End. x) * Math. abs (Start. x-End. x) + Math. abs (Start. y-End. y) * Math. abs (Start. y-End. y); Text = string. format ("distance between two points: {0}, press the time: {1}", value, (3.999022243950134 * value ). toString ("0"); // 3.999022243950134 this is the best time for me to get this resolution after I have simulated it for multiple times cmdAdb (string. format ("shell input swipe 100 100 200 200 {0}", (3.999022243950134 * value ). toString ("0 ")));}}
This article is based on the guidance of the China. NET Research Association
Http://www.cnblogs.com/dotnet-org-cn
Source Code address
Https://files.cnblogs.com/files/yangxu-tech/%E8%B7%B3%E4%B8%80%E8%B7%B3%E8%BE%85%E5%8A%A9%E7%A8%8B%E5%BA%8F.zip