// 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: 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); }
// Token: 0x0600058D RID: 1421 RVA: 0x00020E58 File Offset: 0x0001F058 public void Add(OrganizationId organizationId, string deviceType, string deviceModel) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Adding device class: orgId={0}, deviceType={1}, deviceModel={2}, started={3}.", new object[] { organizationId, deviceType, deviceModel, this.Started }); if (!this.Started) { return; } if (string.IsNullOrEmpty(deviceType) || deviceType.Length > 32) { throw new ArgumentException("Invalid deviceType: " + deviceType); } if (string.IsNullOrEmpty(deviceModel)) { throw new ArgumentNullException("deviceModel"); } try { DeviceClassCache.DeviceClassData data = new DeviceClassCache.DeviceClassData(DeviceClassCache.EnforceLengthLimit(deviceType, DeviceClassCache.ADPropertyConstraintLength.MaxDeviceTypeLength, false), DeviceClassCache.EnforceLengthLimit(deviceModel, DeviceClassCache.ADPropertyConstraintLength.MaxDeviceModelLength, false)); lock (this.thisLock) { DeviceClassCache.DeviceClassDataSet deviceClassDataSet; if (this.cache.TryGetValue(organizationId, out deviceClassDataSet)) { if (!deviceClassDataSet.Contains(data)) { if (deviceClassDataSet.Count >= GlobalSettings.DeviceClassPerOrgMaxADCount) { AirSyncDiagnostics.TraceDebug <OrganizationId, int>(ExTraceGlobals.RequestsTracer, this, "Device class will not be added to the cache since it already reaches the cap:orgId={0}, count={1}.", organizationId, deviceClassDataSet.Count); } else { deviceClassDataSet.Add(data); AirSyncDiagnostics.TraceDebug <OrganizationId>(ExTraceGlobals.RequestsTracer, this, "New device class is added to the existing org '{0}'.", organizationId); } } } else if (this.cache.Count >= GlobalSettings.ADCacheMaxOrgCount) { AirSyncDiagnostics.TraceDebug <OrganizationId, int>(ExTraceGlobals.RequestsTracer, this, "Device class set will not be added to the cache since it already reaches the cap:orgId={0}, count={1}.", organizationId, this.cache.Count); } else { deviceClassDataSet = new DeviceClassCache.DeviceClassDataSet(organizationId); deviceClassDataSet.Add(data); this.cache.Add(organizationId, deviceClassDataSet); AirSyncDiagnostics.TraceDebug <OrganizationId>(ExTraceGlobals.RequestsTracer, this, "New device class is added to the new org '{0}'.", organizationId); } } } finally { AirSyncDiagnostics.FaultInjectionTracer.TraceTest <bool>(2359700797U, ref this.realTimeRefresh); if (this.realTimeRefresh) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Calling Refresh real time."); this.Refresh(null); this.realTimeRefresh = false; } } }