public void StartProcessing(string @command, string @serialnumber) { if (command.StartsWith("adb")) { if (AdbDeviceWatcher.GetConnectedAdbDevices() > 0 || command.EndsWith("help") || command.EndsWith("version") || command.StartsWith("adb connect") || command.StartsWith("adb disconnect")) { StopProcessing(); Thread.Sleep(50); CommandExecutionStarted?.Invoke(); process.StandardInput.WriteLine(CommandParser(command, serialnumber)); } else { MessageBox.Show("No device connected. Please connect a device for adb commands.", "Error - No Device Found", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (command.StartsWith("cls")) { ClearConsole?.Invoke(); } else { StopProcessing(); Thread.Sleep(50); CommandExecutionStarted?.Invoke(); process.StandardInput.WriteLine(CommandParser(command, serialnumber)); } }
public void StartProcessing(string @command, string @serialnumber) { if (command.StartsWith("adb")) { if (AdbDeviceWatcher.GetConnectedAdbDevices() > 0 || command.EndsWith("help") || command.EndsWith("version") || command.StartsWith("adb connect") || command.StartsWith("adb disconnect")) { StopProcessing(); Thread.Sleep(50); CommandExecutionStarted?.Invoke(); process.StandardInput.WriteLine(CommandParser(command, serialnumber)); } else { MessageBoxTimeout((IntPtr)0, ERROR_MSG, ERROR_TITLE, 48, 0, 1600); //MessageBox.Show(ERROR_MSG,ERROR_TITLE , MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (command.StartsWith("cls")) { ClearConsole?.Invoke(); } else { StopProcessing(); Thread.Sleep(50); CommandExecutionStarted?.Invoke(); process.StandardInput.WriteLine(CommandParser(command, serialnumber)); } }
private void RegisterCommands() { _commands.Add(new Command("LoginUser", "\\login", () => LoginUser?.Invoke(this, new EventArgs()))); _commands.Add(new Command("LogoutUser", "\\logout", () => LogoutUser?.Invoke(this, new EventArgs()))); _commands.Add(new Command("ClearConsole", "\\clear", () => ClearConsole?.Invoke(this, new EventArgs()))); _commands.Add(new Command("ShowUsers", "\\whois", () => ShowUsers?.Invoke(this, new EventArgs()))); _commands.Add(new Command("JoinChat", "\\join", () => JoinChat?.Invoke(this, new EventArgs()))); }