/// <summary> /// 检测是否存在手机 /// </summary> private void CheckHasAndroidModel() { ADB.DetectAndriod(); //获取手机型号 if (ADB.CmdStatus == OutputStatus.Success) { string Phone = ADB.OutputData; if (Phone.Contains("no devices") || string.IsNullOrWhiteSpace(Phone)) { HasAndroid = false; toolStripStatusLabel2.Text = "未检测到设备"; Invoke(new MethodInvoker(delegate() { { if (rtbCmd != null) { rtbCmd.AppendText("Detect Andriod device failed!\r\n1、请在cmd运行adb shell getprop ro.product.model 检测手机USB调试模式是否正常!\r\n2、请在cmd运行adb shell screencap -p 查看是否有返回数据。\r\n\r\n"); rtbCmd.ScrollToCaret(); } } })); } else { DetectVer(); if (AndriodReleaseVer.StartsWith("4.0")) { cbxRotate180.Checked = true; } DetectSize(); if (ResolutionX == 0 || ResolutionY == 0) { toolStripStatusLabel2.Text = Phone.Trim() + "(检测手机屏幕分辨率失败)"; } else { HasAndroid = true; string msg = Phone.Trim() + " Ver:" + AndriodReleaseVer + "(" + ResolutionX.ToString() + "x" + ResolutionY.ToString() + "), screen scale: " + ResolutionXScale.ToString() + "x" + ResolutionYScale.ToString(); toolStripStatusLabel2.Text = msg.Replace("\r", ""); rtbCmd.AppendText("Detect Andriod device success.\r\n\r\n***** Start capture Andriod Screen *****\r\n\r\n"); rtbCmd.ScrollToCaret(); CaptureTimer.Start(); } } } else { toolStripStatusLabel2.Text = "cmd error: " + ADB.OutputError; } }
/// <summary> /// 检测是否存在手机 /// </summary> private void CheckHasAndroidModel() { ADB.DetectAndriod(); //获取手机型号 if (ADB.CmdStatus == OutputStatus.Success) { string text = ADB.OutputData; if (text.Contains("no devices") || string.IsNullOrWhiteSpace(text)) { HasAndroid = false; toolStripStatusLabel2.Text = "未检测到设备"; Invoke(new MethodInvoker(delegate() { { if (rtbCmd != null) { rtbCmd.AppendText("Detect Andriod device failed!\r\n1、请在cmd运行adb shell getprop ro.product.model 检测手机USB调试模式是否正常!\r\n2、请在cmd运行adb shell screencap -p 查看是否返回数据。\r\n\r\n"); rtbCmd.ScrollToCaret(); } } })); } else { DetectSize(); if (ResolutionX == 0) { toolStripStatusLabel2.Text = text.Trim() + "(检测Physical size失败)"; } else { HasAndroid = true; toolStripStatusLabel2.Text = text.Trim() + "(" + ResolutionX.ToString() + "x" + ResolutionY.ToString() + ")" + " ," + ResolutionXScale.ToString() + "x" + ResolutionYScale.ToString() + ""; rtbCmd.AppendText("Detect Andriod device success.\r\n\r\n***** Start capture Andriod Screen *****\r\n\r\n"); rtbCmd.ScrollToCaret(); CaptureTimer.Start(); } } } else { toolStripStatusLabel2.Text = "cmd error: " + ADB.OutputError; } }