allen0118

有时候会发现给手机烧入的信息里少了某一些文件,比如一个图标,或者一个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();
        }

分类:

技术点:

相关文章:

  • 2021-12-03
  • 2021-07-06
  • 2021-11-27
  • 2021-12-15
  • 2021-09-06
  • 2021-12-15
  • 2021-12-15
  • 2021-12-15
猜你喜欢
  • 2021-10-16
  • 2021-11-01
  • 2021-11-07
  • 2021-12-15
  • 2021-11-21
相关资源
相似解决方案