Ejemplo n.º 1
0
 // Token: 0x060010E9 RID: 4329 RVA: 0x00045D0C File Offset: 0x00043F0C
 public SyncCalendar(CalendarSyncState syncState, StoreSession session, StoreObjectId folderId, SyncCalendar.GetPropertiesToFetchDelegate getPropertiesToFetchDelegate, ExDateTime windowStart, ExDateTime windowEnd, bool includeAdditionalDataInResponse, int maxChangesReturned)
 {
     if (syncState == null)
     {
         throw new ArgumentNullException("syncState");
     }
     if (session == null)
     {
         throw new ArgumentNullException("session");
     }
     if (folderId == null)
     {
         throw new ArgumentNullException("folderId");
     }
     if (getPropertiesToFetchDelegate == null)
     {
         throw new ArgumentNullException("getPropertiesToFetchDelegate");
     }
     if (windowEnd < windowStart)
     {
         throw new ArgumentException("Window end time must be greater than start time");
     }
     if (windowStart.AddYears(100) < windowEnd)
     {
         throw new ArgumentException("Window time range is too large: " + (windowEnd - windowStart));
     }
     if (maxChangesReturned < 0)
     {
         throw new ArgumentException("maxChangesReturned < 0: " + maxChangesReturned);
     }
     this.syncState = syncState;
     this.session   = session;
     this.folderId  = folderId;
     this.getPropertiesToFetchDelegate = getPropertiesToFetchDelegate;
     this.windowStart = windowStart;
     this.windowEnd   = windowEnd;
     this.includeAdditionalDataInResponse = includeAdditionalDataInResponse;
     if (maxChangesReturned == 0 || maxChangesReturned > 200)
     {
         this.maxChangesReturned = 200;
         return;
     }
     this.maxChangesReturned = maxChangesReturned;
 }
        // Token: 0x060010E3 RID: 4323 RVA: 0x00045B78 File Offset: 0x00043D78
        public static CalendarViewQueryResumptionPoint SafeGetResumptionPoint(string version, string recurringPhase, string instanceKey, string sortKeyValue)
        {
            CalendarViewQueryResumptionPoint result = null;
            bool resumeToRecurringMeetings;

            if (version == CalendarViewQueryResumptionPoint.CurrentVersion && bool.TryParse(recurringPhase, out resumeToRecurringMeetings))
            {
                result = CalendarViewQueryResumptionPoint.CreateInstance(resumeToRecurringMeetings, CalendarSyncState.SafeGetInstanceKey(instanceKey), CalendarSyncState.SafeGetDateTimeValue(sortKeyValue));
            }
            return(result);
        }
 // Token: 0x060010E1 RID: 4321 RVA: 0x00045B0C File Offset: 0x00043D0C
 public static bool IsEmpty(CalendarSyncState calendarSyncState)
 {
     return(calendarSyncState.IcsSyncState == null && calendarSyncState.QueryResumptionPoint == null && calendarSyncState.OldWindowEnd == null);
 }
