// Token: 0x060000FE RID: 254 RVA: 0x00005BE0 File Offset: 0x00003DE0
        public bool IsEventInteresting(MapiEvent mapiEvent)
        {
            CachedState cachedState = AssistantsService.CachedObjectsList.GetCachedState(mapiEvent.MailboxGuid);
            MailboxData mailboxData = (MailboxData)cachedState.State[3];

            return(BodyTagProcessor.IsEventInteresting(mapiEvent) || ActionsProcessor.IsEventInteresting(mapiEvent) || SentItemsProcessor.IsEventInteresting(mapiEvent, mailboxData) || LicensingProcessor.IsEventInteresting(mapiEvent, mailboxData) || InferenceProcessor.IsEventInteresting(mapiEvent, mailboxData));
        }
        // Token: 0x060000FF RID: 255 RVA: 0x00005C38 File Offset: 0x00003E38
        protected override void HandleEventInternal(MapiEvent mapiEvent, MailboxSession session, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
        {
            CachedState cachedState = AssistantsService.CachedObjectsList.GetCachedState(mapiEvent.MailboxGuid);
            MailboxData mailboxData = (MailboxData)cachedState.State[3];

            if (mailboxData == null)
            {
                mailboxData = new MailboxData(session);
                Interlocked.Exchange(ref cachedState.State[3], mailboxData);
            }
            if (BodyTagProcessor.IsEventInteresting(mapiEvent))
            {
                BodyTagProcessor.HandleEventInternal(session, item);
                return;
            }
            if (ActionsProcessor.IsEventInteresting(mapiEvent))
            {
                ActionsProcessor.HandleEventInternal(mapiEvent, session, item, mailboxData);
                Interlocked.Exchange(ref cachedState.State[3], mailboxData);
                return;
            }
            if (SentItemsProcessor.IsEventInteresting(mapiEvent, mailboxData))
            {
                SentItemsProcessor.HandleEventInternal(mapiEvent, session, item, mailboxData);
                Interlocked.Exchange(ref cachedState.State[3], mailboxData);
                return;
            }
            if (LicensingProcessor.IsEventInteresting(mapiEvent, mailboxData))
            {
                LicensingProcessor.HandleEventInternal(session, item);
                return;
            }
            if (InferenceProcessor.IsEventInteresting(mapiEvent, mailboxData))
            {
                InferenceProcessor.HandleEventInternal(mapiEvent, session, item, mailboxData, customDataToLog);
            }
        }
 // Token: 0x0600010A RID: 266 RVA: 0x0000677A File Offset: 0x0000497A
 public void ProcessBodyTag()
 {
     ExWatson.SendReportOnUnhandledException(delegate()
     {
         List <IStorePropertyBag> propertyBagList = new List <IStorePropertyBag>(100);
         ExDateTime toProcessDate   = ExDateTime.UtcNow.Subtract(TimeSpan.FromDays(15.0));
         int indexTrackingCounter   = 0;
         bool trackingCheckRequired = true;
         string text  = null;
         string text2 = null;
         string text3 = null;
         bool flag    = false;
         try
         {
             using (MailboxSession session = MailboxSession.OpenAsAdmin(this.principal, CultureInfo.InvariantCulture, "Client=TBA;Action=Conversation Assistant"))
             {
                 text = session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString();
                 AllItemsFolderHelper.RunQueryOnAllItemsFolder <bool>(session, AllItemsFolderHelper.SupportedSortBy.ReceivedTime, delegate(QueryResult queryResults)
                 {
                     bool flag2 = false;
                     int num    = 0;
                     while (!flag2)
                     {
                         IStorePropertyBag[] propertyBags = queryResults.GetPropertyBags(50);
                         if (propertyBags.Length <= 0)
                         {
                             break;
                         }
                         foreach (IStorePropertyBag storePropertyBag2 in propertyBags)
                         {
                             num++;
                             if (num >= 10000)
                             {
                                 BodyTagProcessor.Tracer.TraceDebug <string>(0L, "Skip querying as we have reached our maximum limit of emails we want to process for {0}", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString());
                                 flag2 = true;
                                 break;
                             }
                             string text5 = storePropertyBag2.TryGetProperty(StoreObjectSchema.ItemClass) as string;
                             if (!string.IsNullOrEmpty(text5) && ObjectClass.IsMessage(text5, false))
                             {
                                 if (!(BodyTagProcessor.GetProperty <ExDateTime>(storePropertyBag2, ItemSchema.ReceivedTime, ExDateTime.MinValue) >= toProcessDate))
                                 {
                                     flag2 = true;
                                     break;
                                 }
                                 if (trackingCheckRequired && !(storePropertyBag2.TryGetProperty(ItemSchema.ConversationIndexTracking) is PropertyError))
                                 {
                                     indexTrackingCounter++;
                                     if (indexTrackingCounter >= 10)
                                     {
                                         BodyTagProcessor.Tracer.TraceDebug <string>(0L, "Not processing BodyTag for mailbox {0}", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString());
                                         flag2 = true;
                                         break;
                                     }
                                 }
                                 if (storePropertyBag2.TryGetProperty(ItemSchema.BodyTag) is PropertyError || storePropertyBag2.TryGetProperty(ItemSchema.BodyTag) == null)
                                 {
                                     propertyBagList.Add(storePropertyBag2);
                                 }
                             }
                         }
                         trackingCheckRequired = false;
                     }
                     return(true);
                 }, new PropertyDefinition[]
                 {
                     ItemSchema.Id,
                     StoreObjectSchema.ItemClass,
                     ItemSchema.ReceivedTime,
                     ItemSchema.BodyTag,
                     ItemSchema.ConversationIndexTracking
                 });
                 if (propertyBagList.Count == 0 || indexTrackingCounter >= 10)
                 {
                     string text4 = (propertyBagList.Count == 0) ? " 0 messages to process" : " IndexTrackingCounter reached its limit";
                     Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_BodyTagProcessingSkipped, null, new object[]
                     {
                         text,
                         text4
                     });
                     return;
                 }
                 Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_TotalNumberOfItemsForBodyTagProcessing, null, new object[]
                 {
                     propertyBagList.Count,
                     text
                 });
                 foreach (IStorePropertyBag storePropertyBag in propertyBagList)
                 {
                     try
                     {
                         using (MessageItem messageItem = MessageItem.Bind(session, storePropertyBag[ItemSchema.Id] as StoreId))
                         {
                             if (!(messageItem is RightsManagedMessageItem))
                             {
                                 messageItem.OpenAsReadWrite();
                                 messageItem[ItemSchema.BodyTag] = messageItem.Body.CalculateBodyTag();
                                 messageItem.Save(SaveMode.ResolveConflicts);
                             }
                         }
                     }
                     catch (ObjectNotFoundException)
                     {
                         BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "ObjectNotFound exception thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text);
                     }
                     catch (AccessDeniedException)
                     {
                         BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "AccessDenied exception thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text);
                     }
                     catch (CorruptDataException)
                     {
                         BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "Corrupt data exception thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text);
                     }
                     catch (VirusException)
                     {
                         BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "Virus exception thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text);
                     }
                     catch (PropertyErrorException)
                     {
                         BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "PropertyErrorException thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text);
                     }
                     catch (StoragePermanentException ex)
                     {
                         if (!(ex.InnerException is MapiExceptionCallFailed))
                         {
                             throw;
                         }
                         BodyTagProcessor.Tracer.TraceDebug <object, string>(0L, "MapiExceptionCallFailed thrown while processing item - {0} in mailbox - {1}", storePropertyBag[ItemSchema.Id], text);
                     }
                 }
             }
             Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_BodyTagProcessingSucceeded, null, new object[]
             {
                 text
             });
         }
         catch (ObjectNotFoundException ex2)
         {
             flag  = true;
             text2 = ex2.Message;
             text3 = ex2.StackTrace;
         }
         catch (CorruptDataException ex3)
         {
             flag  = true;
             text2 = ex3.Message;
             text3 = ex3.StackTrace;
         }
         catch (QuotaExceededException ex4)
         {
             flag  = true;
             text2 = ex4.Message;
             text3 = ex4.StackTrace;
         }
         catch (MessageSubmissionExceededException ex5)
         {
             flag  = true;
             text2 = ex5.Message;
             text3 = ex5.StackTrace;
         }
         catch (ConnectionFailedPermanentException ex6)
         {
             flag  = true;
             text2 = ex6.Message;
             text3 = ex6.StackTrace;
         }
         catch (MailboxUnavailableException ex7)
         {
             flag  = true;
             text2 = ex7.Message;
             text3 = ex7.StackTrace;
         }
         catch (StorageTransientException ex8)
         {
             flag  = true;
             text2 = ex8.Message;
             text3 = ex8.StackTrace;
         }
         catch (StoragePermanentException ex9)
         {
             if (!(ex9.InnerException is MapiExceptionJetErrorLogDiskFull))
             {
                 throw;
             }
             flag  = true;
             text2 = ex9.Message;
             text3 = ex9.StackTrace;
         }
         finally
         {
             if (flag)
             {
                 Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_BodyTagProcessingFailed, null, new object[]
                 {
                     text,
                     text2 ?? "<null>",
                     text3 ?? "<null>"
                 });
             }
         }
     }, delegate(object exception)
     {
         Exception ex = exception as Exception;
         if (ex != null)
         {
             Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_BodyTagProcessingFailed, null, new object[]
             {
                 this.principal.MailboxInfo.PrimarySmtpAddress.ToString(),
                 ex.Message ?? "<null>",
                 ex.StackTrace ?? "<null>"
             });
         }
         return(true);
     }, ReportOptions.None);
 }