// Token: 0x0600009A RID: 154 RVA: 0x00004A08 File Offset: 0x00002C08
 internal void AddExceptionToLog(Exception ex)
 {
     if (ex != null)
     {
         string key = ex.GetType().Name;
         string diagnosticContext = AssistantsLog.GetDiagnosticContext(ex);
         int    num     = this.exceptions.FindIndex((AssistantLogEntryBase.ExceptionInfo x) => x.Name == key && x.DiagnosticContext == diagnosticContext);
         string message = "No exception message";
         if (!string.IsNullOrEmpty(ex.Message))
         {
             message = ex.Message;
         }
         if (num == -1)
         {
             this.exceptions.Add(new AssistantLogEntryBase.ExceptionInfo
             {
                 Name              = key,
                 InnerException    = ((ex.InnerException != null) ? ex.InnerException.GetType().Name : "NoInnerException"),
                 Message           = message,
                 StackTrace        = ex.StackTrace,
                 Count             = 1,
                 DiagnosticContext = diagnosticContext
             });
             return;
         }
         AssistantLogEntryBase.ExceptionInfo exceptionInfo = this.exceptions[num];
         exceptionInfo.Count++;
         exceptionInfo.InnerException = ((ex.InnerException != null) ? ex.InnerException.GetType().Name : "NoInnerException");
         exceptionInfo.Message        = message;
         exceptionInfo.StackTrace     = ex.StackTrace;
     }
 }
示例#2
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 :;
     }
 }
