コード例 #1
0
        public object ExecuteCommand(string commandName, string[] args)
        {
            if (!commandsCollection.Commands.TryGetValue(commandName, out ICommandModel command))
            {
                return("Unknown command. " + commandName);
            }

            try
            {
                return(command.Invoke(commandParser.ParseArgs(command, args)));
            }
            catch (ArgumentException)
            {
                return("Command Failed. Incorrect parameters usage.");
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
                return("Command Failed. Ex: " + ex.Message);
            }
        }