// Token: 0x06001783 RID: 6019 RVA: 0x0008BA02 File Offset: 0x00089C02 internal SyncStateUpgradeHelper(MailboxSession mailboxSessionIn, SyncStateStorage syncStateStorageIn) { this.maxFolderSeen = 1; this.needsParentId = new HashSet <TiSyncUpgrade>(); this.mailboxSession = mailboxSessionIn; this.syncStateStorage = syncStateStorageIn; }
// Token: 0x06000555 RID: 1365 RVA: 0x0001ED04 File Offset: 0x0001CF04 public static List <Exception> ResetAutoBlockedDevices(MailboxSession mailboxSession) { List <Exception> list = new List <Exception>(); IEnumerator enumerator = SyncStateStorage.GetEnumerator(mailboxSession, null); using (enumerator as IDisposable) { while (enumerator.MoveNext()) { object obj = enumerator.Current; SyncStateStorage syncStateStorage = (SyncStateStorage)obj; if (syncStateStorage.DeviceIdentity.IsProtocol("AirSync")) { try { using (GlobalInfo globalInfo = GlobalInfo.LoadFromMailbox(mailboxSession, syncStateStorage, null)) { if (globalInfo.DeviceBehavior.AutoBlockReason != DeviceAccessStateReason.Unknown) { globalInfo.DeviceBehavior.UnblockDevice(); globalInfo.IsDirty = true; globalInfo.SaveToMailbox(); } } } catch (LocalizedException item) { list.Add(item); } } } } return(list); }
// Token: 0x0600038D RID: 909 RVA: 0x000154F8 File Offset: 0x000136F8 public static AutdStatusData Load(SyncStateStorage syncStateStorage, bool readOnly, bool createIfMissing) { AutdStatusData autdStatusData = null; bool flag = false; try { autdStatusData = new AutdStatusData(); AutdSyncStateInfo autdSyncStateInfo = new AutdSyncStateInfo(); autdSyncStateInfo.ReadOnly = readOnly; autdStatusData.autdStatusSyncState = syncStateStorage.GetCustomSyncState(autdSyncStateInfo, new PropertyDefinition[0]); if (autdStatusData.autdStatusSyncState == null) { if (!createIfMissing) { return(null); } autdStatusData.autdStatusSyncState = syncStateStorage.CreateCustomSyncState(autdSyncStateInfo); } autdStatusData.dirty = false; flag = true; } finally { if (!flag && autdStatusData != null) { autdStatusData.Dispose(); autdStatusData = null; } } return(autdStatusData); }
// Token: 0x06000D1B RID: 3355 RVA: 0x000478C8 File Offset: 0x00045AC8 public static IAutdStatusData Load(GlobalInfo globalInfo, SyncStateStorage syncStateStorage) { NewAutdStatusData newAutdStatusData = new NewAutdStatusData(); newAutdStatusData.globalInfo = globalInfo; newAutdStatusData.deviceMetadata = syncStateStorage.DeviceMetadata; if (!globalInfo.HasNewAutdData) { using (AutdStatusData autdStatusData = AutdStatusData.Load(syncStateStorage, false, false)) { if (autdStatusData != null) { newAutdStatusData.lastPingHeartbeat = autdStatusData.LastPingHeartbeat; newAutdStatusData.DPFolderList = ((autdStatusData.DPFolderList == null) ? null : new Dictionary <string, PingCommand.DPFolderInfo>(autdStatusData.DPFolderList)); } } newAutdStatusData.deviceMetadataStateChanged = true; newAutdStatusData.globalStateModified = true; } else { newAutdStatusData.lastPingHeartbeat = globalInfo.LastPingHeartbeat; if (newAutdStatusData.deviceMetadata.PingFolderList != null) { newAutdStatusData.DPFolderList = ((newAutdStatusData.deviceMetadata.PingFolderList == null) ? null : new Dictionary <string, PingCommand.DPFolderInfo>((Dictionary <string, PingCommand.DPFolderInfo>)newAutdStatusData.deviceMetadata.PingFolderList)); } newAutdStatusData.deviceMetadataStateChanged = false; newAutdStatusData.globalStateModified = false; } return(newAutdStatusData); }
// Token: 0x06000C3D RID: 3133 RVA: 0x000402AC File Offset: 0x0003E4AC internal MailboxItemFetchProvider(SyncStateStorage syncStateStorage, int protocolVersion, MailboxSession mailboxSession) { this.disposeTracker = this.GetDisposeTracker(); AirSyncCounters.NumberOfMailboxItemFetches.Increment(); this.syncStateStorage = syncStateStorage; this.mailboxSession = mailboxSession; IAirSyncVersionFactory airSyncVersionFactory = AirSyncProtocolVersionParserBuilder.FromVersion(protocolVersion); this.syncStates = new Dictionary <string, FolderSyncState>(); this.schemaStates = new Dictionary <string, AirSyncSchemaState>(); this.bodyPreferences = new List <BodyPreference>(); this.bodyPartPreferences = new List <BodyPartPreference>(); this.schemaConverterOptions = new Hashtable(); this.schemaStates.Add("Email", airSyncVersionFactory.CreateEmailSchema(null)); this.schemaStates.Add("Calendar", airSyncVersionFactory.CreateCalendarSchema()); this.schemaStates.Add("Contacts", airSyncVersionFactory.CreateContactsSchema()); this.schemaStates.Add("Tasks", airSyncVersionFactory.CreateTasksSchema()); AirSyncSchemaState airSyncSchemaState = airSyncVersionFactory.CreateNotesSchema(); if (airSyncSchemaState != null) { this.schemaStates.Add("Notes", airSyncSchemaState); } airSyncSchemaState = airSyncVersionFactory.CreateSmsSchema(); if (airSyncSchemaState != null) { this.schemaStates.Add("SMS", airSyncSchemaState); } }
// Token: 0x060017A3 RID: 6051 RVA: 0x0008C504 File Offset: 0x0008A704 public static ISyncStatusData Load(SyncStateStorage syncStateStorage) { SyncStatusData syncStatusData = null; bool flag = false; ISyncStatusData result; try { syncStatusData = new SyncStatusData(); syncStatusData.syncStatusSyncState = AirSyncUtility.GetOrCreateSyncStatusSyncState(syncStateStorage); syncStatusData.clientCategoryList = syncStatusData.GetClientCategoryList(); syncStatusData.lastClientIdsSent = syncStatusData.GetLastIdsSeen(); syncStatusData.dirty = false; syncStatusData.clientCategoryListModified = false; syncStatusData.lastClientIdsSentModified = false; flag = true; result = syncStatusData; } finally { if (!flag && syncStatusData != null) { syncStatusData.Dispose(); syncStatusData = null; } } return(result); }
internal BaseAttachmentFetchProvider(MailboxSession session, SyncStateStorage syncStateStorage, ProtocolLogger protocolLogger, Unlimited <ByteQuantifiedSize> maxAttachmentSize, bool attachmentsEnabled) { this.Session = session; this.SyncStateStorage = syncStateStorage; this.ProtocolLogger = protocolLogger; this.MaxAttachmentSize = maxAttachmentSize; this.AttachmentsEnabled = attachmentsEnabled; AirSyncCounters.NumberOfMailboxAttachmentFetches.Increment(); }
// Token: 0x060002F9 RID: 761 RVA: 0x0001AD34 File Offset: 0x00018F34 private void WipeMobileDevice(DeviceIdentity deviceIdentity) { using (SyncStateStorage syncStateStorage = SyncStateStorage.Bind(this.userContext.MailboxSession, deviceIdentity, null)) { if (syncStateStorage == null) { throw new OwaInvalidRequestException("Attempting to wipe device that does not exist."); } DeviceInfo.StartRemoteWipe(syncStateStorage, ExDateTime.UtcNow, this.userContext.ExchangePrincipal.MailboxInfo.PrimarySmtpAddress.ToString()); } }
// Token: 0x060002FA RID: 762 RVA: 0x0001ADAC File Offset: 0x00018FAC private void CancelWipe(DeviceIdentity deviceIdentity) { using (SyncStateStorage syncStateStorage = SyncStateStorage.Bind(this.userContext.MailboxSession, deviceIdentity, null)) { if (syncStateStorage == null) { throw new OwaInvalidRequestException("Attempting to cancel wipe on device that does not exist."); } DeviceInfo.CancelRemoteWipe(syncStateStorage); } }
private static bool TryGetSmsSyncDeviceLastSyncTime(SyncStateStorage syncStateStorage, E164Number smsSyncPhoneNumber, out ExDateTime lastSyncTime, out string deviceName) { lastSyncTime = ExDateTime.MinValue; deviceName = null; using (CustomSyncState customSyncState = syncStateStorage.GetCustomSyncState(new GlobalSyncStateInfo { ReadOnly = true }, new PropertyDefinition[0])) { if (customSyncState == null) { return(false); } if (!customSyncState.GetData <BooleanData, bool>("DeviceEnableOutboundSMS", false)) { return(false); } string data = customSyncState.GetData <StringData, string>("DevicePhoneNumber", null); if (string.IsNullOrEmpty(data)) { return(false); } E164Number e164Number = null; if (!E164Number.TryParse(data, out e164Number)) { return(false); } if (!e164Number.Equals(smsSyncPhoneNumber, true)) { return(false); } deviceName = customSyncState.GetData <StringData, string>("DeviceFriendlyName", null); } lastSyncTime = syncStateStorage.CreationTime; using (CustomSyncState customSyncState2 = syncStateStorage.GetCustomSyncState(new SyncStatusSyncStateInfo { ReadOnly = true }, new PropertyDefinition[0])) { if (customSyncState2 != null) { lastSyncTime = customSyncState2.GetData <DateTimeData, ExDateTime>("LastSyncAttemptTime", ExDateTime.MinValue); if (ExDateTime.MinValue == lastSyncTime) { lastSyncTime = customSyncState2.GetData <DateTimeData, ExDateTime>("LastSyncSuccessTime", syncStateStorage.CreationTime); } } } return(true); }
// Token: 0x06000884 RID: 2180 RVA: 0x000323A8 File Offset: 0x000305A8 public static bool FolderSyncRequired(SyncStateStorage syncStateStorage, HierarchySyncOperations folderHierarchyChanges, SyncState folderIdMappingSyncState = null) { bool flag = folderIdMappingSyncState == null; try { if (folderIdMappingSyncState == null) { folderIdMappingSyncState = syncStateStorage.GetCustomSyncState(new FolderIdMappingSyncStateInfo(), new PropertyDefinition[0]); if (folderIdMappingSyncState == null) { return(true); } } FolderTree folderTree = (FolderTree)folderIdMappingSyncState[CustomStateDatumType.FullFolderTree]; if (folderTree == null) { return(true); } for (int i = 0; i < folderHierarchyChanges.Count; i++) { HierarchySyncOperation hierarchySyncOperation = folderHierarchyChanges[i]; MailboxSyncItemId folderId = MailboxSyncItemId.CreateForNewItem(hierarchySyncOperation.ItemId); MailboxSyncItemId folderId2 = MailboxSyncItemId.CreateForNewItem(hierarchySyncOperation.ParentId); if (!folderTree.Contains(folderId2)) { return(true); } if (!folderTree.Contains(folderId)) { if (!folderTree.IsHidden(folderId2)) { return(true); } } else if (!folderTree.IsHidden(folderId) || (folderTree.IsHiddenDueToParent(folderId) && !folderTree.IsHidden(folderId2))) { return(true); } } } finally { if (flag && folderIdMappingSyncState != null) { folderIdMappingSyncState.Dispose(); } } return(false); }
internal MailboxSearchProvider(MailboxSession mailboxSession, SyncStateStorage syncStateStorage, IAirSyncContext context) { if (context.Request.Version < 120) { throw new SearchProtocolErrorException { ErrorStringForProtocolLogger = "SearchProtocolError10" }; } this.mailboxSession = mailboxSession; this.syncStateStorage = syncStateStorage; this.context = context; this.versionFactory = AirSyncProtocolVersionParserBuilder.FromVersion(context.Request.Version); AirSyncCounters.NumberOfMailboxSearches.Increment(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); base.InternalProcessRecord(); CASMailbox casmailbox = (CASMailbox)this.GetDynamicParameters(); if (casmailbox.ActiveSyncDebugLoggingSpecified || this.ResetAutoBlockedDevices) { ADUser dataObject = this.DataObject; ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromADUser(dataObject, RemotingOptions.AllowCrossSite); if (exchangePrincipal == null) { base.WriteVerbose(Strings.ExchangePrincipalNotFoundException(dataObject.ToString())); TaskLogger.LogExit(); return; } try { using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(exchangePrincipal, CultureInfo.InvariantCulture, "Client=Management;Action=Set-CasMailbox")) { if (casmailbox.ActiveSyncDebugLoggingSpecified) { SyncStateStorage.UpdateMailboxLoggingEnabled(mailboxSession, casmailbox.ActiveSyncDebugLogging, null); } if (this.ResetAutoBlockedDevices) { List <Exception> list = DeviceBehavior.ResetAutoBlockedDevices(mailboxSession); foreach (Exception ex in list) { base.WriteVerbose(Strings.ResetAutoBlockedDevicesException(ex.ToString())); } } } } catch (LocalizedException exception) { base.WriteError(exception, (ErrorCategory)1001, this.Identity); } } TaskLogger.LogExit(); }
private static bool TryGetInactiveSmsSyncDeviceName(MailboxSession session, E164Number smsSyncPhoneNumber, string smsSyncDeviceProtocol, string smsSyncDeviceType, string smsSyncDeviceId, ExDateTime boundary, out string deviceName) { deviceName = null; ExDateTime minValue = ExDateTime.MinValue; if (string.IsNullOrEmpty(smsSyncDeviceProtocol) || string.IsNullOrEmpty(smsSyncDeviceType) || string.IsNullOrEmpty(smsSyncDeviceId)) { IEnumerator enumerator = SyncStateStorage.GetEnumerator(session, null); using (enumerator as IDisposable) { while (enumerator.MoveNext()) { object obj = enumerator.Current; using (SyncStateStorage syncStateStorage = (SyncStateStorage)obj) { if (syncStateStorage.DeviceIdentity.IsProtocol("AirSync")) { if (TextMessagingUtilities.TryGetSmsSyncDeviceLastSyncTime(syncStateStorage, smsSyncPhoneNumber, out minValue, out deviceName)) { break; } } } } goto IL_BB; } } DeviceIdentity deviceIdentity = new DeviceIdentity(smsSyncDeviceId, smsSyncDeviceType, smsSyncDeviceProtocol); using (SyncStateStorage syncStateStorage2 = SyncStateStorage.Bind(session, deviceIdentity, null)) { if (!TextMessagingUtilities.TryGetSmsSyncDeviceLastSyncTime(syncStateStorage2, smsSyncPhoneNumber, out minValue, out deviceName)) { return(true); } } IL_BB: return(minValue <= boundary); }
private bool GetActiveSyncLoggingEnabled(ADUser user) { ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromADUser(user, RemotingOptions.AllowCrossSite); if (exchangePrincipal == null) { base.WriteVerbose(Strings.ExchangePrincipalNotFoundException(user.ToString())); return(false); } try { using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(exchangePrincipal, CultureInfo.InvariantCulture, "Client=Management;Action=Get-CasMailbox")) { return(SyncStateStorage.GetMailboxLoggingEnabled(mailboxSession, null)); } } catch (LocalizedException ex) { this.WriteWarning(Strings.FailedToReadAirSyncDebugLogging(user.ToString(), ex.LocalizedString)); } return(false); }
public static ISyncStatusData Load(GlobalInfo globalInfo, SyncStateStorage syncStateStorage) { NewSyncStatusData newSyncStatusData = new NewSyncStatusData(); newSyncStatusData.globalInfo = globalInfo; newSyncStatusData.deviceMetadata = syncStateStorage.DeviceMetadata; if (!globalInfo.HasNewSyncData) { using (SyncStatusData syncStatusData = SyncStatusData.Load(syncStateStorage) as SyncStatusData) { newSyncStatusData.clientCategoryList = ((syncStatusData.ClientCategoryList == null) ? null : new List <int>(syncStatusData.ClientCategoryList)); newSyncStatusData.lastClientIdsSent = ((syncStatusData.LastClientIdsSeen == null) ? null : new List <string>(syncStatusData.LastClientIdsSeen)); newSyncStatusData.lastSyncRequestRandomString = syncStatusData.LastSyncRequestRandomString; newSyncStatusData.lastCachableWbxmlDocument = syncStatusData.LastCachableWbxmlDocument; newSyncStatusData.ClientCanSendUpEmptyRequests = syncStatusData.ClientCanSendUpEmptyRequests; newSyncStatusData.lastSyncAttemptTime = syncStatusData.LastSyncAttemptTime; newSyncStatusData.lastSyncSuccessTime = syncStatusData.LastSyncSuccessTime; newSyncStatusData.lastSyncUserAgent = syncStatusData.LastSyncUserAgent; } newSyncStatusData.deviceMetadataStateChanged = true; newSyncStatusData.globalStateModified = NewSyncStatusData.GlobalInfoStateModified.All; } else { newSyncStatusData.clientCategoryList = ((globalInfo.ClientCategoryHashList == null) ? null : new List <int>(globalInfo.ClientCategoryHashList)); newSyncStatusData.lastClientIdsSent = ((globalInfo.LastClientIdsSeen == null) ? null : new List <string>(globalInfo.LastClientIdsSeen)); newSyncStatusData.lastSyncRequestRandomString = newSyncStatusData.deviceMetadata.LastSyncRequestRandomString; newSyncStatusData.lastCachableWbxmlDocument = newSyncStatusData.deviceMetadata.LastCachedSyncRequest; newSyncStatusData.ClientCanSendUpEmptyRequests = newSyncStatusData.deviceMetadata.ClientCanSendUpEmptyRequests; newSyncStatusData.lastSyncAttemptTime = globalInfo.LastSyncAttemptTime; newSyncStatusData.lastSyncSuccessTime = globalInfo.LastSyncSuccessTime; newSyncStatusData.lastSyncUserAgent = globalInfo.LastSyncUserAgent; newSyncStatusData.deviceMetadataStateChanged = false; newSyncStatusData.globalStateModified = NewSyncStatusData.GlobalInfoStateModified.None; } return(newSyncStatusData); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); MailboxSession mailboxSession = null; try { mailboxSession = MailboxSession.OpenAsAdmin(this.principal, CultureInfo.InvariantCulture, "Client=Management;Action=Get-ActiveSyncDeviceStatistics"); DeviceInfo deviceInfo = MobileDeviceTaskHelper.GetDeviceInfo(mailboxSession, this.Identity); if (deviceInfo == null) { base.WriteError(new MobileDeviceNotExistException(this.Identity.ToString()), ErrorCategory.InvalidOperation, this.Identity); } using (SyncStateStorage syncStateStorage = SyncStateStorage.Bind(mailboxSession, deviceInfo.DeviceIdentity, null)) { if (syncStateStorage == null) { base.WriteError(new MobileDeviceNotExistException(this.Identity.ToString()), ErrorCategory.InvalidOperation, this.Identity); } using (CustomSyncState orCreateGlobalSyncState = AirSyncUtility.GetOrCreateGlobalSyncState(syncStateStorage)) { if (this.Cancel) { if (!DeviceInfo.CancelRemoteWipeFromMailbox(orCreateGlobalSyncState)) { this.WriteWarning(Strings.CannotCancelWipe(this.Identity.ToString())); } } else { DeviceInfo.StartRemoteWipeFromMailbox(syncStateStorage, orCreateGlobalSyncState, ExDateTime.UtcNow, this.validatedAddresses, this.wipeRequestorSMTP); } orCreateGlobalSyncState.Commit(); } } base.InternalProcessRecord(); } catch (FolderSaveException exception) { base.WriteError(exception, ErrorCategory.WriteError, this.Identity); } catch (CorruptSyncStateException ex) { TaskLogger.LogError(ex); base.WriteError(ex, ErrorCategory.ReadError, this.principal); } catch (InvalidSyncStateVersionException ex2) { TaskLogger.LogError(ex2); base.WriteError(ex2, ErrorCategory.ReadError, this.principal); } catch (StorageTransientException ex3) { TaskLogger.LogError(ex3); base.WriteError(ex3, ErrorCategory.ReadError, this.principal); } catch (StoragePermanentException ex4) { TaskLogger.LogError(ex4); base.WriteError(ex4, ErrorCategory.InvalidOperation, this.principal); } catch (InvalidOperationException ex5) { TaskLogger.LogError(ex5); base.WriteError(ex5, ErrorCategory.InvalidOperation, this.principal); } finally { if (mailboxSession != null) { mailboxSession.Dispose(); } TaskLogger.LogExit(); } }
// Token: 0x0600075C RID: 1884 RVA: 0x00028E82 File Offset: 0x00027082 internal EmptyFolderContentsProvider(SyncStateStorage syncStateStorage, MailboxSession mailboxSession) { AirSyncCounters.NumberOfEmptyFolderContents.Increment(); this.syncStateStorage = syncStateStorage; this.mailboxSession = mailboxSession; }
// Token: 0x06000C3B RID: 3131 RVA: 0x00040183 File Offset: 0x0003E383 internal MailboxAttachmentFetchProvider(MailboxSession session, SyncStateStorage syncStateStorage, ProtocolLogger protocolLogger, Unlimited <ByteQuantifiedSize> maxAttachmentSize, bool attachmentsEnabled) : base(session, syncStateStorage, protocolLogger, maxAttachmentSize, attachmentsEnabled) { }
public override void OpenSyncState(bool autoLoadFilterAndSyncKey, SyncStateStorage syncStateStorage) { if (!(base.StoreSession is MailboxSession)) { throw new InvalidOperationException(); } RecipientInfoCacheSyncProviderFactory recipientInfoCacheSyncProviderFactory = (RecipientInfoCacheSyncProviderFactory)base.SyncProviderFactory; if (base.SyncKey != 0U || autoLoadFilterAndSyncKey) { base.SyncState = syncStateStorage.GetFolderSyncState(base.SyncProviderFactory, base.CollectionId); if (base.SyncState == null) { if (autoLoadFilterAndSyncKey) { base.Status = SyncBase.ErrorCodeStatus.InvalidSyncKey; base.ResponseSyncKey = base.SyncKey; throw new AirSyncPermanentException(false) { ErrorStringForProtocolLogger = "NoSyncStateInRICacheSync" }; } using (CustomSyncState customSyncState = syncStateStorage.GetCustomSyncState(new FolderIdMappingSyncStateInfo(), new PropertyDefinition[0])) { if (customSyncState == null || customSyncState[CustomStateDatumType.IdMapping] == null) { base.Status = SyncBase.ErrorCodeStatus.InvalidCollection; throw new AirSyncPermanentException(false) { ErrorStringForProtocolLogger = "BadFolderMapTreeInRICacheSync" }; } } base.Status = SyncBase.ErrorCodeStatus.InvalidSyncKey; base.ResponseSyncKey = base.SyncKey; throw new AirSyncPermanentException(false) { ErrorStringForProtocolLogger = "Sk0ErrorInRICacheSync" }; } else { base.CheckProtocolVersion(); if (autoLoadFilterAndSyncKey) { if (!base.SyncState.Contains(CustomStateDatumType.SyncKey)) { base.Status = SyncBase.ErrorCodeStatus.InvalidSyncKey; base.ResponseSyncKey = base.SyncKey; throw new AirSyncPermanentException(false) { ErrorStringForProtocolLogger = "NoSyncStateKeyInRICacheSync" }; } base.SyncKey = ((UInt32Data)base.SyncState[CustomStateDatumType.SyncKey]).Data; if (base.SyncState.Contains(CustomStateDatumType.RecoverySyncKey)) { base.RecoverySyncKey = ((UInt32Data)base.SyncState[CustomStateDatumType.RecoverySyncKey]).Data; } base.FilterType = (AirSyncV25FilterTypes)base.SyncState.GetData <Int32Data, int>(CustomStateDatumType.FilterType, 0); base.SyncState[CustomStateDatumType.MaxItems] = new Int32Data(base.MaxItems); } } } if (base.SyncKey == 0U) { SyncState syncState = null; try { syncState = syncStateStorage.GetCustomSyncState(new FolderIdMappingSyncStateInfo(), new PropertyDefinition[0]); if ((FolderIdMapping)syncState[CustomStateDatumType.IdMapping] == null) { base.Status = SyncBase.ErrorCodeStatus.ServerError; base.ResponseSyncKey = 0U; AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, this, "Id Mapping not created on SK0-returning ServerError on RI collection"); throw new AirSyncPermanentException(false) { ErrorStringForProtocolLogger = "NoIdMappingInRICacheSync" }; } } finally { if (syncState != null) { syncState.Dispose(); } } syncStateStorage.DeleteFolderSyncState(base.CollectionId); base.SyncState = syncStateStorage.CreateFolderSyncState(base.SyncProviderFactory, base.CollectionId); base.SyncState.RegisterColdDataKey("IdMapping"); base.SyncState.RegisterColdDataKey("CustomCalendarSyncFilter"); base.SyncState[CustomStateDatumType.IdMapping] = new ItemIdMapping(base.CollectionId); base.ClassType = "RecipientInfoCache"; base.SyncState[CustomStateDatumType.AirSyncClassType] = new ConstStringData(StaticStringPool.Instance.Intern(base.ClassType)); } else { object obj = base.SyncState[CustomStateDatumType.AirSyncClassType]; if (obj == null || string.IsNullOrEmpty(((ConstStringData)obj).Data)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "ClassType for RI folder was null in sync state"); base.ClassType = "RecipientInfoCache"; } else { if (!string.Equals("RecipientInfoCache", ((ConstStringData)obj).Data, StringComparison.OrdinalIgnoreCase)) { base.Status = SyncBase.ErrorCodeStatus.ObjectNotFound; string text = string.Format("Invalid Class Type in RI sync state: {0}", ((ConstStringData)obj).Data); AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, this, text); throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, new LocalizedString(text), false) { ErrorStringForProtocolLogger = "BadClassStateInRICacheSync" }; } base.ClassType = ((ConstStringData)obj).Data; } } if (base.SyncState.CustomVersion != null && base.SyncState.CustomVersion.Value > 9) { throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.SyncStateVersionInvalid, EASServerStrings.MismatchSyncStateError, true) { ErrorStringForProtocolLogger = "MismatchedSyncStateInRICacheSync" }; } base.SyncState[CustomStateDatumType.AirSyncProtocolVersion] = new Int32Data(base.ProtocolVersion); }
// Token: 0x06000CCE RID: 3278 RVA: 0x00044804 File Offset: 0x00042A04 public static MeetingOrganizerSyncState LoadFromMailbox(MailboxSession mailboxSession, SyncStateStorage syncStateStorage, ProtocolLogger protocolLogger) { if (mailboxSession == null) { throw new ArgumentNullException("mailboxSession"); } if (syncStateStorage == null) { throw new ArgumentNullException("syncStateStorage"); } bool flag = false; MeetingOrganizerSyncState meetingOrganizerSyncState = null; CustomSyncState customSyncState = null; MeetingOrganizerSyncState result; try { MeetingOrganizerSyncStateInfo meetingOrganizerSyncStateInfo = new MeetingOrganizerSyncStateInfo(); bool flag2 = false; ExTraceGlobals.FaultInjectionTracer.TraceTest <bool>(3104189757U, ref flag2); if (flag2) { throw new CorruptSyncStateException(meetingOrganizerSyncStateInfo.UniqueName, new LocalizedString("FaultInjection")); } bool isDirty = false; customSyncState = syncStateStorage.GetCustomSyncState(meetingOrganizerSyncStateInfo, new PropertyDefinition[0]); if (customSyncState == null) { customSyncState = syncStateStorage.CreateCustomSyncState(meetingOrganizerSyncStateInfo); isDirty = true; } else if (customSyncState.BackendVersion != null && customSyncState.BackendVersion.Value != customSyncState.Version) { isDirty = true; } meetingOrganizerSyncState = new MeetingOrganizerSyncState(customSyncState); meetingOrganizerSyncState.IsDirty = isDirty; flag = true; result = meetingOrganizerSyncState; } finally { if (!flag) { if (meetingOrganizerSyncState != null) { meetingOrganizerSyncState.Dispose(); } else if (customSyncState != null) { customSyncState.Dispose(); } } } return(result); }
// Token: 0x06000AAA RID: 2730 RVA: 0x0003B168 File Offset: 0x00039368 public static GlobalInfo LoadFromMailbox(MailboxSession mailboxSession, SyncStateStorage syncStateStorage, ProtocolLogger protocolLogger, out bool updateUserHasPartnership) { if (mailboxSession == null) { throw new ArgumentNullException("mailboxSession"); } if (syncStateStorage == null) { throw new ArgumentNullException("syncStateStorage"); } updateUserHasPartnership = false; CustomSyncState customSyncState = null; GlobalInfo globalInfo = null; bool isDirty = false; bool hasNewSyncData = false; bool hasNewAutdData = false; bool isSyncStateJustUpgraded = false; bool flag = false; GlobalInfo result; try { GlobalSyncStateInfo syncStateInfo = new GlobalSyncStateInfo(); customSyncState = syncStateStorage.GetCustomSyncState(syncStateInfo, GlobalInfo.ExtraGlobalInfoPropertiesToFetch); if (customSyncState == null) { isDirty = true; using (CustomSyncState customSyncState2 = syncStateStorage.GetCustomSyncState(new FolderIdMappingSyncStateInfo(), new PropertyDefinition[0])) { if (customSyncState2 == null) { updateUserHasPartnership = true; syncStateStorage.DeleteAllSyncStates(); } } customSyncState = syncStateStorage.CreateCustomSyncState(syncStateInfo); isDirty = true; } else { try { object obj = customSyncState.StoreObject.TryGetProperty(AirSyncStateSchema.LastSyncAttemptTime); hasNewSyncData = (obj != null && !(obj is PropertyError)); } catch (Exception arg) { AirSyncDiagnostics.TraceError <Exception>(ExTraceGlobals.RequestsTracer, null, "[GlobalInfo.LoadFromMailbox] Encountered exception when checking for new syncStatus properties. Exception: {0}", arg); } try { object obj2 = customSyncState.StoreObject.TryGetProperty(AirSyncStateSchema.LastPingHeartbeatInterval); hasNewAutdData = (obj2 != null && !(obj2 is PropertyError)); } catch (Exception arg2) { AirSyncDiagnostics.TraceError <Exception>(ExTraceGlobals.RequestsTracer, null, "[GlobalInfo.LoadFromMailbox] Encountered exception when checking for new syncStatus properties. Exception: {0}", arg2); } if (customSyncState.BackendVersion != null && customSyncState.BackendVersion.Value != customSyncState.Version) { isDirty = true; isSyncStateJustUpgraded = true; if (protocolLogger != null) { protocolLogger.SetValue(ProtocolLoggerData.Ssu, "2007"); } } } globalInfo = new GlobalInfo(customSyncState); globalInfo.IsDirty = isDirty; globalInfo.HasNewSyncData = hasNewSyncData; globalInfo.HasNewAutdData = hasNewAutdData; globalInfo.IsSyncStateJustUpgraded = isSyncStateJustUpgraded; if (Command.CurrentCommand != null) { globalInfo.WriteNewSyncData = Command.CurrentCommand.User.Features.IsEnabled(EasFeature.SyncStatusOnGlobalInfo); } flag = true; result = globalInfo; } finally { if (!flag) { if (globalInfo != null) { globalInfo.Dispose(); } else if (customSyncState != null) { customSyncState.Dispose(); } } } return(result); }
// Token: 0x06000AA9 RID: 2729 RVA: 0x0003B150 File Offset: 0x00039350 public static GlobalInfo LoadFromMailbox(MailboxSession mailboxSession, SyncStateStorage syncStateStorage, ProtocolLogger protocolLogger) { bool flag; return(GlobalInfo.LoadFromMailbox(mailboxSession, syncStateStorage, protocolLogger, out flag)); }
// Token: 0x0600184A RID: 6218 RVA: 0x0008E5A8 File Offset: 0x0008C7A8 public TiSyncUpgrade(string parentServerIdIn, MailboxSession mailboxSessionIn, SyncStateStorage syncStateStorageIn) { if (parentServerIdIn == null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.TiUpgradeTracer, this, "Input to TiSyncUpgrade.Upgrade is null: field parentServerIdIn"); throw new ArgumentNullException("parentServerIdIn"); } this.parentServerId = parentServerIdIn; this.mailboxSession = mailboxSessionIn; this.syncStateStorage = syncStateStorageIn; }
// Token: 0x06001768 RID: 5992 RVA: 0x0008B584 File Offset: 0x00089784 public void DeleteSyncStateStorage(DeviceIdentity deviceIdentity) { SyncStateStorage.DeleteSyncStateStorage(this.MailboxSessionForUtility, deviceIdentity, null); }
public override void OpenSyncState(bool autoLoadFilterAndSyncKey, SyncStateStorage syncStateStorage) { base.OpenSyncState(autoLoadFilterAndSyncKey, syncStateStorage); }
public void StressTest() { var organizationDataSource = new OrganizationDataSource(); var companyDataTarget = new CompanyDataTarget(); var stateStorage = new SyncStateStorage(); var keyMapStorage = new SyncKeyMapStorage(); var pk = 1; for (var times = 0; times < 10; times++) { Log.Debug($"PREPARING CHANGES"); var random = new Random(); for (var i = 0; i < 10; i++) { var operation = random.Next(0, 5); switch (operation) { case 0: case 1: //INSERT var organization = new Organization { Id = pk++, Name = Guid.NewGuid().ToString(), RegistrationNumber = Guid.NewGuid().ToString() }; OrganizationStorage.Storage.Add(organization); Log.Debug($"Created organization '{organization.Id}'"); break; case 2: case 3: //UPDATE if (OrganizationStorage.Storage.Count > 0) { var itemNr = random.Next(0, OrganizationStorage.Storage.Count); var update = OrganizationStorage.Storage[itemNr]; update.Name = Guid.NewGuid().ToString(); Log.Debug($"Updated organization '{update.Id}'"); } break; case 4: //DELETE if (OrganizationStorage.Storage.Count > 0) { var itemNr = random.Next(0, OrganizationStorage.Storage.Count); OrganizationStorage.Storage.RemoveAt(itemNr); Log.Debug($"Deleted organization"); } break; } } if (OrganizationStorage.Storage.Count > 0) { var orgNr = random.Next(0, OrganizationStorage.Storage.Count); var organization = OrganizationStorage.Storage[orgNr]; for (var i = 0; i < 10; i++) { var operation = random.Next(0, 5); switch (operation) { case 0: case 1: //INSERT var employee = new Employee { Id = pk++, Firstname = Guid.NewGuid().ToString(), Lastname = Guid.NewGuid().ToString() }; organization.Employees.Add(employee); Log.Debug($"Created employee '{employee.Id}' in organization '{organization.Id}'"); break; case 2: case 3: //UPDATE if (organization.Employees.Count > 0) { var itemNr = random.Next(0, organization.Employees.Count); var update = organization.Employees[itemNr]; update.Firstname = Guid.NewGuid().ToString(); } break; case 4: //DELETE if (organization.Employees.Count > 0) { var itemNr = random.Next(0, organization.Employees.Count); organization.Employees.RemoveAt(itemNr); } break; } } } Log.Debug($"DONE PREPARING CHANGES"); Action <string, string, Organization, Company> nestedTasks = (sourceKey, targetKey, sourceItem, targetItem) => { Log.Debug($"Sync for org {sourceKey}, t= '{targetKey}' started"); var organizationId = int.Parse(sourceKey); var employeeStorage = new EmployeeDataSource(organizationId); var companyId = int.Parse(targetKey); var companyUserStorage = new CompanyUserDataTarget(companyId); var employeeSyncTask = new SyncTask <Employee, CompanyUser>( "EmployeeSyncTask", employeeStorage, companyUserStorage, stateStorage, keyMapStorage, null, sourceKey); employeeSyncTask.Execute(); }; var orgSyncTask = new SyncTask <Organization, Company>( "OrganizationSyncTask", organizationDataSource, companyDataTarget, stateStorage, keyMapStorage, nestedTasks, null ); orgSyncTask.Execute(); try { CheckCurrentSyncState(); } catch (Exception ex) { throw new Exception("State not valid!", ex); } } }
internal MoveProvider(SyncStateStorage syncStateStorage, MailboxSession mailboxSession) { this.syncStateStorage = syncStateStorage; this.mailboxSession = mailboxSession; }