Example #1
0
        private void UpdateDeviceList()
        {
            string deviceList = "";

            this._connectedDevices.Clear();

            deviceList = CheckDevices ();
            if (deviceList.Length > 29)
            {
                using (StringReader s = new StringReader(deviceList))
                {
                    string line;

                    while (s.Peek() != -1)
                    {
                        line = s.ReadLine();

                        if (line.StartsWith("List") || line.StartsWith("\r\n") || line.Trim() == "")
                            continue;

                        if (line.IndexOf('\t') != -1)
                        {
                            line = line.Substring(0, line.IndexOf('\t'));
                            this._connectedDevices.Add(line);
                        }
                    }
                }
            }

            AndroidCommand fastBootDevices = new AndroidCommand (_fastbootLocation, "devices");
            deviceList = fastBootDevices.Execute ();
            if (deviceList.Length > 0)
            {
                using (StringReader s = new StringReader(deviceList))
                {
                    string line;

                    while (s.Peek() != -1)
                    {
                        line = s.ReadLine();

                        if (line.StartsWith("List") || line.StartsWith("\r\n") || line.Trim() == "")
                            continue;

                        if (line.IndexOf('\t') != -1)
                        {
                            line = line.Substring(0, line.IndexOf('\t'));
                            this._connectedDevices.Add(line);
                        }
                    }
                }
            }
        }
Example #2
0
 private string CheckDevices()
 {
     AndroidCommand devicesCommand = new AndroidCommand (_adbLocation, "devices");
     string result = devicesCommand.Execute ();
     return result;
 }