Пример #1
0
        // Token: 0x0600166C RID: 5740 RVA: 0x0007E508 File Offset: 0x0007C708
        internal static List <ExDateRange> ConvertHoursToDateRanges(ExDateTime referenceTime, Hours hours, StorageWorkingHours workingHours, int days)
        {
            ExTraceGlobals.HeuristicsTracer.TraceFunction(0L, "WorkingHoursAwareReminderTimeCalculator.ConvertHoursToDateRanges");
            ExTraceGlobals.HeuristicsTracer.TraceInformation <Hours, StorageWorkingHours, int>(0, 0L, "Hours: '{0}'; WorkingHours: '{1}'; Days: '{2}'", hours, workingHours, days);
            List <ExDateRange> list        = new List <ExDateRange>();
            ExDateRange        exDateRange = new ExDateRange(referenceTime.ToUtc(), referenceTime.AddDays((double)days).ToUtc());

            if (workingHours == null)
            {
                ExTraceGlobals.HeuristicsTracer.TraceInformation(0, 0L, "User WorkingHours unavailable");
                hours = Hours.Any;
            }
            switch (hours)
            {
            case Hours.Personal:
                list = ExDateRange.SubtractRanges(exDateRange, WorkingHoursAwareReminderTimeCalculator.ConvertHoursToDateRanges(referenceTime, Hours.Working, workingHours, days));
                break;

            case Hours.Working:
                for (int i = 0; i < days; i++)
                {
                    ExDateTime date = referenceTime.AddDays((double)i).Date;
                    if (workingHours.IsWorkingDay(date.DayOfWeek))
                    {
                        list.Add(new ExDateRange(date.AddMinutes((double)workingHours.StartTimeInMinutes).ToUtc(), date.AddMinutes((double)workingHours.EndTimeInMinutes).ToUtc()));
                    }
                }
                break;

            case Hours.Any:
                list.Add(exDateRange);
                break;
            }
            return(list);
        }
Пример #2
0
        public ExDateTime GetLastScheduledTime()
        {
            if (this.Mode == ScheduleMode.Never)
            {
                return(Schedule.MinimumValidDateTime);
            }
            if (this.Mode == ScheduleMode.Always)
            {
                return(ExDateTime.Now);
            }
            ExDateTime now   = ExDateTime.Now;
            TimeSpan   value = TimeSpan.MaxValue;

            foreach (ScheduleInterval scheduleInterval in this.Intervals)
            {
                ExDateTime value2 = new ExDateTime(ExTimeZone.CurrentTimeZone, now.Year, now.Month, now.Day, scheduleInterval.StartHour, scheduleInterval.StartMinute, 0);
                int        num    = scheduleInterval.StartDay - now.DayOfWeek;
                if (num > 0 || (num == 0 && scheduleInterval.StartHour > now.Hour) || (num == 0 && scheduleInterval.StartHour == now.Hour && scheduleInterval.StartMinute >= now.Minute))
                {
                    num -= 7;
                }
                value2 = value2.AddDays((double)num);
                TimeSpan timeSpan = now.Subtract(value2);
                if (timeSpan.Ticks < value.Ticks)
                {
                    value = timeSpan;
                }
            }
            return(now.Subtract(value));
        }
Пример #3
0
        internal string GetFreeBusyByDay(Duration timeWindow, ExTimeZone timeZone)
        {
            ExDateTime windowStart = new ExDateTime(timeZone, timeWindow.StartTime);
            ExDateTime exDateTime  = new ExDateTime(timeZone, timeWindow.EndTime);
            int        num         = (int)(exDateTime.Date - windowStart.Date).TotalDays + 1;

            char[] array = new char[num];
            char   c     = (base.ExceptionInfo != null) ? '5' : '0';

            for (int i = 0; i < num; i++)
            {
                array[i] = c;
            }
            if (this.CalendarEventArray != null)
            {
                for (int j = 0; j < this.CalendarEventArray.Length; j++)
                {
                    CalendarEvent calendarEvent = this.CalendarEventArray[j];
                    ExDateTime    exDateTime2   = new ExDateTime(timeZone, calendarEvent.StartTime.Date);
                    ExDateTime    t             = new ExDateTime(timeZone, calendarEvent.EndTime.Date);
                    while (exDateTime2 < t)
                    {
                        this.AddEventTime(array, windowStart, exDateTime2, calendarEvent.BusyType);
                        exDateTime2 = exDateTime2.AddDays(1.0);
                    }
                    if (calendarEvent.EndTime.TimeOfDay != TimeSpan.Zero)
                    {
                        this.AddEventTime(array, windowStart, new ExDateTime(timeZone, calendarEvent.EndTime), calendarEvent.BusyType);
                    }
                }
            }
            return(new string(array));
        }
