public StartServer ( string adbPath, bool restartServerIfNewer ) : StartServerResult | ||
adbPath | string | |
restartServerIfNewer | bool | |
Результат | StartServerResult |
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); } }
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; } }
/// <summary> /// Initialize Adb Server and Monitor /// </summary> public static void InitializeAdbServer(string path) { Server.StartServer(Path.GetFullPath(Path.Combine(path)), restartServerIfNewer: false); var monitor = new DeviceMonitor(new AdbSocket(new IPEndPoint(IPAddress.Loopback, AdbClient.AdbServerPort))); Instance = CustomMonitor.Instance; monitor.DeviceConnected += OnDeviceConnected; monitor.DeviceChanged += OnDeviceChanged; monitor.DeviceDisconnected += OnDeviceDisconnected; monitor.Start(); }
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; } }