標籤:android style blog http color ar os sp for
有時候會發現給手機燒入的資訊裡少了某一些檔案,比如一個表徵圖,或者一個mp3檔案之類的等等,為此做了一個小工具檢查指定手機裡面是否包含相應的檔案。
通過程式執行手機的命令來操作手機,感覺還挺有意思的。
static void Main(string[] args) { string result = ""; string error = ""; string str = ""; do { Console.WriteLine("請通過資料線串連手機..."); string cmd = "adb wait-for-devices"; ProcessExcuter.Run(Global.Adb.ToString(), cmd, 10000, out result, out error); bool isOk = false; isOk = Comm.WaitForDevices(ref result); Console.WriteLine("--> " + result); if (!result.Contains("成功")) { return; } Console.WriteLine("<-- OK"); System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
Console.ReadLine();
return;
}
Console.WriteLine("FAIL:Total " + (decimal)sw.ElapsedMilliseconds + "S");
Console.ReadLine();
return;
}
{
isOk = false;
}
}
Console.WriteLine("缺少音頻檔案【校正音頻檔案未通過】.");
Console.WriteLine("FAIL:Total " + (decimal)sw.ElapsedMilliseconds + "S");
Console.ReadLine();
return;
}
Console.WriteLine("--> " + cmd);
Console.WriteLine("<-- OK:" + result);
sw.Stop(); Console.WriteLine("\n"); Console.WriteLine("PASS:Total " + (decimal)sw.ElapsedMilliseconds + "S"); Console.WriteLine("\n"); Console.WriteLine("按斷行符號鍵繼續..."); str = Console.ReadKey().Key.ToString(); } while (str.ToUpper().Trim() == "ENTER" || !string.IsNullOrEmpty(error)); Console.ReadLine(); }
Android 測試載入器