コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
 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())));
 }