// Token: 0x06001805 RID: 6149 RVA: 0x0008D4A8 File Offset: 0x0008B6A8 public void UpdateLastFolderId(int folderId) { FolderIdMappingSyncStateInfo syncStateInfo = new FolderIdMappingSyncStateInfo(); this.folderIdMappingSyncState = this.syncStateStorage.GetCustomSyncState(syncStateInfo, new PropertyDefinition[0]); FolderIdMapping folderIdMapping = (FolderIdMapping)this.folderIdMappingSyncState[CustomStateDatumType.IdMapping]; folderIdMapping.IncreaseCounterTo((long)folderId); this.folderIdMappingSyncState.Commit(); }
// Token: 0x06001808 RID: 6152 RVA: 0x0008D6C0 File Offset: 0x0008B8C0 private void LoadE12SyncState() { FolderIdMappingSyncStateInfo folderIdMappingSyncStateInfo = new FolderIdMappingSyncStateInfo(); this.syncStateStorage = SyncStateStorage.Create(this.mailboxSession, this.deviceIdentity, StateStorageFeatures.ContentState, true, null); this.syncStateStorage.DeleteAllSyncStates(); this.folderIdMappingSyncState = this.syncStateStorage.GetCustomSyncState(folderIdMappingSyncStateInfo, new PropertyDefinition[0]); if (this.folderIdMappingSyncState == null || this.folderIdMappingSyncState[CustomStateDatumType.IdMapping] == null) { this.syncStateStorage.DeleteFolderHierarchySyncState(); this.folderIdMappingSyncState = this.syncStateStorage.CreateCustomSyncState(folderIdMappingSyncStateInfo); this.folderIdMappingSyncState[CustomStateDatumType.IdMapping] = new FolderIdMapping(); } else { this.syncStateStorage.DeleteFolderHierarchySyncState(); } this.folderIdMappingSyncState[SyncStateProp.Version] = new NullableData <Int32Data, int>(new int?(2)); folderIdMappingSyncStateInfo.HandleSyncStateVersioning(this.folderIdMappingSyncState); this.syncState = this.syncStateStorage.CreateFolderHierarchySyncState(); this.syncState.CustomVersion = new int?(2); }
// Token: 0x0600088E RID: 2190 RVA: 0x00032DC8 File Offset: 0x00030FC8 private void LoadSyncState(int syncKey) { FolderIdMappingSyncStateInfo syncStateInfo = new FolderIdMappingSyncStateInfo(); if (syncKey == 0) { base.SendServerUpgradeHeader = true; this.folderIdMappingSyncState = base.SyncStateStorage.GetCustomSyncState(syncStateInfo, new PropertyDefinition[0]); if (this.folderIdMappingSyncState == null || this.folderIdMappingSyncState[CustomStateDatumType.IdMapping] == null) { CustomSyncState customSyncState = base.SyncStateStorage.GetCustomSyncState(new GlobalSyncStateInfo(), new PropertyDefinition[0]); if (customSyncState == null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Could not find policy sync state. Deleting all sync states."); base.SyncStateStorage.DeleteAllSyncStates(); } else { customSyncState.Dispose(); using (FolderHierarchySyncState folderHierarchySyncState = base.SyncStateStorage.GetFolderHierarchySyncState()) { if (folderHierarchySyncState != null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Deleting all sync states."); base.SyncStateStorage.DeleteAllSyncStates(); } } } this.folderIdMappingSyncState = base.SyncStateStorage.CreateCustomSyncState(syncStateInfo); this.folderIdMappingSyncState[CustomStateDatumType.IdMapping] = new FolderIdMapping(); this.folderHierarchySyncState = base.SyncStateStorage.CreateFolderHierarchySyncState(); } else { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Deleting folder hierarchy sync state."); base.SyncStateStorage.DeleteFolderHierarchySyncState(); this.folderHierarchySyncState = base.SyncStateStorage.CreateFolderHierarchySyncState(); ((FolderIdMapping)this.folderIdMappingSyncState[CustomStateDatumType.IdMapping]).CommitChanges(); } this.folderIdMappingSyncState[CustomStateDatumType.FullFolderTree] = new FolderTree(); this.folderIdMappingSyncState[CustomStateDatumType.RecoveryFullFolderTree] = this.folderIdMappingSyncState[CustomStateDatumType.FullFolderTree]; base.InitializeSyncStatusSyncState(); base.SyncStatusSyncData.ClearClientCategoryHash(); this.shouldSaveSyncStatus = true; Interlocked.Exchange(ref this.validToCommitSyncStatusSyncState, 1); } else { this.folderIdMappingSyncState = base.SyncStateStorage.GetCustomSyncState(syncStateInfo, new PropertyDefinition[0]); this.folderHierarchySyncState = base.SyncStateStorage.GetFolderHierarchySyncState(); if (this.folderHierarchySyncState == null || this.folderIdMappingSyncState == null || this.folderIdMappingSyncState[CustomStateDatumType.IdMapping] == null) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NoHierarchyState"); throw new AirSyncPermanentException(StatusCode.Sync_OutOfDisk, this.ConstructErrorXml(StatusCode.Sync_OutOfDisk), null, false); } FolderIdMapping folderIdMapping = (FolderIdMapping)this.folderIdMappingSyncState[CustomStateDatumType.IdMapping]; StoreObjectId defaultFolderId = base.MailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); MailboxSyncItemId mailboxId = MailboxSyncItemId.CreateForNewItem(defaultFolderId); if (!folderIdMapping.Contains(mailboxId)) { base.SyncStateStorage.DeleteAllSyncStates(); base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InboxStoreObjectIdChanged"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.SyncStateCorrupt, new LocalizedString("The sync state is corrupt. It is most likely due to a recent mailbox migration."), false); } } if (this.folderHierarchySyncState.CustomVersion != null && this.folderHierarchySyncState.CustomVersion.Value > 5) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "SyncStateVersionMismatch"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.SyncStateVersionInvalid, EASServerStrings.MismatchSyncStateError, true); } }