Пример #1
0
        private IEnumerable <HandlerInfo> FindHandlers(SubscriberInfo SubInfo)
        {
            HandlerInfo handlerInfo = null;

            MethodInfo[] methods = SubInfo.SubscriberType.GetMethods(
                BindingFlags.Instance
                | BindingFlags.Public
                | BindingFlags.FlattenHierarchy
                );

            //_Logger.LogAt(LogLevel.LL_DebugFramework, "FindHandlers - "+methods.Length + " methods to process.");

            foreach (MethodInfo mthd in methods)
            {
                //_Logger.LogAt(LogLevel.LL_DebugFramework, "Method: " + mthd.Name);
                object[] attribs = mthd.GetCustomAttributes(typeof(SubscribeToAttribute), false);
                if (attribs != null && attribs.Length > 0)
                {
                    //_Logger.LogAt(LogLevel.LL_DebugFramework, "Found" + attribs.Length + " SubscribeTo attributes.");
                    foreach (object attr in attribs)
                    {
                        SubscribeToAttribute subTo = attr as SubscribeToAttribute;

                        if (subTo != null)
                        {
                            _Logger.LogAt(LogLevel.LL_DebugFramework, subTo.ToString());
                            Delegate       del     = Delegate.CreateDelegate(typeof(MessageHandler), SubInfo.Instance, mthd, false);
                            MessageHandler handler = (MessageHandler)del;
                            if (handler != null)
                            {
                                handlerInfo = new HandlerInfo(subTo);
                                handlerInfo.UpdateHandler(handler);
                                yield return(handlerInfo);
                            }
                        }
                        else
                        {
                            _Logger.LogAt(LogLevel.LL_DebugFramework, "SubscribeTo was NULL");
                        }
                    }
                }
            }
            yield break;
        }
Пример #2
0
 internal HandlerInfo(SubscribeToAttribute attr)
 {
     Origin = attr.Origin;
     EventType = attr.EventType;
 }
Пример #3
0
 internal HandlerInfo(SubscribeToAttribute attr)
 {
     Origin    = attr.Origin;
     EventType = attr.EventType;
 }