Пример #4
0
        public SuggestionDayResult[] GetSuggestionsByDateRange(ExDateTime startDate, ExDateTime endDate, ExTimeZone timeZone, int inputMeetingDuration, AttendeeData[] attendees)
        {
            this.meetingDuration = inputMeetingDuration;
            MeetingSuggester.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: Entering MeetingSuggester.GetSuggestionsByDateRange()", new object[]
            {
                TraceContext.Get()
            });
            MeetingSuggester.Tracer.TraceDebug((long)this.GetHashCode(), "{0}: startDate={1}, endDate={2}, inputMeetingDuration={3}", new object[]
            {
                TraceContext.Get(),
                startDate,
                endDate,
                inputMeetingDuration
            });
            this.ValidateAndProcessInput(startDate, endDate, inputMeetingDuration, attendees);
            List <SuggestionDayResult> list = new List <SuggestionDayResult>();
            ExDateTime exDateTime           = startDate;

            while (exDateTime < endDate)
            {
                list.Add(new SuggestionDayResult(exDateTime, this.meetingDuration, this.requiredAttendeeCount, this.optionalAttendeeCount, attendees, this.options, this.currentMeetingTime));
                exDateTime = exDateTime.AddDays(1.0);
            }
            return(list.ToArray());
        }
Пример #5
0
        internal SuggestionDayResult(ExDateTime currentDate, int inputMeetingDuration, int requiredAttendeeCount, int optionalAttendeeCount, AttendeeData[] attendees, ConfigOptions options, ExDateTime currentMeetingTime)
        {
            this.date = currentDate.LocalTime;
            ExDateTime        t          = ExDateTime.Now.ToUtc();
            List <Suggestion> list       = new List <Suggestion>();
            ExDateTime        t2         = currentDate.AddDays(1.0);
            ExDateTime        exDateTime = currentDate.ToUtc();

            while (exDateTime < t2)
            {
                if (exDateTime >= t || exDateTime == currentMeetingTime)
                {
                    list.Add(new Suggestion(currentDate.TimeZone.ConvertDateTime(exDateTime), inputMeetingDuration, requiredAttendeeCount, optionalAttendeeCount, attendees, options));
                }
                exDateTime = exDateTime.AddMinutes((double)options.SuggestionInterval);
            }
            this.rawSuggestionsList = list.ToArray();
            this.FilterSuggestions(list, options, currentMeetingTime);
            foreach (Suggestion suggestion in list)
            {
                if (suggestion.SuggestionQuality < this.quality)
                {
                    this.quality = suggestion.SuggestionQuality;
                }
            }
            this.meetingSuggestions = list.ToArray();
        }
        private void GetStartEndDateForReportingPeriod(ReportingPeriod reportingPeriod, out ExDateTime startDateTime, out ExDateTime endDateTime)
        {
            startDateTime = ExDateTime.MinValue;
            endDateTime   = ExDateTime.MaxValue;
            ExDateTime date = ExDateTime.UtcNow.Date;

            switch (reportingPeriod)
            {
            case ReportingPeriod.Today:
                startDateTime = date;
                endDateTime   = startDateTime.Add(TimeSpan.FromDays(1.0)).Subtract(TimeSpan.FromMinutes(1.0));
                return;

            case ReportingPeriod.Yesterday:
                startDateTime = date.Subtract(TimeSpan.FromDays(1.0));
                endDateTime   = startDateTime.AddDays(1.0).Subtract(TimeSpan.FromMinutes(1.0));
                return;

            case ReportingPeriod.LastWeek:
                startDateTime = date.Subtract(TimeSpan.FromDays((double)(7 + date.DayOfWeek)));
                endDateTime   = date.Subtract(TimeSpan.FromDays((double)date.DayOfWeek)).Subtract(TimeSpan.FromMinutes(1.0));
                return;

            case ReportingPeriod.LastMonth:
                startDateTime = GetAvailabilityReport <TIdentity> .SubtractMonths(date, 1);

                endDateTime = GetAvailabilityReport <TIdentity> .GetLastMonthLastDate(date);

                return;

            case ReportingPeriod.Last3Months:
                startDateTime = GetAvailabilityReport <TIdentity> .SubtractMonths(date, 3);

                endDateTime = GetAvailabilityReport <TIdentity> .GetLastMonthLastDate(date);

                return;

            case ReportingPeriod.Last6Months:
                startDateTime = GetAvailabilityReport <TIdentity> .SubtractMonths(date, 6);

                endDateTime = GetAvailabilityReport <TIdentity> .GetLastMonthLastDate(date);

                return;

            case ReportingPeriod.Last12Months:
                startDateTime = GetAvailabilityReport <TIdentity> .SubtractMonths(date, 12);

                endDateTime = GetAvailabilityReport <TIdentity> .GetLastMonthLastDate(date);

                return;

            default:
                base.WriteError(new ArgumentException(Strings.InvalidReportingPeriod), (ErrorCategory)1000, null);
                return;
            }
        }
