/// <summary> /// Initializes a new instance of the <see cref="WeMoDeviceCommand"/> class. /// </summary> /// <param name="command">The command.</param> public WeMoDeviceCommand(string command, string commandname, CommandActionEnum action = CommandActionEnum.Unknown) { this.Command = command; this.CommandName = commandname; this.CommandAction = action; this.Result = null; }
public void Run() { Console.WriteLine("Ready!"); while (_status == CommandActionEnum.Continue) { _status = ExecuteLine(Console.ReadLine()); } if (_status == CommandActionEnum.Crash) { Console.Error.WriteLine("Crash!"); } }
public ConsoleController() { _commandToApps = new Dictionary <string, AConsoleImplementation>(); foreach (var ca in AConsoleImplementation.GetSubClasses()) { foreach (var c in ca.Commands) { if (_commandToApps.ContainsKey(c)) { var oldCommand = _commandToApps[c]; Console.Error.WriteLine( $"Duplicate commands '{c}' with console apps '{oldCommand.GetType().Name}' and '{ca.GetType().Name}'"); _status = CommandActionEnum.Exit; continue; } _commandToApps[c] = ca; } } }
/// <summary> /// Initializes command with provided data /// </summary> /// <param name="type"></param> /// <param name="action"></param> /// <param name="data"></param> public Command(CommandTypeEnum type, CommandActionEnum action, String data = "") { this.Type = type; this.Action = action; this.Data = data; }
/// <summary> /// Initializes empty, undefined command /// </summary> public Command() { this.Type = CommandTypeEnum.UNDEFINED; this.Action = CommandActionEnum.UNDEFINED; this.Data = null; }