public ICommandProcedure OpenCommand(string commandName, params string[] args) { lock (openCommandLock) { var commandProcedure = new CommandProcedure() { FileName = commandName, Arguments = string.Join(" ", args) }; commandProcedure.InitializeAdbEnvironment(this.adbClientDir, this.adbPort); commandProcedure.Disposed += CommandProcedure_Disposed; notDisposeds?.Add(commandProcedure); return(commandProcedure); } }
protected virtual void KillServer() { lock (concurrentLock) { using var cmd = new CommandProcedure() { FileName = AdbExecutableFile.ToString(), Arguments = $"-P{ServerEndPoint.Port} kill-server", DirectExecute = true, }; cmd.InitializeAdbEnvironment(AdbClientDirectory, (ushort)ServerEndPoint.Port); new LocalAdbServerKiller(cmd).Kill().Wait(); SLogger.Info(this, "Adb Server has been stopped."); } }
protected virtual IPEndPoint StartServer(ushort port = 6605) { using var cmd = new CommandProcedure() { FileName = AdbExecutableFile.ToString(), Arguments = $"-P{port} start-server", DirectExecute = true, }; cmd.InitializeAdbEnvironment(AdbClientDirectory, port); int line = 0; cmd.OutputReceived += (s, e) => { line++; SLogger.Info(this, $"statring adb server {line}:{e.Text}"); }; cmd.Execute(); return(new IPEndPoint(IPAddress.Parse("127.0.0.1"), port)); }
protected virtual void KillServer() { lock (concurrentLock) { using var cmd = new CommandProcedure() { FileName = AdbExecutableFile.ToString(), Arguments = $"-P{ServerEndPoint.Port} kill-server", DirectExecute = true, }; cmd.InitializeAdbEnvironment(AdbClientDirectory, (ushort)ServerEndPoint.Port); int line = 0; cmd.OutputReceived += (s, e) => { line++; SLogger.Info(this, $"killing adb server {line}:{e.Text}"); }; cmd.Execute(); SLogger.Info(this, "server killed"); } }