Ejemplo n.º 1
0
 // Token: 0x06000592 RID: 1426 RVA: 0x00021394 File Offset: 0x0001F594
 private static ActiveSyncDeviceClasses GetActiveSyncDeviceClassContainer(IConfigurationSession scopedSession, OrganizationId orgId)
 {
     ActiveSyncDeviceClasses[] deviceClasses = null;
     ADNotificationAdapter.RunADOperation(delegate()
     {
         deviceClasses = scopedSession.Find <ActiveSyncDeviceClasses>(orgId.ConfigurationUnit, QueryScope.SubTree, DeviceClassCache.deviceClassesFilter, DeviceClassCache.deviceClassesSortOrder, 0);
     });
     DeviceClassCache.UpdateProtocolLogLastUsedDC(scopedSession);
     if (deviceClasses == null)
     {
         AirSyncDiagnostics.TraceDebug <OrganizationId>(ExTraceGlobals.RequestsTracer, null, "Oragnization \"{0}\" has no DeviceClass container in AD.", orgId);
         AirSyncDiagnostics.LogEvent(AirSyncEventLogConstants.Tuple_NoDeviceClassContainer, new string[]
         {
             orgId.ToString()
         });
         return(null);
     }
     AirSyncDiagnostics.TraceDebug <OrganizationId, int>(ExTraceGlobals.RequestsTracer, null, "Oragnization '{0}' has '{1}' DeviceClass container in AD.", orgId, deviceClasses.Length);
     if (deviceClasses.Length == 1)
     {
         return(deviceClasses[0]);
     }
     if (Command.CurrentCommand != null)
     {
         Command.CurrentCommand.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "TooManyDeviceClassContainers");
     }
     return(DeviceClassCache.CleanMangledObjects(scopedSession, deviceClasses, "ExchangeDeviceClasses") as ActiveSyncDeviceClasses);
 }
Ejemplo n.º 2
0
 // Token: 0x06000591 RID: 1425 RVA: 0x00021220 File Offset: 0x0001F420
 private static void ProcessForADCleanup(IConfigurationSession scopedSession, DeviceClassCache.DeviceClassDataSet localDataSet, DeviceClassCache.DeviceClassDataSet dataSetFromAD, ref int totalADWriteCount, ref int perOrgDeleteCount)
 {
     foreach (DeviceClassCache.DeviceClassData deviceClassData in dataSetFromAD)
     {
         if (totalADWriteCount >= GlobalSettings.DeviceClassCacheMaxADUploadCount)
         {
             AirSyncDiagnostics.TraceDebug <int>(ExTraceGlobals.RequestsTracer, null, "3. Stop updating AD because the cap is reached: adUpdateCount={0}", totalADWriteCount);
             break;
         }
         if (localDataSet.Contains(deviceClassData))
         {
             if ((ExDateTime.UtcNow - deviceClassData.LastUpdateTime).Days >= TimeSpan.FromDays((double)GlobalSettings.DeviceClassCacheADCleanupInterval).Days)
             {
                 AirSyncDiagnostics.TraceDebug <ExDateTime, int>(ExTraceGlobals.RequestsTracer, null, "Update or Create DeviceClass in AD. LastUpdateTime :{0}. adUpdateCount: {1}", deviceClassData.LastUpdateTime, totalADWriteCount);
                 DeviceClassCache.CreateOrUpdateActiveSyncDeviceClass(scopedSession, deviceClassData, localDataSet.OrganizationId);
                 totalADWriteCount++;
             }
         }
         else if ((ExDateTime.UtcNow - deviceClassData.LastUpdateTime).Days > TimeSpan.FromDays((double)GlobalSettings.DeviceClassCacheADCleanupInterval).Days * 2)
         {
             AirSyncDiagnostics.TraceDebug <ExDateTime, int>(ExTraceGlobals.RequestsTracer, null, "Delete DeviceClass in AD. LastUpdateTime :{0}, adUpdateCount: {1} ", deviceClassData.LastUpdateTime, totalADWriteCount);
             DeviceClassCache.DeleteActiveSyncDeviceClass(scopedSession, deviceClassData, localDataSet.OrganizationId);
             perOrgDeleteCount++;
             totalADWriteCount++;
         }
     }
 }