Пример #7
0
        public static ExDateTime GetFutureTimestamp(ExDateTime startTime, int afterMinimumDays, DayOfWeek onDayOfWeek, TimeSpan atTimeOfDay, ExTimeZone localTimeZone)
        {
            ExDateTime exDateTime  = localTimeZone.ConvertDateTime(startTime);
            int        num         = (exDateTime.TimeOfDay > atTimeOfDay) ? 1 : 0;
            ExDateTime exDateTime2 = exDateTime.AddDays((double)(afterMinimumDays + num));
            int        num2        = onDayOfWeek - exDateTime2.DayOfWeek;

            if (num2 < 0)
            {
                num2 += 7;
            }
            return(exDateTime2.AddDays((double)num2).Date.Add(atTimeOfDay).ToUtc());
        }
Пример #8
0
        public static void GetStartEndDateForReportingPeriod(ReportingPeriod reportingPeriod, out ExDateTime startDateTime, out ExDateTime endDateTime)
        {
            ExDateTime date = ExDateTime.UtcNow.Date;

            switch (reportingPeriod)
            {
            case ReportingPeriod.Today:
                startDateTime = date;
                endDateTime   = startDateTime.Add(TimeSpan.FromDays(1.0)).Subtract(TimeSpan.FromSeconds(1.0));
                return;

            case ReportingPeriod.Yesterday:
                startDateTime = date.Subtract(TimeSpan.FromDays(1.0));
                endDateTime   = startDateTime.AddDays(1.0).Subtract(TimeSpan.FromSeconds(1.0));
                return;

            case ReportingPeriod.LastWeek:
                startDateTime = date.Subtract(TimeSpan.FromDays((double)(7 + date.DayOfWeek)));
                endDateTime   = date.Subtract(TimeSpan.FromDays((double)date.DayOfWeek)).Subtract(TimeSpan.FromSeconds(1.0));
                return;

            case ReportingPeriod.LastMonth:
                startDateTime = Utils.SubtractMonths(date, 1);
                endDateTime   = Utils.GetLastMonthLastDate(date);
                return;

            case ReportingPeriod.Last3Months:
                startDateTime = Utils.SubtractMonths(date, 3);
                endDateTime   = Utils.GetLastMonthLastDate(date);
                return;

            case ReportingPeriod.Last6Months:
                startDateTime = Utils.SubtractMonths(date, 6);
                endDateTime   = Utils.GetLastMonthLastDate(date);
                return;

            case ReportingPeriod.Last12Months:
                startDateTime = Utils.SubtractMonths(date, 12);
                endDateTime   = Utils.GetLastMonthLastDate(date);
                return;

            default:
                throw new ArgumentException(Strings.InvalidReportingPeriod);
            }
        }
