Beispiel #1
0
        void StartADB()
        {
            // 注册事件(adb,Android Debug Bridge)
            AdbHelp.StartServer();

            string[] devices = AdbHelp.GetDevices();
            foreach (var device in devices)
            {
                AdbHelp.StopApp(device, "com.tencent.mm");
                Console.WriteLine("设备:" + device);
                Console.WriteLine("型号:" + AdbHelp.GetDeviceModel(device));
                Console.WriteLine("品牌:" + AdbHelp.GetDeviceBrand(device));
                Console.WriteLine("设备指纹:" + AdbHelp.GetDeviceFingerprint(device));
                Console.WriteLine("系统版本:" + AdbHelp.GetDeviceVersionRelease(device));
                Console.WriteLine("SDK版本:" + AdbHelp.GetDeviceVersionSdk(device));
                string[] apps = AdbHelp.GetAPP(device);
                foreach (var app in apps)
                {
                    Console.WriteLine("\t" + app);
                }
                string file   = device + ".txt";
                string remote = "/sdcard/" + file;
                File.WriteAllText(file, string.Join("\r\n", apps));
                var pushResult = AdbHelp.FilePush(device, file, remote);
                Console.WriteLine("上传结果:" + pushResult);
                var pullResult = AdbHelp.FilePull(device, remote, "pull.txt");
                Console.WriteLine("下载结果:" + pullResult);
                var renameResult = AdbHelp.FileRename(device, remote, remote.Replace(device, "target"));
                Console.WriteLine("重命名结果:成功!");
            }

            Console.Read();
        }
Beispiel #2
0
        static void TestClose()
        {
            int counter = 0;

            AdbHelp.StartServer();
            string[] devices    = AdbHelp.GetDevices();
            string   deviceName = devices.Length > 0 ? devices[0] : "0123456789ABCDEF";

            for (int i = 0; i < exeCount; i++)
            {
                AdbHelp.StopApp(deviceName, "com.tencent.mm");
                AdbHelp.FilePull(deviceName, "/sdcard/sdms/dbs/PdaSDMS.db", Environment.CurrentDirectory);
                AdbHelp.FilePull(deviceName, Environment.CurrentDirectory, "/sdcard/sdms/dbs/1.db");
                AdbHelp.FileRename(deviceName, "/sdcard/sdms/dbs/1.db", "/sdcard/sdms/dbs/2.db");
                AdbHelp.GetDeviceModel(deviceName);
                Console.WriteLine(string.Format("{0}:当前执行条数{1}....................{2}/{3}", Thread.CurrentThread.Name, ++counter, ++total, threadCount * exeCount));
            }
        }