Provides methods for interacting with the adb server. The adb server must be running for the rest of the Managed.Adb library to work.

The adb server is a background process that runs on the host machine. Its purpose if to sense the USB ports to know when devices are attached/removed, as well as when emulator instances start/stop. The ADB server is really one giant multiplexing loop whose purpose is to orchestrate the exchange of data between clients and devices.

Exemplo n.º 1
0
        public frmSend(string filename)
        {
            InitializeComponent();
            _filename = filename;
            server    = new SharpAdbClient.AdbServer();
            var adbPath = @"C:\android - sdk\platform - tools\adb.exe";
            StartServerResult result;

            if (!System.IO.File.Exists(adbPath))
            {
                adbPath = @"C:\ProgramData\Microsoft\AndroidSDK\25\platform-tools\adb.exe";
            }
            if (!System.IO.File.Exists(adbPath))
            {
                MessageBox.Show("Unable to find adb.exe", "Error");
                return;
            }
            result = server.StartServer(adbPath, restartServerIfNewer: false);
            client = new SharpAdbClient.AdbClient();
            List <SharpAdbClient.DeviceData> devices = client.GetDevices();

            foreach (SharpAdbClient.DeviceData device in devices)
            {
                cboListDevices.Items.Add(device);
            }
            if (cboListDevices.Items.Count > 0)
            {
                cboListDevices.SelectedIndex = 0;
            }
        }
Exemplo n.º 2
0
 public AdbManager(string adbFile)
 {
     _deviceList = new Dictionary <string, DeviceData>();
     _server     = new AdbServer();
     if (adbFile != null && File.Exists(adbFile))
     {
         _server.StartServer(adbFile, restartServerIfNewer: false);
     }
     else
     {
         _server.StartServer(GetAdbPath(), restartServerIfNewer: false);
     }
 }
Exemplo n.º 3
0
 public AdbFileProvider(string rootPath)
 {
     try
     {
         _server = new SharpAdbClient.AdbServer();
         _server.StartServer(@"adb.exe", restartServerIfNewer: false);
         _rootPath = rootPath;
     }
     catch (Exception ex)
     {
         Log.LogErr("Exception initializing AdbFileProvider", ex);
         throw;
     }
 }