Пример #9
0
        public static IEnumerable <StartEndDateTimePair> GetAllDaysInGivenRange(ExDateTime startDate, ExDateTime endDate)
        {
            List <StartEndDateTimePair> list = new List <StartEndDateTimePair>();

            if (endDate.Date < startDate.Date)
            {
                throw new ArgumentException(Strings.InvalidTimeRange, "StartDate");
            }
            if (endDate.Date == startDate.Date)
            {
                list.Add(new StartEndDateTimePair(startDate.Date, startDate.Date.AddDays(1.0).Subtract(TimeSpan.FromSeconds(1.0))));
            }
            else if (endDate.Date > startDate.Date)
            {
                ExDateTime t = startDate.Date;
                while (t <= endDate.Date)
                {
                    list.Add(new StartEndDateTimePair(t.Date, t.Date.AddDays(1.0).Subtract(TimeSpan.FromSeconds(1.0))));
                    t = t.AddDays(1.0);
                }
            }
            return(list);
        }
Пример #10
0
        internal static void ApplyPolicy(MailboxSession mailboxSession, object policy, object flags, object period, object archivePolicy, object archivePeriod, object compactDefaultPolicy, MessageItem messageItem, bool keepRetentionTag)
        {
            if (policy == null && compactDefaultPolicy == null)
            {
                using (Folder folder = Folder.Bind(mailboxSession, messageItem.ParentId, new PropertyDefinition[]
                {
                    StoreObjectSchema.PolicyTag,
                    StoreObjectSchema.RetentionPeriod,
                    StoreObjectSchema.RetentionFlags,
                    StoreObjectSchema.ArchiveTag,
                    StoreObjectSchema.ArchivePeriod,
                    FolderSchema.RetentionTagEntryId
                }))
                {
                    RetentionTagHelper.ReadPolicyFromFolder(folder, out policy, out flags, out period, out archivePolicy, out archivePeriod, out compactDefaultPolicy);
                }
            }
            bool       flag  = false;
            bool       flag2 = false;
            ExDateTime d     = messageItem.ReceivedTime;

            if (d == ExDateTime.MinValue)
            {
                d = messageItem.SentTime;
                if (d == ExDateTime.MinValue)
                {
                    d = ExDateTime.Now;
                }
            }
            if (archivePolicy != null && archivePolicy is byte[] && archivePeriod != null && archivePeriod is int)
            {
                flag2 = true;
            }
            if (policy != null && policy is byte[] && period != null && period is int)
            {
                flag = true;
            }
            if (flag2)
            {
                try
                {
                    messageItem[ItemSchema.ArchiveDate] = d.AddDays((double)((int)archivePeriod));
                }
                catch (ArgumentOutOfRangeException)
                {
                    messageItem[ItemSchema.ArchiveDate] = DateTime.MaxValue;
                }
                messageItem[StoreObjectSchema.ArchiveTag] = (archivePolicy as byte[]);
            }
            else
            {
                messageItem.DeleteProperties(new PropertyDefinition[]
                {
                    StoreObjectSchema.ArchiveTag
                });
                messageItem.DeleteProperties(new PropertyDefinition[]
                {
                    ItemSchema.ArchiveDate
                });
            }
            Guid guid;
            int  num;

            RetentionTagHelper.GetDefaultPolicyInfo(mailboxSession, messageItem, compactDefaultPolicy, out guid, out num);
            if (!keepRetentionTag)
            {
                if (flag)
                {
                    try
                    {
                        messageItem[ItemSchema.RetentionDate] = d.AddDays((double)((int)period));
                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        messageItem[ItemSchema.RetentionDate] = DateTime.MaxValue;
                    }
                    messageItem[StoreObjectSchema.PolicyTag] = (policy as byte[]);
                }
                else
                {
                    if (num > 0)
                    {
                        try
                        {
                            messageItem[ItemSchema.RetentionDate] = d.AddDays((double)num);
                            goto IL_223;
                        }
                        catch (ArgumentOutOfRangeException)
                        {
                            messageItem[ItemSchema.RetentionDate] = DateTime.MaxValue;
                            goto IL_223;
                        }
                    }
                    messageItem.DeleteProperties(new PropertyDefinition[]
                    {
                        ItemSchema.RetentionDate
                    });
IL_223:
                    if (!guid.Equals(Guid.Empty))
                    {
                        messageItem[StoreObjectSchema.PolicyTag] = guid.ToByteArray();
                    }
                    else
                    {
                        messageItem.DeleteProperties(new PropertyDefinition[]
                        {
                            StoreObjectSchema.PolicyTag
                        });
                        if (!flag2)
                        {
                            return;
                        }
                    }
                }
            }
            else if (!flag2)
            {
                return;
            }
            CompositeProperty compositeProperty = new CompositeProperty(num, d.UniversalTime);

            messageItem[ItemSchema.StartDateEtc]          = compositeProperty.GetBytes(true);
            messageItem[StoreObjectSchema.RetentionFlags] = 0;
        }
