【发布时间】:2019-11-13 21:45:06
【问题描述】:
如何获取 adb 的错误异常?
如果没有连接 adb 设备 richtextbox 没有连接任何设备并且不在 richtextbox 中写入任何内容,或者如果设备连接 richtextbox 写入读取数据正常,则显示有关命令的所有信息
这是我的代码:
// START READ INFO//
//MANFACTURE//
using (Process process = new Process())
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
FileName = "adb.exe",
Arguments = " shell getprop ro.product.manufacturer"
};
process.StartInfo = startInfo;
process.Start();
process.StartInfo.RedirectStandardError = true;
Sks.Text = process.StandardOutput.ReadToEnd();
string b = "MANUFACTURE :" + Sks.Text;
progressBar1.Value = 0;
progressBar1.Minimum = 0;
progressBar1.Maximum = 15;
progressBar1.Step = 1;
for (int i = 0; i < 100; i++)
{
progressBar1.PerformStep();
}
// SECURITY PATCH //
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.FileName = "adb.exe";
startInfo.Arguments = "shell getprop ro.build.version.security_patch";
process.StartInfo = startInfo;
process.Start();
Sks.Text = process.StandardOutput.ReadToEnd();
string E = Environment.NewLine + "SECURITY PATCH :" + Sks.Text;
string s = Sks.Text = b + E;
【问题讨论】:
标签: c# android shell exception adb