// Token: 0x06000596 RID: 1430 RVA: 0x000215C8 File Offset: 0x0001F7C8 private static ADConfigurationObject CleanMangledObjects(IConfigurationSession scopedSession, ADConfigurationObject[] objects, string rdnShouldBe) { int num = -1; for (int i = 0; i < objects.Length; i++) { if (num == -1 && !DeviceClassCache.DnIsMangled(objects[i], rdnShouldBe)) { num = i; } else { DeviceClassCache.DeleteObject(scopedSession, objects[i]); } } if (num != -1) { return(objects[num]); } return(null); }
// Token: 0x06000599 RID: 1433 RVA: 0x00021738 File Offset: 0x0001F938 private void Refresh(object state) { try { AirSyncDiagnostics.TraceDebug <ExDateTime>(ExTraceGlobals.RequestsTracer, this, "Refresh is being call at '{0}-UTC'.", ExDateTime.UtcNow); AirSyncDiagnostics.TraceDebug <int>(ExTraceGlobals.RequestsTracer, this, "DeviceClassCache contains '{0}' elements.", this.cache.Values.Count); List <DeviceClassCache.DeviceClassDataSet> list; lock (this.thisLock) { if (this.cache.Values.Count < 1) { return; } list = new List <DeviceClassCache.DeviceClassDataSet>(this.cache.Values); } int num = 0; foreach (DeviceClassCache.DeviceClassDataSet deviceClassDataSet in list) { if (this.realTimeRefresh || !(ExDateTime.UtcNow - deviceClassDataSet.StartTime < TimeSpan.FromSeconds((double)GlobalSettings.DeviceClassCachePerOrgRefreshInterval))) { if (num >= GlobalSettings.DeviceClassCacheMaxADUploadCount) { AirSyncDiagnostics.TraceDebug <int>(ExTraceGlobals.RequestsTracer, this, "1. Stop updating AD because the cap is reached: adUpdateCount={0}", num); break; } lock (this.thisLock) { if (!this.cache.ContainsKey(deviceClassDataSet.OrganizationId)) { AirSyncDiagnostics.TraceDebug <OrganizationId>(ExTraceGlobals.RequestsTracer, this, "Organization {0} is already removed from the cache by another thread", deviceClassDataSet.OrganizationId); continue; } this.cache.Remove(deviceClassDataSet.OrganizationId); } using (deviceClassDataSet) { IConfigurationSession scopedSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(deviceClassDataSet.OrganizationId), 930, "Refresh", "f:\\15.00.1497\\sources\\dev\\AirSync\\src\\AirSync\\DeviceClassCache.cs"); ActiveSyncDeviceClasses deviceClassContainer = DeviceClassCache.GetActiveSyncDeviceClassContainer(scopedSession, deviceClassDataSet.OrganizationId); if (deviceClassContainer != null) { ADPagedReader <ActiveSyncDeviceClass> deviceClassReader = null; ADNotificationAdapter.RunADOperation(delegate() { deviceClassReader = scopedSession.FindPaged <ActiveSyncDeviceClass>(deviceClassContainer.Id, QueryScope.OneLevel, null, null, 0); }); DeviceClassCache.UpdateProtocolLogLastUsedDC(scopedSession); if (deviceClassReader != null) { using (DeviceClassCache.DeviceClassDataSet deviceClassDataSet3 = new DeviceClassCache.DeviceClassDataSet(deviceClassDataSet.OrganizationId)) { foreach (ActiveSyncDeviceClass activeSyncDeviceClass in deviceClassReader) { if (!string.IsNullOrEmpty(activeSyncDeviceClass.DeviceType) && !string.IsNullOrEmpty(activeSyncDeviceClass.DeviceModel) && activeSyncDeviceClass.LastUpdateTime != null) { string commonName = ActiveSyncDeviceClass.GetCommonName(activeSyncDeviceClass.DeviceType, activeSyncDeviceClass.DeviceModel); if (DeviceClassCache.DnIsMangled(activeSyncDeviceClass, commonName)) { AirSyncDiagnostics.TraceDebug <ADObjectId>(ExTraceGlobals.RequestsTracer, this, "Delete the Mangled DeviceClassCache {0}.", activeSyncDeviceClass.Id); DeviceClassCache.DeleteObject(scopedSession, activeSyncDeviceClass); num++; } else { deviceClassDataSet3.Add(new DeviceClassCache.DeviceClassData(activeSyncDeviceClass)); } } else { AirSyncDiagnostics.TraceDebug <string, string, DateTime?>(ExTraceGlobals.RequestsTracer, this, "Delete the DeviceClassCache. Either DeviceType, DeviceModel or LastupdatTime is null. DeviceType:{0}, DeviceModel:{1}, LastUpdateTime:{2}.", activeSyncDeviceClass.DeviceType, activeSyncDeviceClass.DeviceModel, activeSyncDeviceClass.LastUpdateTime); DeviceClassCache.DeleteObject(scopedSession, activeSyncDeviceClass); num++; } } DeviceClassCache.UpdateProtocolLogLastUsedDC(scopedSession); AirSyncDiagnostics.TraceDebug <int, OrganizationId>(ExTraceGlobals.RequestsTracer, this, "'{0}' device classes are loaded from AD for org '{1}'", deviceClassDataSet3.Count, deviceClassDataSet.OrganizationId); int perOrgDeleteCount = 0; DeviceClassCache.ProcessForADCleanup(scopedSession, deviceClassDataSet, deviceClassDataSet3, ref num, ref perOrgDeleteCount); DeviceClassCache.ProcessForADAdds(scopedSession, deviceClassDataSet, deviceClassDataSet3, ref num, perOrgDeleteCount); } } } } } } } catch (Exception ex) { AirSyncUtility.ProcessException(ex); } }
// Token: 0x06000594 RID: 1428 RVA: 0x00021584 File Offset: 0x0001F784 private static void DeleteActiveSyncDeviceClass(IConfigurationSession scopedSession, DeviceClassCache.DeviceClassData deviceClassData, OrganizationId orgId) { ActiveSyncDeviceClass adObject = deviceClassData.ToActiveSyncDeviceClass(scopedSession, orgId); DeviceClassCache.DeleteObject(scopedSession, adObject); }