Пример #11
0
        // Token: 0x06000E0C RID: 3596 RVA: 0x00054E78 File Offset: 0x00053078
        protected override void InvokeInternal(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            MailboxSession mailboxSession = invokeArgs.StoreSession as MailboxSession;

            if (mailboxSession == null)
            {
                return;
            }
            if (mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.UserMailbox && mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.LinkedMailbox && mailboxSession.MailboxOwner.RecipientTypeDetails != RecipientTypeDetails.GroupMailbox)
            {
                CalendarRepairAssistant.CachedStateTracer.TraceDebug <Guid, string, string>((long)this.GetHashCode(), "Skipping mailbox with guid {0} and display name {1} since this is a {2} and not a UserMailbox or a LinkedMailbox", mailboxSession.MailboxGuid, mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxOwner.RecipientTypeDetails.ToString());
                return;
            }
            ExDateTime  now         = ExDateTime.Now;
            ExDateTime  rangeStart  = now.AddDays((double)(-(double)this.RepairPolicy.DaysInWindowBackward));
            ExDateTime  rangeEnd    = now.AddDays((double)this.RepairPolicy.DaysInWindowForward);
            CachedState cachedState = AssistantsService.CachedObjectsList.GetCachedState(mailboxSession.MailboxGuid);
            bool        flag        = ResourceCheck.DetailedCheckForAutomatedBooking(mailboxSession, cachedState);

            if (flag)
            {
                CalendarRepairAssistant.CachedStateTracer.TraceDebug((long)this.GetHashCode(), "{0}: Calendar Repair Assistant is skipping resource mailbox.", new object[]
                {
                    TraceContext.Get()
                });
                return;
            }
            CalendarRepairAssistantLogEntry calendarRepairAssistantLogEntry = new CalendarRepairAssistantLogEntry
            {
                DatabaseGuid   = mailboxSession.MailboxOwner.MailboxInfo.GetDatabaseGuid(),
                MailboxGuid    = mailboxSession.MailboxGuid,
                TenantGuid     = mailboxSession.MailboxOwner.MailboxInfo.OrganizationId.GetTenantGuid(),
                RepairMode     = this.RepairPolicy.RepairMode.ToString(),
                RangeStartTime = string.Format("{0:O}", rangeStart.ToUtc()),
                RangeEndTime   = string.Format("{0:O}", rangeEnd.ToUtc())
            };

            this.MarkMailboxForUpgrade(mailboxSession, calendarRepairAssistantLogEntry);
            try
            {
                CalendarRepairAssistant.CachedStateTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Calendar Repair Assistant starting to validate mailbox: {1}.", TraceContext.Get(), mailboxSession.MailboxOwner.MailboxInfo.DisplayName);
                CalendarValidator calendarValidator = CalendarValidator.CreateRepairingInstance(mailboxSession, rangeStart, rangeEnd, this.RepairPolicy, CalendarRepairAssistant.cvsPopulationTimeout);
                calendarValidator.OnItemInspected += this.incrementTotalItemsInspected;
                calendarValidator.OnItemRepaired  += this.incrementTotalItemsRepaired;
                List <MeetingValidationResult> validationResults = calendarValidator.Run();
                calendarValidator.OnItemInspected -= this.incrementTotalItemsInspected;
                calendarValidator.OnItemRepaired  -= this.incrementTotalItemsRepaired;
                calendarRepairAssistantLogEntry.AddValidationResults(validationResults);
                CalendarRepairLogger.Instance.Log(validationResults, mailboxSession.MailboxOwner, rangeStart, rangeEnd);
                if (CalendarRepairAssistant.IsCRAReliabilityLoggerEnabled(mailboxSession))
                {
                    CalendarReliabilityInsigntLogger.Instance.Log(calendarRepairAssistantLogEntry, validationResults);
                }
                CalendarRepairAssistant.CachedStateTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Calendar Repair Assistant completed validating mailbox: {1}.", TraceContext.Get(), mailboxSession.MailboxOwner.MailboxInfo.DisplayName);
            }
            catch (WrongServerException ex)
            {
                string message = string.Format("Could not access the mailbox (ExchangePrincipal:'{0}'). Exception: {1}.", mailboxSession.MailboxOwner, ex);
                CalendarRepairAssistant.Tracer.TraceDebug((long)this.GetHashCode(), message);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex);
            }
            catch (MailboxUserNotFoundException ex2)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <MailboxUserNotFoundException>((long)this.GetHashCode(), "MailboxUserNotFoundException:{0}", ex2);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex2);
            }
            catch (CorruptDataException ex3)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <CorruptDataException>((long)this.GetHashCode(), "CorruptDataException:{0}", ex3);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex3);
            }
            catch (SubmissionQuotaExceededException ex4)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <SubmissionQuotaExceededException>((long)this.GetHashCode(), "SubmissionQuotaExceededException:{0}", ex4);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex4);
            }
            catch (StoragePermanentException ex5)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <StoragePermanentException>((long)this.GetHashCode(), "StoragePermanentException:{0}", ex5);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex5);
            }
            catch (Exception ex6)
            {
                CalendarRepairAssistant.Tracer.TraceDebug <Exception>((long)this.GetHashCode(), "Exception:{0}", ex6);
                calendarRepairAssistantLogEntry.AddExceptionToLog(ex6);
                throw ex6;
            }
            finally
            {
                stopwatch.Stop();
                calendarRepairAssistantLogEntry.TotalProcessingTime = stopwatch.Elapsed.TotalMilliseconds.ToString();
                customDataToLog.AddRange(calendarRepairAssistantLogEntry.FormatCustomData());
            }
        }
