public DeviceClassPickerObject(ActiveSyncDeviceClass deviceClass) : base(deviceClass) { this.ActiveSyncDeviceClass = deviceClass; this.deviceTypeQueryString = new DeviceAccessRuleQueryString { QueryString = deviceClass.DeviceType }; this.deviceModelQueryString = new DeviceAccessRuleQueryString { QueryString = deviceClass.DeviceModel }; }
// Token: 0x060005A7 RID: 1447 RVA: 0x00021CF8 File Offset: 0x0001FEF8 public ActiveSyncDeviceClass ToActiveSyncDeviceClass(IConfigurationSession scopedSession, OrganizationId orgId) { if (this.DeviceClassFromAD != null) { this.DeviceClassFromAD.DeviceType = this.DeviceType; this.DeviceClassFromAD.DeviceModel = this.DeviceModel; this.DeviceClassFromAD.LastUpdateTime = new DateTime?((DateTime)this.LastUpdateTime); return(this.DeviceClassFromAD); } ActiveSyncDeviceClass activeSyncDeviceClass = new ActiveSyncDeviceClass { DeviceType = this.DeviceType, DeviceModel = this.DeviceModel, LastUpdateTime = new DateTime?((DateTime)this.LastUpdateTime), OrganizationId = orgId }; activeSyncDeviceClass.Name = DeviceClassCache.EnforceLengthLimit(activeSyncDeviceClass.GetCommonName(), DeviceClassCache.ADPropertyConstraintLength.MaxDeviceClassNameLength, true); activeSyncDeviceClass.SetId(scopedSession, activeSyncDeviceClass.Name); return(activeSyncDeviceClass); }
// Token: 0x06000593 RID: 1427 RVA: 0x000214B0 File Offset: 0x0001F6B0 private static void CreateOrUpdateActiveSyncDeviceClass(IConfigurationSession scopedSession, DeviceClassCache.DeviceClassData deviceClassData, OrganizationId orgId) { try { ActiveSyncDeviceClass deviceClass = deviceClassData.ToActiveSyncDeviceClass(scopedSession, orgId); deviceClass.LastUpdateTime = new DateTime?(DateTime.UtcNow); ADNotificationAdapter.RunADOperation(delegate() { scopedSession.Save(deviceClass); }); DeviceClassCache.UpdateProtocolLogLastUsedDC(scopedSession); AirSyncDiagnostics.TraceDebug <OrganizationId, string, string>(ExTraceGlobals.RequestsTracer, null, "Created DeviceClassData in AD: orgId={0}, deviceType={1}, deviceModel={2}", orgId, deviceClassData.DeviceType, deviceClassData.DeviceModel); } catch (LocalizedException ex) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, null, "Failed to create DeviceClassData: orgId={0}, deviceType={1}, deviceModel={2}, exception=\n\r{3}", new object[] { orgId, deviceClassData.DeviceType, deviceClassData.DeviceModel, ex }); } }
// Token: 0x06000811 RID: 2065 RVA: 0x0001D83B File Offset: 0x0001BA3B public ActiveSyncDeviceClassIdParameter(ActiveSyncDeviceClass settings) : base(settings.Id) { }
// Token: 0x060005A0 RID: 1440 RVA: 0x00021C5C File Offset: 0x0001FE5C public DeviceClassData(ActiveSyncDeviceClass deviceClassFromAD) { this = new DeviceClassCache.DeviceClassData(deviceClassFromAD.DeviceType, deviceClassFromAD.DeviceModel, new ExDateTime(ExTimeZone.UtcTimeZone, deviceClassFromAD.LastUpdateTime.Value)); this.deviceClassFromAD = deviceClassFromAD; }
// 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); }