示例#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..]);
示例#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));
 }
示例#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]);
        }
示例#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);
 }
示例#8
0
 public abstract Task Execute(SignalChopper chopper, string[] args);