Esempio n. 1
0
        public void RemovePmSubscription(EventHandler <LogsMonitorEventArgs> eventHandler, string pmRecipient)
        {
            var key = new PmSubscriptionKey(eventHandler, pmRecipient);
            EnginePmSubscription manager;

            if (pmSubscriptions.TryGetValue(key, out manager))
            {
                manager.LogsMonitorPmEventHandler = null;
                pmSubscriptions.TryRemove(key, out manager);
            }
        }
Esempio n. 2
0
        public void AddPmSubscription(EventHandler <LogsMonitorEventArgs> eventHandler, CharacterName pmRecipient)
        {
            var  key     = new PmSubscriptionKey(eventHandler, pmRecipient.Normalized);
            bool success = pmSubscriptions.TryAdd(
                key,
                new EnginePmSubscription()
            {
                PmRecipientNormalized     = pmRecipient.Normalized,
                LogsMonitorPmEventHandler = eventHandler
            });

            if (!success)
            {
                logger.Log(LogLevel.Warn,
                           string.Format(
                               "Attempted to AddPmSubscription with handler, that's already subscribed. "
                               + "Additional subscription will be ignored. "
                               + "PmRecipient: {0} Handler pointing to method: {1}", pmRecipient,
                               eventHandler.MethodInformationToString()), this, null);
            }
        }