示例#1
0
 private static void AutoselectDevice()
 {
     foreach (ADBDevice device in ADBUtility.GetDevices())
     {
         if (!device.DEVICE_ID.Contains(".") && device.DEVICE_TYPE != "emulator")
         {
             Device = device;
             break;
         }
     }
 }
示例#2
0
        public static void ChangeADBModeToUSB(ADBDevice device)
        {
            //Change the ADB mode to USB
            Process USBOperation = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName               = "cmd",
                    Arguments              = @"/C " + $"{ADB_Path} -s {device.DEVICE_ID} usb",
                    UseShellExecute        = false,
                    RedirectStandardOutput = true,
                    CreateNoWindow         = true
                }
            };

            //Launch process
            USBOperation.Start();
        }
示例#3
0
        public static String GatherIPAddress(ADBDevice device)
        {
            //Get IP address of the active interface
            Process IPQuery = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName               = "cmd",
                    Arguments              = $@"/C {ADB_Path} -s {device.DEVICE_ID} shell ip route",
                    UseShellExecute        = false,
                    RedirectStandardOutput = true,
                    CreateNoWindow         = true
                }
            };

            //Launch process
            IPQuery.Start();
            //Return IP address
            return(IPQuery.StandardOutput.ReadLine().Split(' ')[11]);
        }