// Token: 0x06000D09 RID: 3337 RVA: 0x00047074 File Offset: 0x00045274 private string GetDstSyncItemId(StoreObjectId dstFolderId, StoreObjectId mailboxItemId) { string text = this.FolderIdMapping[MailboxSyncItemId.CreateForNewItem(dstFolderId)]; SyncState syncState; if (this.loadedSyncStates.ContainsKey(text)) { syncState = this.loadedSyncStates[text]; } else { syncState = base.SyncStateStorage.GetFolderSyncState(text); if (syncState == null) { MailboxSyncProviderFactory syncProviderFactory = new MailboxSyncProviderFactory(base.MailboxSession, dstFolderId); syncState = base.SyncStateStorage.CreateFolderSyncState(syncProviderFactory, text); } if (syncState[CustomStateDatumType.IdMapping] == null) { syncState[CustomStateDatumType.IdMapping] = new ItemIdMapping(text); } this.loadedSyncStates.Add(text, syncState); } ItemIdMapping itemIdMapping = (ItemIdMapping)syncState[CustomStateDatumType.IdMapping]; MailboxSyncItemId mailboxSyncItemId = MailboxSyncItemId.CreateForNewItem(mailboxItemId); string text2 = itemIdMapping[mailboxSyncItemId]; if (text2 == null) { text2 = itemIdMapping.Add(mailboxSyncItemId); } return(text2); }
// Token: 0x06001561 RID: 5473 RVA: 0x0007D91C File Offset: 0x0007BB1C protected StoreObjectId GetSmartItemId() { this.ParseXmlRequest(); string collectionId = this.CollectionId; string itemId = this.ItemId; string longId = this.LongId; StoreObjectId storeObjectId = null; FolderSyncState folderSyncState = null; StoreObjectId result; try { if (longId != null) { if (base.Version < 120) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LongIdSupportedinV12Only"); throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.InvalidCombinationOfIDs, null, false); } try { storeObjectId = StoreObjectId.Deserialize(longId); goto IL_1F1; } catch (ArgumentException innerException) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidLongId"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.InvalidIDs, innerException, false); } catch (FormatException innerException2) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidLongId2"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.InvalidIDs, innerException2, false); } catch (CorruptDataException innerException3) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidLongId3"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.InvalidIDs, innerException3, false); } } if (collectionId == null) { StoreObjectId defaultFolderId = base.MailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); MailboxSyncProviderFactory syncProviderFactory = new MailboxSyncProviderFactory(base.MailboxSession, defaultFolderId); folderSyncState = base.SyncStateStorage.GetFolderSyncState(syncProviderFactory); } else { SyncCollection.CollectionTypes collectionType = AirSyncUtility.GetCollectionType(collectionId); if (collectionType != SyncCollection.CollectionTypes.Mailbox && collectionType != SyncCollection.CollectionTypes.Unknown) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "SendFromVirtualFolder"); throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.InvalidCombinationOfIDs, null, false); } folderSyncState = base.SyncStateStorage.GetFolderSyncState(collectionId); } if (folderSyncState == null) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "SyncStateNotFound"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.SyncStateNotFound, null, false); } ItemIdMapping itemIdMapping = (ItemIdMapping)folderSyncState[CustomStateDatumType.IdMapping]; if (itemIdMapping == null) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemIdMappingNotFound"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ItemNotFound, null, false); } MailboxSyncItemId mailboxSyncItemId = itemIdMapping[itemId] as MailboxSyncItemId; storeObjectId = ((mailboxSyncItemId == null) ? null : ((StoreObjectId)mailboxSyncItemId.NativeId)); if (storeObjectId == null) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemIdMappingNotFound"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ItemNotFound, null, false); } folderSyncState.Dispose(); folderSyncState = null; IL_1F1: result = storeObjectId; } finally { if (folderSyncState != null) { folderSyncState.Dispose(); } } return(result); }
// 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); }