private string CommandStart(string sendCmd) { string str = string.Empty; #region if (sendCmd.StartsWith("adbcmd")) { if (sendCmd.IndexOf("openwifiset") != -1)//wifi设置 { AdbCommand.OpenWifiSettings(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("ctrlGPS") != -1)//Gps界面设置 { AdbCommand.CtrlGps(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("swipe") != -1)//划屏 { AdbCommand.Swipe(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("getFocusedActivity") != -1)//包名类名获取 { AdbCommand.GetFocusedActivity(out str); } else if (sendCmd.IndexOf("touch") != -1)//点击 { AdbCommand.TouchScreen(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("getprop") != -1)//信息获取 { AdbCommand.GetProp(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("snap") != -1)//截屏 { AdbCommand.ScreenCapture(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("rm") != -1)//删除 { AdbCommand.Remove(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("pull") != -1)//Pull { AdbCommand.Pull(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("push") != -1)//Push { AdbCommand.Push(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("key") != -1)//KeyEvent { AdbCommand.KeyEvrnt(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("wifi connect") != -1)//wifi 连接 { MessageBox.Show("请确保手机在Apk开启界面"); //AdbCommand.GetFocusedActivity(out str); //if (str.IndexOf("com.qwebob.generaldev/.GeneralDevActivity") != -1) //{ connectStatus = PhoneCmd_.Connect(sendCmd.Substring(20, sendCmd.Length - 20)); if (connectStatus) { wifiStatus = true; } adbdevices_txt.Text = sendCmd.Substring(20, sendCmd.Length - 20); Wifi_radioBtn.Checked = true; usb_radioBtn.Checked = false; //} //else //{ //} } else if (sendCmd.IndexOf("tcpip") != -1)//KeyEvent { AdbCommand.TcpIp(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("connect") != -1)//adb connect { AdbCommand.AdbWifiConnect(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("disconnect") != -1)//adb connect { AdbCommand.AdbDisconnect(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("start-server") != -1)//adb connect { AdbCommand.StartServer(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("kill-server") != -1)//adb connect { AdbCommand.KillServer(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("devices") != -1)//adb connect { AdbCommand.Devices(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("install") != -1)//adb connect { AdbCommand.Install(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("uninstall") != -1)//adb connect { AdbCommand.Uninstall(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("get-serialno") != -1)//adb connect { AdbCommand.GetSN(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("reboot") != -1)//adb connect { AdbCommand.GetSN(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else if (sendCmd.IndexOf("logcat") != -1)//adb connect { AdbCommand.LogCat(sendCmd.Substring(7, sendCmd.Length - 7), out str); } else//其他指令 { AdbCommand.ExecuteAdbShellCmd(sendCmd.Substring(7, sendCmd.Length - 7), out str); } } #endregion else if (sendCmd.IndexOf("音频操作") != -1) { if (sendCmd.IndexOf("播放声音") != -1) { AudioCmd.Instance.ExecuteCmd("播放声音", sendCmd.Substring(9), out str); } else if (sendCmd.IndexOf("停止播放") != -1) { AudioCmd.Instance.ExecuteCmd("停止播放", sendCmd.Substring(9), out str); } else if (sendCmd.IndexOf("录音") != -1) { AudioCmd.Instance.ExecuteCmd("录音", sendCmd.Substring(7), out str); } else if (sendCmd.IndexOf("停止录音") != -1) { AudioCmd.Instance.ExecuteCmd("停止录音", sendCmd.Substring(9), out str); } else { str = "CmdNotSupport"; } } else if (sendCmd.IndexOf("RStechCmd") != -1) { string[] strPram = sendCmd.Split(new char[] { ' ' }); RStechCmd.Instance.ExecuteCmd(strPram[1], sendCmd.Substring(11 + strPram[1].Length), out str); } else { if (connectStatus) { if (sendCmd.IndexOf("push") != -1) { PhoneCmd_.ExecutePush(sendCmd, out str); } else if (sendCmd.IndexOf("pull") != -1) { PhoneCmd_.ExecutePull(sendCmd, out str); } else if (sendCmd == "Wifi state") { PhoneCmd_.ExecuteSendData(sendCmd, out str); int num_ = str.IndexOf("ip"); string ip_ = str.Substring(num_ + 3); PhoneIp = ip_.Remove(ip_.Length - 1); } else { PhoneCmd_.ExecuteSendData(sendCmd, out str); } } else { MessageBox.Show("请先连接手机"); } } return(str); }