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