示例#3
0
        // Token: 0x060007DE RID: 2014 RVA: 0x00039000 File Offset: 0x00037200
        protected bool AreExtendedPropertiesInteresting(string mailboxDisplayName, MailboxInformation mailboxInformation)
        {
            object mailboxProperty  = mailboxInformation.GetMailboxProperty(MailboxSchema.ConsumerSharingCalendarSubscriptionCount);
            object mailboxProperty2 = mailboxInformation.GetMailboxProperty(MailboxSchema.ExternalSharingCalendarSubscriptionCount);
            object mailboxProperty3 = mailboxInformation.GetMailboxProperty(MailboxSchema.InternetCalendarSubscriptionCount);
            object mailboxProperty4 = mailboxInformation.GetMailboxProperty(MailboxSchema.ExternalSharingContactSubscriptionCount);
            bool   flag             = this.IsExtendedPropertyInteresting(mailboxDisplayName, mailboxProperty) || this.IsExtendedPropertyInteresting(mailboxDisplayName, mailboxProperty2) || this.IsExtendedPropertyInteresting(mailboxDisplayName, mailboxProperty3) || this.IsExtendedPropertyInteresting(mailboxDisplayName, mailboxProperty4);
            object mailboxProperty5 = mailboxInformation.GetMailboxProperty(MailboxSchema.MailboxTypeDetail);
            object mailboxProperty6 = mailboxInformation.GetMailboxProperty(MailboxSchema.MailboxMiscFlags);

            if (mailboxProperty6 != null)
            {
                flag = (flag && (MailboxMiscFlags)mailboxProperty6 != MailboxMiscFlags.CreatedByMove);
            }
            CalendarSyncMailboxInterestingLogEntry calendarSyncMailboxInterestingLogEntry = new CalendarSyncMailboxInterestingLogEntry
            {
                MailboxGuid            = mailboxInformation.MailboxGuid,
                IsMailboxInteresting   = flag,
                ConsumerCalendarsCount = ((mailboxProperty == null) ? -1 : ((int)mailboxProperty)),
                ExternalCalendarsCount = ((mailboxProperty2 == null) ? -1 : ((int)mailboxProperty2)),
                InternetCalendarsCount = ((mailboxProperty3 == null) ? -1 : ((int)mailboxProperty3)),
                ExternalContactsCount  = ((mailboxProperty4 == null) ? -1 : ((int)mailboxProperty4)),
                MailboxType            = ((mailboxProperty5 == null) ? StoreMailboxTypeDetail.None : ((StoreMailboxTypeDetail)mailboxProperty5)),
                MailboxFlags           = ((mailboxProperty6 == null) ? MailboxMiscFlags.None : ((MailboxMiscFlags)mailboxProperty6))
            };

            AssistantsLog.LogMailboxInterestingEvent(Guid.Empty, "CalendarSyncAssistant", calendarSyncMailboxInterestingLogEntry.FormatCustomData(), mailboxInformation.MailboxGuid);
            return(flag);
        }
 // Token: 0x06000006 RID: 6 RVA: 0x000025C4 File Offset: 0x000007C4
 protected override void OnCustomCommandInternal(int command)
 {
     if (command != 206)
     {
         return;
     }
     AssistantsLog.Flush();
 }
        // Token: 0x06000004 RID: 4 RVA: 0x0000223C File Offset: 0x0000043C
        protected override void OnStartInternal(string[] args)
        {
            if (AssistantsService.debugBreakOnStart)
            {
                Debugger.Break();
            }
            using (Process currentProcess = Process.GetCurrentProcess())
            {
                Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStarting, null, new object[]
                {
                    currentProcess.Id,
                    "Microsoft Exchange",
                    "15.00.1497.010"
                });
            }
            AssistantsService.TracerPfd.TracePfd <int, DateTime>((long)this.GetHashCode(), "PFD IWS {0} Starting the Mailbox Assistants Service {1} ", 28055, DateTime.UtcNow);
            AssistantsLog.LogServiceStartEvent(this.activityId);
            bool flag = false;

            try
            {
                ADSession.DisableAdminTopologyMode();
                SettingOverrideSync.Instance.Start(true);
                ProcessAccessManager.RegisterComponent(SettingOverrideSync.Instance);
                AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Initializing the Assistant Infrastructure", 27479);
                this.databaseManager = new DatabaseManager("MSExchangeMailboxAssistants", 50, InfoworkerAssistants.CreateEventBasedAssistantTypes(), InfoworkerAssistants.CreateTimeBasedAssistantTypes(), true);
                this.databaseManager.Start();
                MailboxSearchServer.StartServer();
                Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStarted, null, new object[0]);
                AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Mailbox Assistants Service is started successfully ", 23959);
                if (Configuration.MemoryMonitorEnabled)
                {
                    this.memoryMonitor = new MemoryMonitor();
                    this.memoryMonitor.Start((ulong)Configuration.MemoryBarrierPrivateBytesUsageLimit, (uint)Configuration.MemoryBarrierNumberOfSamples, Configuration.MemoryBarrierSamplingDelay, Configuration.MemoryBarrierSamplingInterval, delegate(ulong memoryInUse)
                    {
                        Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceOutOfMemory, null, new object[]
                        {
                            memoryInUse
                        });
                        throw new ServiceOutOfMemoryException();
                    });
                }
                this.watermarkCleanupTimer = new Timer(new TimerCallback(InfoworkerAssistants.DeleteWatermarksForDisabledAndDeprecatedAssistants), null, Configuration.WatermarkCleanupInterval, Configuration.WatermarkCleanupInterval);
                ProcessAccessManager.RegisterComponent(this);
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceFailedToStart, null, new object[0]);
                }
            }
        }
 // Token: 0x06000005 RID: 5 RVA: 0x00002438 File Offset: 0x00000638
 protected override void OnStopInternal()
 {
     Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStopping, null, new object[0]);
     AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Stopping the Mailbox Assistants Service", 32151);
     if (this.memoryMonitor != null)
     {
         this.memoryMonitor.Stop();
     }
     if (this.watermarkCleanupTimer != null)
     {
         this.watermarkCleanupTimer.Dispose();
     }
     if (this.databaseManager != null)
     {
         try
         {
             GrayException.MapAndReportGrayExceptions(delegate()
             {
                 this.databaseManager.Stop();
             });
         }
         catch (GrayException arg)
         {
             AssistantsService.Tracer.TraceDebug <AssistantsService, GrayException>((long)this.GetHashCode(), "{0}: Gray Exception reported during shutdown: {1}", this, arg);
         }
         finally
         {
             this.databaseManager.Dispose();
         }
         AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} Stopping the Assistant Infrastructure", 17815);
     }
     MailboxSearchServer.StopServer();
     AssistantsLog.LogServiceStopEvent(this.activityId);
     AssistantsLog.Stop();
     MailboxAssistantsSlaReportLogFactory.StopAll();
     using (Process currentProcess = Process.GetCurrentProcess())
     {
         Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ServiceStopped, null, new object[]
         {
             currentProcess.Id,
             "Microsoft Exchange",
             "15.00.1497.010"
         });
     }
     ProcessAccessManager.UnregisterComponent(this);
     ProcessAccessManager.UnregisterComponent(SettingOverrideSync.Instance);
     SettingOverrideSync.Instance.Stop();
     AssistantsService.TracerPfd.TracePfd <int>((long)this.GetHashCode(), "PFD IWS {0} The Mailbox Assistants Service Stopped successfully", 21911);
 }
 // Token: 0x0600086D RID: 2157 RVA: 0x0003AB14 File Offset: 0x00038D14
 public List <KeyValuePair <string, object> > LogAllData(MailboxSession mailboxSession, string parameters)
 {
     if (this.Exception != null)
     {
         SharingSyncAssistantLog.LogEntry(mailboxSession, "CalendarSyncAssistantHelper.ProcessFolder with parameter {0} hit the following exception: {1}", new object[]
         {
             parameters,
             this.Exception
         });
     }
     if (this.IsDeadlineExpired)
     {
         SharingSyncAssistantLog.LogEntry(mailboxSession, "Deadline expired before processing all folders. Processed {0}/{1} folders. MaxSyncTime: {2}", new object[]
         {
             this.NumOfFoldersActuallySynced,
             this.NumOfFoldersToSync,
             this.MaxTimeoutValue
         });
     }
     if (this.FolderDetailLoglines != null)
     {
         foreach (CalendarSyncFolderOperationLogEntry calendarSyncFolderOperationLogEntry in this.FolderDetailLoglines)
         {
             List <KeyValuePair <string, object> > list = calendarSyncFolderOperationLogEntry.FormatCustomData();
             AssistantsLog.LogFolderSyncOperationEvent(calendarSyncFolderOperationLogEntry.ActivityId, "CalendarSyncAssistant", list);
             this.AddExtendedProperty("FolderFullyProcessed", calendarSyncFolderOperationLogEntry.FolderType, calendarSyncFolderOperationLogEntry.FolderId, calendarSyncFolderOperationLogEntry.IsSyncSuccess);
             this.PostFolderDetailsToQuickLogs(mailboxSession, calendarSyncFolderOperationLogEntry, string.Join <KeyValuePair <string, object> >(";", list.ToArray()));
             if (calendarSyncFolderOperationLogEntry.SanitizedStackTraces != null && calendarSyncFolderOperationLogEntry.SanitizedStackTraces.Count > 0)
             {
                 foreach (List <KeyValuePair <string, object> > customData in calendarSyncFolderOperationLogEntry.SanitizedStackTraces)
                 {
                     AssistantsLog.LogFolderSyncExceptionEvent(calendarSyncFolderOperationLogEntry.ActivityId, "CalendarSyncAssistant", customData);
                 }
             }
         }
     }
     return(this.FormatCustomData());
 }