Beispiel #1
0
        public string ExecuteCommand(IHomeSession homeSession, string message)
        {
            ICommand command;

            try
            {
                command = mCommandParser.Parse(message);
            }
            catch (CommandParsingExecption execption)
            {
                return execption.Message;
            }

            if (!homeSession.IsLoggedIn() && command.GetType() != typeof (Login))
            {
                return "Not Logged In";
            }

            //homeSession.Write(command.CanExecute() ? command.Execute() : "Cannot Execute Command");
            return (command.CanExecute() ? command.Execute() : "Cannot Execute Command");
        }