Beispiel #1
0
 // Token: 0x060000BF RID: 191 RVA: 0x00005000 File Offset: 0x00003200
 public void HandleEvent(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item)
 {
     using (new GuidTraceFilter(base.DatabaseInfo.Guid, mapiEvent.MailboxGuid))
     {
         string value = (item != null) ? item.ClassName : mapiEvent.ObjectClass;
         if (!string.IsNullOrEmpty(value) || mapiEvent.ItemType == ObjectType.MAPI_STORE || mapiEvent.ItemType == ObjectType.MAPI_FOLDER)
         {
             EventBasedAssistant.Tracer.TraceDebug <EventBasedAssistant, long, IExchangePrincipal>((long)this.GetHashCode(), "{0}: Started handling event {1} for mailbox {2}.", this, mapiEvent.EventCounter, itemStore.MailboxOwner);
             List <KeyValuePair <string, object> > list = new List <KeyValuePair <string, object> >();
             IActivityScope currentActivityScope        = ActivityContext.GetCurrentActivityScope();
             Guid           activityId = Guid.Empty;
             if (currentActivityScope != null)
             {
                 activityId = currentActivityScope.ActivityId;
             }
             AssistantsLog.LogStartProcessingMailboxEvent(activityId, this, mapiEvent, itemStore.MailboxGuid);
             TraceContext.Set(itemStore);
             try
             {
                 this.HandleEventInternal(mapiEvent, itemStore, item, list);
                 goto IL_103;
             }
             finally
             {
                 TraceContext.Reset();
                 AssistantsLog.LogEndProcessingMailboxEvent(activityId, this, list, itemStore.MailboxGuid, string.Empty, null);
                 EventBasedAssistant.Tracer.TraceDebug <EventBasedAssistant, long, IExchangePrincipal>((long)this.GetHashCode(), "{0}: Ended handling event {1} for mailbox {2}.", this, mapiEvent.EventCounter, itemStore.MailboxOwner);
             }
         }
         EventBasedAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: Event not processed because we are unable get the ObjectClass on the item.", itemStore.MailboxOwner);
         IL_103 :;
     }
 }
        private static void Set(string label, ThreadCounter threadCounter, ClientContext clientContext, RequestLogger requestLogger, ThreadContext.ExecuteDelegate executeDelegate)
        {
            string text = (clientContext != null) ? clientContext.IdentityForFilteredTracing : "none";
            RequestStatisticsForThread requestStatisticsForThread = RequestStatisticsForThread.Begin();

            threadCounter.Increment();
            ThreadContext.Tracer.TraceDebug <string, string, string>(0L, "{0}: Thread entered {1}. MessageId={2}", text, label, (clientContext != null) ? (clientContext.MessageId ?? "<null>") : "none");
            try
            {
                using (new ASTraceFilter(null, text))
                {
                    TraceContext.Set(text);
                    try
                    {
                        executeDelegate();
                    }
                    finally
                    {
                        TraceContext.Reset();
                    }
                }
            }
            finally
            {
                threadCounter.Decrement();
                RequestStatistics requestStatistics = requestStatisticsForThread.End(RequestStatisticsType.ThreadCPULongPole, label);
                if (requestStatistics != null && requestLogger != null)
                {
                    requestLogger.Add(requestStatistics);
                }
                ThreadContext.Tracer.TraceDebug <string, string>(0L, "{0}: Thread exited {1}", text, label);
            }
        }
        // Token: 0x060000E2 RID: 226 RVA: 0x00005778 File Offset: 0x00003978
        public void Invoke(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog = null)
        {
            StoreSession storeSession = invokeArgs.StoreSession;
            Guid         databaseGuid = invokeArgs.MailboxData.DatabaseGuid;
            string       displayName  = invokeArgs.MailboxData.DisplayName;
            Guid         mailboxGuid  = Guid.Empty;

            if (customDataToLog == null)
            {
                customDataToLog = new List <KeyValuePair <string, object> >();
            }
            StoreMailboxData storeMailboxData = invokeArgs.MailboxData as StoreMailboxData;

            if (storeMailboxData != null)
            {
                mailboxGuid = storeMailboxData.Guid;
            }
            using (new GuidTraceFilter(databaseGuid, mailboxGuid))
            {
                TimeBasedAssistant.Tracer.TraceDebug <TimeBasedAssistant, string>((long)this.GetHashCode(), "{0}: Started invoke for mailbox {1}.", this, displayName);
                if (storeMailboxData != null)
                {
                    TraceContext.Set(storeSession);
                }
                try
                {
                    invokeArgs.ActivityId = ((ActivityContext.ActivityId != null) ? ActivityContext.ActivityId.Value : Guid.Empty);
                    this.InvokeInternal(invokeArgs, customDataToLog);
                }
                finally
                {
                    TraceContext.Reset();
                    TimeBasedAssistant.Tracer.TraceDebug <TimeBasedAssistant, string>((long)this.GetHashCode(), "{0}: Ended invoke for mailbox {1}.", this, displayName);
                    TimeBasedAssistant.TracerPfd.TracePfd <int, TimeBasedAssistant, string>((long)this.GetHashCode(), "PFD IWE {0} {1}: Invoke completed for mailbox '{2}'.", 22167, this, displayName);
                }
            }
        }