Exemplo n.º 1
0
        public void ParseMsgHandler(object obj)
        {
            Type type = obj.GetType();

            MethodInfo[] list = type.GetMethods();

            foreach (MethodInfo method in list)
            {
                MsgHandlerAttribute[] attributes = (MsgHandlerAttribute[])method.GetCustomAttributes(typeof(MsgHandlerAttribute), true);

                JMethodInfo m = new JMethodInfo(obj, method);

                if (attributes.Length > 0)
                {
                    if (attributes[0].SubscibeHandler)
                    {
                        RegisteReceiveMsg(attributes[0].Msg, m);
                    }
                    else
                    {
                        RegisteMsgHandler(attributes[0].Msg, m);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void RegisteMsgHandler(uint msg, JMethodInfo method)
        {
            if (MsgMethodInfos.ContainsKey(msg))
            {
                //log.ErrorFormat("{0} 消息已存在处理方法信息,无法注册.", msg);
                //return;
                throw new Exception(msg + " 消息已存在处理方法信息,无法注册.");
            }

            MsgMethodInfos[msg] = method;
        }
Exemplo n.º 3
0
 public void RegisteReceiveMsg(uint msg, JMethodInfo method)
 {
     MsgMonitor.RegisteMsgReceiver(msg, this);
     RegisteMsgHandler(msg, method);
 }
Exemplo n.º 4
0
        public void RegisteMsgHandler(uint msg, JMethodInfo method)
        {
            if (MsgMethodInfos.ContainsKey(msg))
            {
                //log.ErrorFormat("{0} 消息已存在处理方法信息,无法注册.", msg);
                //return;
                throw new Exception(msg + " 消息已存在处理方法信息,无法注册.");
            }

            MsgMethodInfos[msg] = method;
        }
Exemplo n.º 5
0
        public void ParseMsgHandler(object obj)
        {
            Type type = obj.GetType();

            MethodInfo[] list = type.GetMethods();

            foreach (MethodInfo method in list)
            {
                MsgHandlerAttribute[] attributes = (MsgHandlerAttribute[])method.GetCustomAttributes(typeof(MsgHandlerAttribute), true);

                JMethodInfo m = new JMethodInfo(obj, method);

                if (attributes.Length > 0)
                {
                    if (attributes[0].SubscibeHandler)
                    {
                        RegisteReceiveMsg(attributes[0].Msg, m);
                    }
                    else
                    {
                        RegisteMsgHandler(attributes[0].Msg, m);
                    }
                }
            }
        }
Exemplo n.º 6
0
 public void RegisteReceiveMsg(uint msg, JMethodInfo method)
 {
     MsgMonitor.RegisteMsgReceiver(msg, this);
     RegisteMsgHandler(msg, method);
 }