Пример #12
0
 protected override void ProcessMailbox()
 {
     try
     {
         ExDateTime   exDateTime    = this.Date.ToUtc();
         ExDateTime   startDateTime = new ExDateTime(ExTimeZone.UtcTimeZone, exDateTime.Year, exDateTime.Month, exDateTime.Day);
         ExDateTime   endDateTime   = startDateTime.AddDays(1.0);
         StreamWriter streamWriter  = new StreamWriter(this.ClientStream, Encoding.UTF8);
         streamWriter.WriteCsvLine(this.csvRow.Keys);
         using (IUMCallDataRecordStorage umcallDataRecordsAcessor = InterServerMailboxAccessor.GetUMCallDataRecordsAcessor(this.DataObject))
         {
             int num = 0;
             int numberOfRecordsToRead = 5000;
             if (Utils.RunningInTestMode)
             {
                 numberOfRecordsToRead = 1;
             }
             bool flag;
             do
             {
                 flag = false;
                 CDRData[] umcallDataRecords = umcallDataRecordsAcessor.GetUMCallDataRecords(startDateTime.Subtract(this.TimeDelta), endDateTime.Add(this.TimeDelta), num, numberOfRecordsToRead);
                 if (umcallDataRecords != null && umcallDataRecords.Length > 0)
                 {
                     num += umcallDataRecords.Length;
                     this.WriteToStream(umcallDataRecords, streamWriter, startDateTime, endDateTime);
                     flag = true;
                 }
                 streamWriter.Flush();
             }while (flag);
         }
     }
     catch (ArgumentException exception)
     {
         base.WriteError(exception, ErrorCategory.InvalidArgument, null);
     }
     catch (ObjectDisposedException exception2)
     {
         base.WriteError(exception2, ErrorCategory.InvalidArgument, null);
     }
     catch (IOException exception3)
     {
         base.WriteError(exception3, ErrorCategory.WriteError, null);
     }
     catch (UnableToFindUMReportDataException exception4)
     {
         base.WriteError(exception4, ErrorCategory.ReadError, null);
     }
     catch (StorageTransientException exception5)
     {
         base.WriteError(exception5, ErrorCategory.ReadError, null);
     }
     catch (StoragePermanentException exception6)
     {
         base.WriteError(exception6, ErrorCategory.ReadError, null);
     }
     catch (HttpException exception7)
     {
         base.WriteError(exception7, ErrorCategory.WriteError, null);
     }
     catch (CDROperationException exception8)
     {
         base.WriteError(exception8, ErrorCategory.ReadError, null);
     }
     catch (EWSUMMailboxAccessException exception9)
     {
         base.WriteError(exception9, ErrorCategory.ReadError, null);
     }
 }