Ejemplo n.º 3
0
        // Token: 0x06000590 RID: 1424 RVA: 0x000210DC File Offset: 0x0001F2DC
        private static void ProcessForADAdds(IConfigurationSession scopedSession, DeviceClassCache.DeviceClassDataSet localDataSet, DeviceClassCache.DeviceClassDataSet dataSetFromAD, ref int totalADWriteCount, int perOrgDeleteCount)
        {
            int num = 0;

            foreach (DeviceClassCache.DeviceClassData deviceClassData in localDataSet)
            {
                if (totalADWriteCount >= GlobalSettings.DeviceClassCacheMaxADUploadCount)
                {
                    AirSyncDiagnostics.TraceDebug <int>(ExTraceGlobals.RequestsTracer, null, "2. Stop updating AD because the cap is reached: adUpdateCount={0}", totalADWriteCount);
                    break;
                }
                if (!dataSetFromAD.Contains(deviceClassData))
                {
                    if (dataSetFromAD.Count + num - perOrgDeleteCount >= GlobalSettings.DeviceClassPerOrgMaxADCount)
                    {
                        AirSyncDiagnostics.TraceDebug <int, int>(ExTraceGlobals.RequestsTracer, null, "Stop adding new device class node to AD because the cap is reached: dataSetFromAD.Count={0}, DeviceClassPerOrgMaxADCount={1}", dataSetFromAD.Count, GlobalSettings.DeviceClassPerOrgMaxADCount);
                        break;
                    }
                    if (dataSetFromAD.Count + num >= DeviceClassCache.ADCapWarningThreshold)
                    {
                        AirSyncDiagnostics.TraceDebug <int, int>(ExTraceGlobals.RequestsTracer, null, "Still adding new device class node to AD but the cap is close to be reached: dataSetFromAD.Count={0}, DeviceClassPerOrgMaxADCount={1}", dataSetFromAD.Count, DeviceClassCache.ADCapWarningThreshold);
                        AirSyncDiagnostics.LogPeriodicEvent(AirSyncEventLogConstants.Tuple_TooManyDeviceClassNodes, localDataSet.OrganizationId.ToString(), new string[]
                        {
                            dataSetFromAD.Count.ToString(),
                            localDataSet.OrganizationId.ToString(),
                            GlobalSettings.DeviceClassPerOrgMaxADCount.ToString()
                        });
                    }
                    DeviceClassCache.CreateOrUpdateActiveSyncDeviceClass(scopedSession, deviceClassData, localDataSet.OrganizationId);
                    num++;
                    totalADWriteCount++;
                }
            }
        }
Ejemplo n.º 4
0
 // Token: 0x06000597 RID: 1431 RVA: 0x00021628 File Offset: 0x0001F828
 private static void DeleteObject(IConfigurationSession scopedSession, ADConfigurationObject adObject)
 {
     try
     {
         ADNotificationAdapter.RunADOperation(delegate()
         {
             scopedSession.Delete(adObject);
         });
         DeviceClassCache.UpdateProtocolLogLastUsedDC(scopedSession);
         AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Deleted object: {0}", adObject.Id.DistinguishedName);
     }
     catch (LocalizedException ex)
     {
         AirSyncDiagnostics.TraceError <string, string>(ExTraceGlobals.RequestsTracer, null, "Failed to delete object {0} because: {1}", adObject.Id.DistinguishedName, ex.Message);
     }
 }
