Beispiel #1
0
        public override async Task Execute(SignalChopper chopper, string[] args)
        {
            if (args.Length < 1)
            {
                await Console.Error.WriteLineAsync("Missing method name for send command.");

                return;
            }

            chopper.Send(args[0], args[1..]);
Beispiel #2
0
 public Program()
 {
     this.chopper  = new SignalChopper();
     this.commands = new Dictionary <string, SignalChopCommand>();
     this.AddCommand(new ListenCommand());
     this.AddCommand(new StopListenCommand());
     this.AddCommand(new ConnectCommand());
     this.AddCommand(new QuitCommand());
     this.AddCommand(new SendCommand());
     this.AddCommand(new HelpCommand(this.commands));
 }
Beispiel #3
0
        public override async Task Execute(SignalChopper chopper, string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Missing server name.");
                this.DisplayHelp();
                return;
            }

            await chopper.Connect(args[0]);
        }
Beispiel #4
0
        public override Task Execute(SignalChopper chopper, string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Missing method name.");
                this.DisplayHelp();
            }
            else
            {
                chopper.CheckConnection();
                chopper.StopListen(args);
            }

            return(Task.CompletedTask);
        }
        public override async Task Execute(SignalChopper chopper, string[] args)
        {
            if (args.Length < 1)
            {
                await Console.Error.WriteLineAsync(
                    "Missing method name for help command. Use Help <method>, e.g. 'Help Listen'.");

                return;
            }

            if (this.commands.ContainsKey(args[0]))
            {
                this.commands[args[0]].DisplayHelp();
            }
            else
            {
                await Console.Error.WriteLineAsync($"Unknown command '{args[0]}'.");
            }
        }
 public override Task Execute(SignalChopper chopper, string[] args)
 {
     chopper.Listen(args);
     return(Task.CompletedTask);
 }
 public override Task Execute(SignalChopper chopper, string[] args)
 {
     chopper.Quit(args.Length > 0 ? int.Parse(args[0]) : 0);
     return(Task.CompletedTask);
 }
Beispiel #8
0
 public abstract Task Execute(SignalChopper chopper, string[] args);