예제 #1
0
        public static void Load()
        {
            Type[] types = typeof(RPCNetwork).Assembly.GetTypes();
            for (var i = 0; i < types.Length; i++)
            {
                MethodInfo[] methods = types[i].GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
                for (var j = 0; j < methods.Length; j++)
                {
                    object[] args = methods[j].GetCustomAttributes(typeof(ConsoleCommandAttribute), true);
                    if (args.Length != 0)
                    {
                        ConsoleCommandAttribute attribute = args[0] as ConsoleCommandAttribute;
                        var method = new Reflection.FastMethodInfo(methods[j]);

                        ListCommandMethods[attribute.Command] = new CommandMethod(method, attribute);
                    }
                }
            }
        }
예제 #2
0
 public CommandMethod(Reflection.FastMethodInfo method, ConsoleCommandAttribute attribute)
 {
     this.Call      = method;
     this.Attribute = attribute;
 }