Пример #13
0
        // Token: 0x0600166D RID: 5741 RVA: 0x0007E618 File Offset: 0x0007C818
        internal static ExDateRange ConvertReminderTimeHintToExDateRange(ReminderTimeHint hint, ExDateTime referenceTime, ReminderTimeCalculatorContext context)
        {
            ExTraceGlobals.HeuristicsTracer.TraceFunction(0L, "WorkingHoursAwareReminderTimeCalculator.ConvertReminderTimeHintToExDateRange");
            ExTraceGlobals.HeuristicsTracer.TraceInformation <ReminderTimeHint, ExDateTime, DayOfWeek>(0, 0L, "ReminderTimeHint : '{0}'; ReferenceTime : '{1}'; StartOfWeek: '{2}'", hint, referenceTime, context.StartOfWeek);
            ExDateRange exDateRange;

            switch (hint)
            {
            case ReminderTimeHint.LaterToday:
                exDateRange = new ExDateRange(referenceTime.Add(WorkingHoursAwareReminderTimeCalculator.RemindLaterMinOffsetTimeSpan).ToUtc(), referenceTime.Add(WorkingHoursAwareReminderTimeCalculator.RemindLaterMinOffsetTimeSpan).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc());
                goto IL_496;

            case ReminderTimeHint.Tomorrow:
                exDateRange = new ExDateRange(referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayStartTimeSpan).ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc());
                goto IL_496;

            case ReminderTimeHint.TomorrowMorning:
                exDateRange = new ExDateRange(referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.MorningStartTimeSpan).ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.MorningEndTimeSpan).ToUtc());
                goto IL_496;

            case ReminderTimeHint.TomorrowAfternoon:
                exDateRange = new ExDateRange(referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.AfternoonStartTimeSpan).ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.AfternoonEndTimeSpan).ToUtc());
                goto IL_496;

            case ReminderTimeHint.TomorrowEvening:
                exDateRange = new ExDateRange(referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.EveningStartTimeSpan).ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.EveningEndTimeSpan).ToUtc());
                goto IL_496;

            case ReminderTimeHint.ThisWeekend:
            {
                int num = WorkingHoursAwareReminderTimeCalculator.DaysTilNextOccurrence(referenceTime, DayOfWeek.Saturday);
                if (num == 7)
                {
                    return(new ExDateRange(referenceTime.ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc()));
                }
                if (num == 6)
                {
                    return(new ExDateRange(referenceTime.ToUtc(), referenceTime.Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc()));
                }
                return(new ExDateRange(referenceTime.AddDays((double)num).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayStartTimeSpan).ToUtc(), referenceTime.AddDays((double)(num + 1)).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc()));
            }

            case ReminderTimeHint.NextWeek:
            {
                ExDateTime date = referenceTime.AddDays((double)WorkingHoursAwareReminderTimeCalculator.DaysTilNextOccurrence(referenceTime, context.StartOfWeek)).Date;
                exDateRange = new ExDateRange(date.ToUtc(), date.AddDays(6.0).Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc());
                goto IL_496;
            }

            case ReminderTimeHint.NextMonth:
            {
                int        num2       = ExDateTime.DaysInMonth(referenceTime.Year, referenceTime.Month) - referenceTime.Day + 1;
                ExDateTime date2      = referenceTime.AddDays((double)num2).Date;
                ExDateTime exDateTime = date2.AddDays((double)(ExDateTime.DaysInMonth(date2.Year, date2.Month) - 1));
                exDateRange = new ExDateRange(date2.ToUtc(), exDateTime.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc());
                goto IL_496;
            }

            case ReminderTimeHint.Now:
                exDateRange = new ExDateRange(referenceTime.ToUtc(), referenceTime.ToUtc());
                goto IL_496;

            case ReminderTimeHint.InTwoDays:
                exDateRange = new ExDateRange(referenceTime.AddDays(2.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayStartTimeSpan).ToUtc(), referenceTime.AddDays(2.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc());
                goto IL_496;
            }
            throw new InvalidOperationException("unsupported reminderTimeHint");
IL_496:
            ExTraceGlobals.HeuristicsTracer.TraceInformation <ExDateTime, ExDateTime>(0, 0L, "Calculated reminder range : '{0}' - '{1}'", exDateRange.Start, exDateRange.End);
            return(exDateRange);
        }