Ejemplo n.º 4
0
        // Token: 0x060010EA RID: 4330 RVA: 0x00045E10 File Offset: 0x00044010
        public SyncCalendarResponse Execute(out IFolderSyncState newSyncState, out IList <KeyValuePair <StoreId, LocalizedException> > caughtExceptions)
        {
            ExTraceGlobals.SyncCalendarTracer.TraceDebug((long)this.GetHashCode(), "XsoSyncCalendar.Execute: Start");
            Stopwatch stopwatch = Stopwatch.StartNew();

            caughtExceptions = new List <KeyValuePair <StoreId, LocalizedException> >();
            MailboxSyncProviderFactory  mailboxSyncProviderFactory        = new MailboxSyncProviderFactory(this.session, this.folderId);
            HashSet <StoreId>           syncItemsHashSet                  = new HashSet <StoreId>();
            List <SyncCalendarItemType> updatedItemsList                  = new List <SyncCalendarItemType>();
            List <SyncCalendarItemType> recurrenceMastersWithInstances    = new List <SyncCalendarItemType>();
            List <SyncCalendarItemType> recurrenceMastersWithoutInstances = new List <SyncCalendarItemType>();
            Dictionary <StoreId, SyncCalendarItemType> unchangedRecurrenceMastersWithInstances = new Dictionary <StoreId, SyncCalendarItemType>();
            List <StoreId> deletedItemsList = new List <StoreId>();
            bool           flag             = true;
            CalendarViewQueryResumptionPoint calendarViewQueryResumptionPoint = null;

            using (ISyncProvider syncProvider = mailboxSyncProviderFactory.CreateSyncProvider(null))
            {
                newSyncState = this.syncState.CreateFolderSyncState(this.folderId, syncProvider);
                ExDateTime value;
                if (CalendarSyncState.IsEmpty(this.syncState) || this.syncState.OldWindowEnd == null || this.windowStart >= this.syncState.OldWindowEnd.Value)
                {
                    ExTraceGlobals.SyncCalendarTracer.TraceDebug((long)this.GetHashCode(), "XsoSyncCalendar.InternalExecute: Requesting catch-up sync state from ICS");
                    newSyncState.Watermark = syncProvider.GetMaxItemWatermark(newSyncState.Watermark);
                    value = this.windowStart;
                }
                else
                {
                    value = this.syncState.OldWindowEnd.Value;
                }
                if (newSyncState.Watermark != null)
                {
                    int num  = this.maxChangesReturned;
                    int num2 = 0;
                    int num3 = 0;
                    if (this.windowEnd > value)
                    {
                        calendarViewQueryResumptionPoint = this.DoQuerySync(syncItemsHashSet, updatedItemsList, recurrenceMastersWithInstances, unchangedRecurrenceMastersWithInstances, value, this.windowEnd, num, caughtExceptions, out num2);
                        flag = !calendarViewQueryResumptionPoint.IsEmpty;
                        num  = this.CalculateRemainingItemsCount(num, num2);
                        ExTraceGlobals.SyncCalendarTracer.TraceDebug <int, int, bool>((long)this.GetHashCode(), "XsoSyncCalendar.DoQuerySync added {0} items to the sync response. Remaining Items: {1}; More Available: {2}", num2, num, flag);
                    }
                    if (num != 0)
                    {
                        flag = this.DoIcsSync(syncItemsHashSet, updatedItemsList, recurrenceMastersWithInstances, recurrenceMastersWithoutInstances, unchangedRecurrenceMastersWithInstances, deletedItemsList, newSyncState.Watermark, syncProvider, num, caughtExceptions, out num3);
                        ExTraceGlobals.SyncCalendarTracer.TraceDebug <int, bool>((long)this.GetHashCode(), "XsoSyncCalendar.DoIcsSync added {0} items to the sync response. More Available: {1}", num3, flag);
                    }
                    else
                    {
                        ExTraceGlobals.SyncCalendarTracer.TraceDebug <int, int>((long)this.GetHashCode(), "XsoSyncCalendar; Skipping ICS sync, since we've reached the max items requested (Requested: {0}; Actual: {1}).", this.maxChangesReturned, num2);
                    }
                    ExTraceGlobals.SyncCalendarTracer.TraceDebug <int, int>((long)this.GetHashCode(), "XsoSyncCalendar; Finished fetching items. Total items synced: {0}; Max requested: {1}", num2 + num3, this.maxChangesReturned);
                }
                else
                {
                    flag = false;
                    ExTraceGlobals.SyncCalendarTracer.TraceDebug((long)this.GetHashCode(), "XsoSyncCalendar; Nothing to sync. The specified folder is empty.");
                }
            }
            SyncCalendarResponse result = this.AssembleResponse(flag ? calendarViewQueryResumptionPoint : null, flag ? this.syncState.OldWindowEnd : new ExDateTime?(this.windowEnd), updatedItemsList, recurrenceMastersWithInstances, recurrenceMastersWithoutInstances, unchangedRecurrenceMastersWithInstances, deletedItemsList, !flag);

            stopwatch.Stop();
            ExTraceGlobals.SyncCalendarTracer.TraceDebug((long)this.GetHashCode(), "XsoSyncCalendar.InternalExecute: End " + stopwatch.ElapsedMilliseconds);
            return(result);
        }