Ejemplo n.º 5
0
        // Token: 0x0600058B RID: 1419 RVA: 0x00020D1C File Offset: 0x0001EF1C
        public void Start()
        {
            if (this.Started)
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "DeviceClassCache is already started.");
                return;
            }
            if (GlobalSettings.DeviceClassCachePerOrgRefreshInterval == 0)
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "DeviceClassCache is turned off.");
                return;
            }
            TimeSpan startDelay = DeviceClassCache.GetStartDelay();

            this.timerStartTime = ExDateTime.UtcNow + startDelay;
            this.refreshTimer   = new GuardedTimer(new TimerCallback(this.Refresh), null, startDelay, TimeSpan.FromSeconds((double)DeviceClassCache.TimerKickinInterval));
            AirSyncDiagnostics.TraceDebug <ExDateTime, ExDateTime>(ExTraceGlobals.RequestsTracer, this, "DeviceClassCache is started at '{0}-UTC'.  The internal timer will be started at '{1}-UTC'.", ExDateTime.UtcNow, this.timerStartTime);
        }
Ejemplo n.º 6
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);
            }
Ejemplo n.º 7
0
        // 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);
        }
Ejemplo n.º 8
0
 // 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
         });
     }
 }
        private void ProcessSet(XmlNode setNode)
        {
            using (this.command.Context.Tracker.Start(TimeId.DeviceInfoProcessSet))
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Processing DeviceInformation - Set");
                foreach (object obj in setNode.ChildNodes)
                {
                    XmlNode xmlNode   = (XmlNode)obj;
                    string  innerText = xmlNode.InnerText;
                    string  localName;
                    switch (localName = xmlNode.LocalName)
                    {
                    case "Model":
                        this.deviceModel = DeviceClassCache.NormalizeDeviceClass(innerText);
                        break;

                    case "IMEI":
                        this.deviceImei = innerText;
                        break;

                    case "FriendlyName":
                        this.deviceFriendlyName = innerText;
                        break;

                    case "OS":
                        this.deviceOS = innerText;
                        break;

                    case "OSLanguage":
                        this.deviceOSLanguage = innerText;
                        break;

                    case "PhoneNumber":
                        this.devicePhoneNumber = innerText;
                        break;

                    case "UserAgent":
                        this.deviceUserAgent = innerText;
                        break;

                    case "EnableOutboundSMS":
                    {
                        string a;
                        if (this.command.User.IsConsumerOrganizationUser)
                        {
                            this.deviceEnableOutboundSMS = false;
                        }
                        else if ((a = innerText) != null)
                        {
                            if (!(a == "0"))
                            {
                                if (a == "1")
                                {
                                    this.deviceEnableOutboundSMS = true;
                                }
                            }
                            else
                            {
                                this.deviceEnableOutboundSMS = false;
                            }
                        }
                        break;
                    }

                    case "MobileOperator":
                        this.deviceMobileOperator = innerText;
                        break;

                    case "Annotations":
                        this.command.RequestAnnotations.ParseWLAnnotations(xmlNode, "DeviceInformation");
                        break;
                    }
                }
                if (this.command.RequestAnnotations.ContainsAnnotation("CreateChatsFolder", "DeviceInformation"))
                {
                    this.CreateSmsAndChatsSyncFolder();
                }
                bool       flag       = false;
                GlobalInfo globalInfo = this.command.GlobalInfo;
                globalInfo.DeviceModel        = this.deviceModel;
                globalInfo.DeviceImei         = this.deviceImei;
                globalInfo.DeviceFriendlyName = this.deviceFriendlyName;
                globalInfo.UserAgent          = this.deviceUserAgent;
                string text;
                if (this.command.Context.Request.DeviceIdentity.DeviceType.ToUpper().Contains("SAMSUNG") && this.command.TryParseDeviceOSFromUserAgent(out text))
                {
                    this.deviceOS = text;
                }
                globalInfo.DeviceOS          = this.deviceOS;
                globalInfo.DeviceOSLanguage  = this.deviceOSLanguage;
                globalInfo.DevicePhoneNumber = this.devicePhoneNumber;
                string text2 = string.IsNullOrEmpty(this.devicePhoneNumber) ? globalInfo.DevicePhoneNumberForSms : this.devicePhoneNumber;
                if (string.IsNullOrEmpty(text2))
                {
                    text2 = Guid.NewGuid().GetHashCode().ToString("D3", CultureInfo.InvariantCulture);
                    globalInfo.DevicePhoneNumberForSms = text2;
                }
                else
                {
                    flag |= (string.Compare(text2, globalInfo.DevicePhoneNumberForSms, StringComparison.Ordinal) != 0);
                }
                flag |= (this.deviceEnableOutboundSMS != globalInfo.DeviceEnableOutboundSMS);
                globalInfo.DeviceMobileOperator      = this.deviceMobileOperator;
                globalInfo.DeviceInformationReceived = true;
                SmsSqmDataPointHelper.AddDeviceInfoReceivedDataPoint(SmsSqmSession.Instance, this.mailboxSession.MailboxOwner.ObjectId, this.mailboxSession.MailboxOwner.LegacyDn, this.command.Request.DeviceIdentity.DeviceType, this.command.Request.VersionString);
                if (flag)
                {
                    try
                    {
                        using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(this.mailboxSession))
                        {
                            TextMessagingAccount textMessagingAccount = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(this.mailboxSession.MailboxOwner.ObjectId);
                            IRecipientSession    adrecipientSession   = this.mailboxSession.GetADRecipientSession(false, ConsistencyMode.FullyConsistent);
                            ADRecipient          adrecipient          = adrecipientSession.Read(this.mailboxSession.MailboxOwner.ObjectId);
                            this.command.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, adrecipientSession.LastUsedDc);
                            if (adrecipient == null)
                            {
                                throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerError, new LocalizedString("Cannot find AD Recipient correlated to the text messaging account"), false)
                                      {
                                          ErrorStringForProtocolLogger = "NoUserAccountForSms"
                                      };
                            }
                            E164Number e164Number = null;
                            E164Number.TryParse(text2, out e164Number);
                            if (this.deviceEnableOutboundSMS)
                            {
                                if (e164Number == null)
                                {
                                    throw new AirSyncPermanentException(StatusCode.Sync_ServerError, new LocalizedString(string.Format("Cannot parse phone number {0} into a E164 number.", text2)), false)
                                          {
                                              ErrorStringForProtocolLogger = "BadSmsPhoneNum"
                                          };
                                }
                                bool notificationEnabled = textMessagingAccount.NotificationPhoneNumber != null && textMessagingAccount.NotificationPhoneNumberVerified;
                                textMessagingAccount.SetEasEnabled(e164Number, this.syncStateStorage.DeviceIdentity.Protocol, this.syncStateStorage.DeviceIdentity.DeviceType, this.syncStateStorage.DeviceIdentity.DeviceId, this.deviceFriendlyName);
                                TextMessagingHelper.SaveTextMessagingAccount(textMessagingAccount, versionedXmlDataProvider, adrecipient, adrecipientSession);
                                this.command.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, adrecipientSession.LastUsedDc);
                                SmsSqmDataPointHelper.AddEasConfigurationDataPoint(SmsSqmSession.Instance, this.mailboxSession.MailboxOwner.ObjectId, this.mailboxSession.MailboxOwner.LegacyDn, this.command.Request.DeviceIdentity.DeviceType, notificationEnabled, this.command.Request.VersionString);
                            }
                            else if (textMessagingAccount.EasEnabled && textMessagingAccount.EasPhoneNumber == e164Number)
                            {
                                textMessagingAccount.SetEasDisabled();
                                TextMessagingHelper.SaveTextMessagingAccount(textMessagingAccount, versionedXmlDataProvider, adrecipient, adrecipientSession);
                                this.command.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, adrecipientSession.LastUsedDc);
                            }
                        }
                        globalInfo.DevicePhoneNumberForSms = text2;
                        globalInfo.DeviceEnableOutboundSMS = this.deviceEnableOutboundSMS;
                    }
                    catch (StoragePermanentException innerException)
                    {
                        throw new AirSyncPermanentException(StatusCode.ServerError, new LocalizedString("Server Error when trying to update SMS settings."), innerException, false)
                              {
                                  ErrorStringForProtocolLogger = "SmsSettingsSaveError"
                              };
                    }
                }
                this.OutputToIISLog();
            }
        }
Ejemplo n.º 10
0
 // 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);
     }
 }
Ejemplo n.º 11
0
        // 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);
        }
Ejemplo n.º 12
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;
         }
     }
 }