Exemplo n.º 1
0
        /// <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;
        }
Exemplo n.º 2
0
        public void Run()
        {
            Console.WriteLine("Ready!");
            while (_status == CommandActionEnum.Continue)
            {
                _status = ExecuteLine(Console.ReadLine());
            }

            if (_status == CommandActionEnum.Crash)
            {
                Console.Error.WriteLine("Crash!");
            }
        }
Exemplo n.º 3
0
        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;
                }
            }
        }
Exemplo n.º 4
0
 /// <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;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes empty, undefined command
 /// </summary>
 public Command()
 {
     this.Type   = CommandTypeEnum.UNDEFINED;
     this.Action = CommandActionEnum.UNDEFINED;
     this.Data   = null;
 }