public static void Uninstall(string param, out string retValue)
        {
            string text;

            AdbCommand.ExecuteAdbCommand(param, out text);
            retValue = text + "\r\n                Res=Pass";
        }
        /// <summary>
        /// keyevent
        /// adb shell input keyevent KeyCode_Home
        /// </summary>
        /// <param name="param"></param>
        /// <param name="retValue"></param>
        public static void KeyEvrnt(string param, out string retValue)
        {
            string keyEventFile = System.Environment.CurrentDirectory + "\\KeyEvent.ini";

            string[] str_key = IniUnit.INIOperationClass.INIGetAllItems(keyEventFile, "Key");
            string   val     = string.Empty;

            if (param.IndexOf("key") != -1)
            {
                foreach (var item in str_key)
                {
                    if (item.IndexOf("Key_Back") != -1 && param.IndexOf("Back") != -1)
                    {
                        val = item.Substring(item.IndexOf("=") + 1);
                        break;
                    }
                    else if (item.IndexOf("Key_Home") != -1 && param.IndexOf("Home") != -1)
                    {
                        val = item.Substring(item.IndexOf("=") + 1);
                        break;
                    }
                    else if (item.IndexOf("Key_Menu") != -1 && param.IndexOf("Menu") != -1)
                    {
                        val = item.Substring(item.IndexOf("=") + 1);
                        break;
                    }
                }
            }
            AdbCommand.ExecuteAdbCommand("shell input keyevent " + val, out retValue);
            retValue = "Res=Pass";
        }
        public static void AdbWifiConnect(string param, out string retValue)
        {
            string text;

            AdbCommand.ExecuteAdbCommand(param, out text);
            retValue = text + "\r\n                Res=Pass";
        }
        public static void Reboot(string param, out string retValue)//返回设备序列号SN值
        {
            string text;

            AdbCommand.ExecuteAdbCommand(param, out text);
            retValue = text + "\r\n                Res=Pass";
        }
        /// <summary>
        /// 卸载Apk
        /// </summary>
        /// <param name="packageName"></param>
        /// <returns></returns>
        public static bool UninstallApk(string packageName)
        {
            string param = "uninstall " + packageName;
            string text;

            return(AdbCommand.ExecuteAdbCommand(param, out text));
        }
        public static void ExecuteAdbShellCmd(string param, out string retValue)
        {
            string text;

            AdbCommand.ExecuteAdbCommand("shell " + param, out text);
            retValue = text + "\r\n                Res=Pass";
        }
        public bool Connect()
        {
            string text;

            AdbCommand.ExecuteAdbCommand("forward tcp:6666 tcp:6666", out text);
            return(this.Connect("127.0.0.1"));
        }
        /// <summary>
        /// 截屏
        /// </summary>
        /// <param name="param"></param>
        /// <param name="retValue"></param>
        public static void ScreenCapture(string param, out string retValue)
        {
            string str = param.Substring("snap".Length + 1);
            string text;

            AdbCommand.ExecuteAdbCommand("shell screencap " + str, out text);
            retValue = text + "\r\n                Res=Pass";
        }
        /// <summary>
        /// 点击
        /// </summary>
        /// <param name="param"></param>
        /// <param name="retValue"></param>
        public static void TouchScreen(string param, out string retValue)
        {
            string str = param.Substring("touch".Length + 1);
            string text;

            AdbCommand.ExecuteAdbCommand("shell input tap " + str, out text);
            retValue = "Res=Pass";
        }
        /// <summary>
        /// 划屏幕指令
        /// </summary>
        /// <param name="param"></param>
        /// <param name="retValue"></param>
        public static void Swipe(string param, out string retValue)
        {
            string str = param.Substring("swipe".Length + 1);
            string text;

            AdbCommand.ExecuteAdbCommand("shell input swipe " + str, out text);
            retValue = "Res=Pass";
        }
        public static void Remove(string param, out string retValue)
        {
            string str = param.Substring("rm".Length + 1);
            string text;

            AdbCommand.ExecuteAdbCommand("shell rm " + str, out text);
            retValue = text + "\r\n                Res=Pass";
        }
        public static void Pull(string param, out string retValue)
        {
            string str = param.Substring("pull".Length);
            string text;

            AdbCommand.ExecuteAdbCommand("pull" + str, out text);
            retValue = text + "\r\n                Res=Pass";
        }
        public static void LogCat(string param, out string retValue)//返回设备序列号SN值
        {
            //-v time qwebob >D:\logfile.txt
            string text;//+ @" -v time qwebob >D:\logfile.txt"

            AdbCommand.ExecuteAdbCommand(param, out text);
            retValue = text + "\r\n                Res=Pass";
        }
        /// <summary>
        /// apk 安装
        /// </summary>
        /// <param name="apkPath"></param>
        /// <returns></returns>
        public static bool InstallApk(string apkPath)
        {
            string param = "install -r " + apkPath;
            string text;
            bool   flag = AdbCommand.ExecuteAdbCommand(param, 20000, out text);

            Log.Debug("install " + apkPath + " return " + text);
            return(flag && text.Contains("Success"));
        }
 public ApkFile_Transfer(string ip)
 {
     this.ip_   = ip;
     this.port_ = 6661;
     if (ip == "127.0.0.1")
     {
         string text;
         AdbCommand.ExecuteAdbCommand("forward tcp:6661 tcp:6661", out text);
     }
 }
        /// <summary>
        /// 打开Wifi设置界面
        /// </summary>
        /// <param name="param"></param>
        /// <param name="retValue"></param>
        public static void OpenWifiSettings(string param, out string retValue)
        {
            string text;

            AdbCommand.ExecuteAdbCommand("shell am start -a android.settings.WIFI_SETTINGS", out text);
            string str    = param.Substring("openwifiset".Length + 1);
            string param2 = "shell input tap " + str;

            AdbCommand.ExecuteAdbCommand(param2);
            retValue = "Res=Pass";
        }
        /// <summary>
        /// Gps设置界面
        /// </summary>
        /// <param name="param"></param>
        /// <param name="retValue"></param>
        public static void CtrlGps(string param, out string retValue)
        {
            string text;

            AdbCommand.ExecuteAdbCommand("shell am start -a android.settings.LOCATION_SOURCE_SETTINGS", out text);
            string str    = param.Substring("ctrlGPS".Length + 1);
            string param2 = "shell input tap " + str;

            AdbCommand.ExecuteAdbCommand(param2);
            retValue = "Res=Pass";
        }
        /// <summary>
        /// SIM卡(adbcmd getval SIM1_prop_0=gsm.sim.state)
        /// </summary>
        /// <param name="name"></param>
        /// <param name="start"></param>
        /// <param name="length"></param>
        /// <param name="retValue"></param>
        public static void GetProp(string name, int start, int length, out string retValue)
        {
            string text;

            AdbCommand.ExecuteAdbCommand("shell getprop " + name, out text);
            if (start >= text.Length)
            {
                retValue = "Res=ArgumentException";
                return;
            }
            length   = Math.Min(length, text.Length - start);
            retValue = "Res=" + text.Substring(start, length);
        }
        /// <summary>
        ///安装并启动
        /// </summary>
        /// <returns></returns>
        public static bool InstallApkAndStart()
        {
            //string text = "GeneralDev.apk";
            //if (!AdbCommand.InstallApk(text))
            //{
            //    return false;
            //}
            string text2;

            AdbCommand.ExecuteAdbCommand("shell am start -n com.qwebob.generaldev/.GeneralDevActivity", out text2);
            if (text2.Contains("error") || text2.Contains("Error"))
            {
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// 包名和类名获取
        /// </summary>
        /// <param name="retValue"></param>
        public static void GetFocusedActivity(out string retValue)
        {
            string text;

            AdbCommand.ExecuteAdbCommand("shell dumpsys activity | grep mResumedActivity", out text);
            int num = text.IndexOf("/.");

            if (num != -1)
            {
                string text2 = text.Substring(0, num);
                string text3 = text.Substring(num);
                int    num2  = text2.LastIndexOf(' ') + 1;
                int    num3  = text3.IndexOf(' ') + num;
                retValue = "Res=" + text.Substring(num2, num3 - num2);
                return;
            }
            retValue = "Res=ActivityNotFound";
        }