Example #1
0
        public void GetMethods(CommandsConsole commands)
        {
            var methods = commands.GetType()
                          .GetMethods()
                          .Where(m => m.GetCustomAttributes(typeof(BindAttribute), false).Length > 0).ToArray();
            var message = string.Empty;

            for (var i = 0; i < methods.Length; i++)
            {
                var method = methods[i];
                cachedMethods.Add(method.Name, method);
                var _params = method.GetParameters();
                if (method.Name == "Help")
                {
                    continue;
                }
                message += "\n-> <b>" + method.Name + "</b><i>";

                for (var j = 0; j < _params.Length; j++)
                {
                    message += " <color=#555555>(" + _params[j].ParameterType.Name + ")</color><color=#858585> " +
                               _params[j].Name + "</color>";
                }

                message += "</i>";
            }

            cachedHelp = message;
        }
Example #2
0
 public void Setup(CommandsConsole commands)
 {
     if (commands == null || this.commands != null)
     {
         return;
     }
     this.commands = commands;
     GetMethods(this.commands);
 }