Example #1
0
        private string ReadMailboxTableProperties(MailboxSession archiveSession)
        {
            string result = string.Empty;

            archiveSession.Mailbox.Load(TestArchiveConnectivityTask.mailboxExtendedProperties);
            object[] properties = archiveSession.Mailbox.GetProperties(TestArchiveConnectivityTask.mailboxExtendedProperties);
            int      num        = 0;

            foreach (PropertyDefinition propertyDefinition in TestArchiveConnectivityTask.mailboxExtendedProperties)
            {
                if (!(properties[num] is PropertyError))
                {
                    if (propertyDefinition.Name.Equals(MailboxSchema.ControlDataForElcAssistant.Name))
                    {
                        if (propertyDefinition.Type.Equals(typeof(byte[])))
                        {
                            byte[]      serializedData = (byte[])properties[num];
                            ControlData controlData    = ControlData.CreateFromByteArray(serializedData);
                            result = controlData.LastProcessedDate.ToString("MMMM dd yyyy hh:mm tt") + " - GMT";
                            break;
                        }
                        break;
                    }
                    else
                    {
                        result = "No Last Processed time found for the mailbox.";
                    }
                }
                num++;
            }
            return(result);
        }
        // Token: 0x06001265 RID: 4709 RVA: 0x00069E50 File Offset: 0x00068050
        public bool IsMailboxInteresting(MailboxInformation mailboxInformation)
        {
            OABGeneratorAssistantType.Tracer.TraceFunction((long)this.GetHashCode(), "OABGeneratorAssistantType.IsMailboxInteresting");
            OABGeneratorAssistantType.Tracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "OABGeneratorAssistantType.IsMailboxInteresting: Processing mailbox {0} ({1})", mailboxInformation.DisplayName, mailboxInformation.MailboxGuid);
            bool   result          = false;
            object mailboxProperty = mailboxInformation.GetMailboxProperty(this.ControlDataPropertyDefinition);

            if (mailboxProperty == null || mailboxProperty is PropertyError)
            {
                OABGeneratorAssistantType.Tracer.TraceDebug((long)this.GetHashCode(), "OABGeneratorAssistantType.IsMailboxInteresting: Control data property is null or property error; mailbox is not interesting");
            }
            else
            {
                ControlData controlData = ControlData.CreateFromByteArray(mailboxProperty as byte[]);
                OABGeneratorAssistantType.Tracer.TraceDebug <DateTime, TimeSpan>((long)this.GetHashCode(), "OABGeneratorAssistantType.IsMailboxInteresting: ControlData.LastProcessedDate = {0}; WorkCycle = {1}", controlData.LastProcessedDate, this.WorkCycle);
                if (DateTime.UtcNow - controlData.LastProcessedDate > TimeSpan.FromTicks(this.WorkCycle.Ticks / 2L))
                {
                    OABGeneratorAssistantType.Tracer.TraceDebug((long)this.GetHashCode(), "OABGeneratorAssistantType.IsMailboxInteresting: mailbox has not been processed within half-workcycle; it is interesting");
                    result = true;
                }
                else
                {
                    OABGeneratorAssistantType.Tracer.TraceDebug((long)this.GetHashCode(), "OABGeneratorAssistantType.IsMailboxInteresting: mailbox has been processed within half-workcycle; it is not interesting");
                    result = false;
                }
            }
            return(result);
        }
        // Token: 0x060014DA RID: 5338 RVA: 0x00077B10 File Offset: 0x00075D10
        public bool IsMailboxInteresting(MailboxInformation mailboxInformation)
        {
            if (Interlocked.Read(ref this.MaxNumberOfInterestingMailboxesForWorkCycleCheckpoint) == -1L)
            {
                this.CalculateMaxNumberOfInterestingMailboxesInWorkCycle();
            }
            bool flag = mailboxInformation.LastLogonTime <= DateTime.UtcNow - SharePointSignalStoreAssistantType.AllowedInactivity;

            if (flag)
            {
                return(false);
            }
            object mailboxProperty = mailboxInformation.GetMailboxProperty(this.ControlDataPropertyDefinition);
            bool   flag2           = mailboxProperty == null || mailboxProperty is PropertyError;

            if (flag2)
            {
                Interlocked.Increment(ref this.NumberOfInterestingMailboxesForWorkCycleCheckpoint);
                return(true);
            }
            ControlData controlData = ControlData.CreateFromByteArray(mailboxProperty as byte[]);
            bool        flag3       = DateTime.UtcNow - controlData.LastProcessedDate <= this.WorkCycle - this.WorkCycleCheckpoint;

            if (flag3)
            {
                return(false);
            }
            bool flag4 = Interlocked.Read(ref this.NumberOfInterestingMailboxesForWorkCycleCheckpoint) >= Interlocked.Read(ref this.MaxNumberOfInterestingMailboxesForWorkCycleCheckpoint);

            if (flag4)
            {
                return(false);
            }
            Interlocked.Increment(ref this.NumberOfInterestingMailboxesForWorkCycleCheckpoint);
            return(true);
        }