コード例 #1
0
        private void QueueChat(string msg, bool pm)
        {
            DiagnosticServices.Chat_QueueChat(this.BotBits);

            var channel = GetChannel(msg, pm);

            this.Enqueue(msg, channel);
        }
コード例 #2
0
        protected override Action GetBinder(object baseObj, MethodInfo eventHandler)
        {
            var t           = this.GetEventType(eventHandler);
            var genericBind = _bindMethod.MakeGenericMethod(t);


            DiagnosticServices.Eventloader_GetBinder(this.BotBits, t, eventHandler);

            return(() => genericBind.Invoke(this, new[] { baseObj, eventHandler }));
        }
コード例 #3
0
ファイル: EventHandle.cs プロジェクト: jkloop45/BotBits
        internal void BindInternal([CanBeNull] Assembly assembly, EventRaiseHandler <T> callback, GlobalPriority globalPriority,
                                   EventPriority priority)
        {
            var extensionId = ExtensionServices.GetExtensionId(this.BotBits, assembly);

            DiagnosticServices.EventHandle_BindInternal <T>(this.BotBits, extensionId.HasValue);

            lock (this._eventHandlers)
            {
                this._eventHandlers.Add(globalPriority, extensionId ?? int.MaxValue, priority, callback);
            }
        }
コード例 #4
0
        private void Bind <TEvent>(object baseObj, MethodInfo eventHandler)
            where TEvent : Event <TEvent>
        {
            var attribute =
                (EventListenerAttribute)
                eventHandler.GetCustomAttributes(typeof(EventListenerAttribute), true)[0];

            var handler =
                (EventRaiseHandler <TEvent>)
                Delegate.CreateDelegate(typeof(EventRaiseHandler <TEvent>), baseObj, eventHandler);

            DiagnosticServices.WithDiagnosticsDisabled(() =>
            {
                Event <TEvent>
                .Of(this.BotBits)
                .Bind(handler, attribute.GlobalPriority, attribute.Priority);
            });
        }
コード例 #5
0
        public override void Load(object obj)
        {
            DiagnosticServices.Eventloader_Load(obj.GetType());

            base.Load(obj);
        }
コード例 #6
0
        public override void LoadStatic <TType>()
        {
            DiagnosticServices.Eventloader_LoadStatic <TType>();

            base.LoadStatic <TType>();
        }
コード例 #7
0
        public IEnumerator <Player> GetEnumerator()
        {
            DiagnosticServices.GetEnumerator <Players>(this.BotBits);

            return(this._players.Values.Where(p => p.Connected).GetEnumerator());
        }