private void UpdateIdleWatermarksForAssistant(Guid[] idleMailboxes, Guid assistantId)
        {
            long num = base.DatabaseBookmark[assistantId];

            Watermark[] array = new Watermark[idleMailboxes.Length];
            for (int i = 0; i < idleMailboxes.Length; i++)
            {
                array[i] = Watermark.GetMailboxWatermark(idleMailboxes[i], num);
            }
            ExTraceGlobals.EventControllerTracer.TraceDebug((long)this.GetHashCode(), "{0}: Updating {1} watermarks for idle mailboxes to value {2} for consumer {3}", new object[]
            {
                this,
                idleMailboxes.Length,
                num,
                assistantId
            });
            try
            {
                base.EventAccess.SaveWatermarks(assistantId, array);
            }
            catch (MapiExceptionPartialCompletion arg)
            {
                ExTraceGlobals.EventControllerTracer.TraceError <EventControllerPrivate, int, MapiExceptionPartialCompletion>((long)this.GetHashCode(), "{0}: Tried to save {1} watermarks. Some mailboxes no longer exist on this database: {2}", this, array.Length, arg);
            }
        }
        // Token: 0x06000266 RID: 614 RVA: 0x0000D41C File Offset: 0x0000B61C
        public Watermark GetCurrentWatermark(ref long databaseWatermark)
        {
            ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate>((long)this.GetHashCode(), "{0}: GetCurrentWatermark", this);
            Watermark result;

            lock (base.Locker)
            {
                long num = this.committedWatermark;
                if (this.IsMailboxDead)
                {
                    ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate>((long)this.GetHashCode(), "{0}: Not writing watermark for dead mailbox", this);
                    result = null;
                }
                else
                {
                    InterestingEvent interestingEvent;
                    if (base.ActiveQueue.Count > 0)
                    {
                        interestingEvent = base.ActiveQueue[0];
                    }
                    else if (base.PendingQueue.Count > 0)
                    {
                        interestingEvent = base.PendingQueue[0];
                    }
                    else
                    {
                        interestingEvent = null;
                    }
                    if (this.IsInRetry)
                    {
                        if (interestingEvent == null)
                        {
                            ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate>((long)this.GetHashCode(), "{0}: Not writing watermark for retry mailbox with empty queue", this);
                        }
                        else
                        {
                            num = interestingEvent.MapiEvent.EventCounter - 1L;
                        }
                    }
                    else
                    {
                        if (interestingEvent == null)
                        {
                            num = Math.Max(databaseWatermark, this.committedWatermark);
                        }
                        else
                        {
                            num = interestingEvent.MapiEvent.EventCounter - 1L;
                        }
                        if (num < databaseWatermark)
                        {
                            ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: lowering databaseWatermark to {1}", this, num);
                            databaseWatermark = num;
                        }
                    }
                    if (this.committedWatermark != num)
                    {
                        ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long, long>((long)this.GetHashCode(), "{0}: Will update watermark for mailbox from {1} to {2}", this, this.committedWatermark, num);
                        result = Watermark.GetMailboxWatermark(this.MailboxGuid, num);
                    }
                    else
                    {
                        ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: Watermark has not changed from {1}.", this, num);
                        result = null;
                    }
                }
            }
            return(result);
        }