예제 #1
0
            // 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);
            }
예제 #2
0
 // 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;
         }
     }
 }