internal static RunspaceServerSettings CreateGcOnlyRunspaceServerSettings(string token, string partitionFqdn, bool forestWideAffinityRequested = false)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new ArgumentNullException("token");
            }
            if (string.IsNullOrEmpty(partitionFqdn))
            {
                throw new ArgumentNullException("partitionFqdn");
            }
            ADRunspaceServerSettingsProvider instance = ADRunspaceServerSettingsProvider.GetInstance();

            ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string>((long)instance.GetHashCode(), "GetGcOnlyRunspaceServerSettings for token {0}", token);
            bool         flag;
            ADServerInfo gcFromToken = instance.GetGcFromToken(partitionFqdn, token, out flag, forestWideAffinityRequested);

            return(new RunspaceServerSettings(partitionFqdn, gcFromToken, token)
            {
                ViewEntireForest = true
            });
        }
        // Token: 0x0600059C RID: 1436 RVA: 0x0001F25C File Offset: 0x0001D45C
        internal virtual bool TryFailover(out ADServerSettings newServerSettings, out string failToFailOverReason, bool forestWideAffinityRequested = false)
        {
            if (this.EnforceIsUpdatableByADSession && !this.IsUpdatableByADSession)
            {
                throw new NotSupportedException("TryFailover is not supported on " + base.GetType().Name);
            }
            bool result = true;

            failToFailOverReason = null;
            ADServerSettings adserverSettings         = (ADServerSettings)this.Clone();
            ADRunspaceServerSettingsProvider instance = ADRunspaceServerSettingsProvider.GetInstance();
            string token = adserverSettings.Token;

            foreach (Fqdn fqdn in adserverSettings.serversDown)
            {
                adserverSettings.RemovePreferredDC(fqdn);
                try
                {
                    List <string> list = new List <string>();
                    foreach (KeyValuePair <string, Fqdn> keyValuePair in adserverSettings.preferredGlobalCatalog)
                    {
                        if (string.Equals(fqdn, keyValuePair.Value, StringComparison.OrdinalIgnoreCase))
                        {
                            string key = keyValuePair.Key;
                            list.Add(key);
                        }
                    }
                    foreach (string partitionFqdn in list)
                    {
                        ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string>((long)instance.GetHashCode(), "GetGcOnlyRunspaceServerSettings for token {0}", token ?? "<null>");
                        bool         flag;
                        ADServerInfo gcFromToken = instance.GetGcFromToken(partitionFqdn, token, out flag, forestWideAffinityRequested);
                        adserverSettings.SetPreferredGlobalCatalog(partitionFqdn, gcFromToken);
                        if (adserverSettings.Token != null)
                        {
                            adserverSettings.SetConfigurationDomainController(partitionFqdn, gcFromToken);
                        }
                        if (adserverSettings.Token != null || flag)
                        {
                            adserverSettings.AddPreferredDC(gcFromToken);
                        }
                    }
                }
                catch (ADTransientException ex)
                {
                    failToFailOverReason = ex.ToString();
                    result = false;
                }
                catch (ADExternalException ex2)
                {
                    failToFailOverReason = ex2.ToString();
                    result = false;
                }
                if (token == null)
                {
                    List <string> list2 = new List <string>();
                    foreach (KeyValuePair <string, Fqdn> keyValuePair2 in adserverSettings.configurationDomainController)
                    {
                        if (string.Equals(fqdn, keyValuePair2.Value, StringComparison.OrdinalIgnoreCase))
                        {
                            string key2 = keyValuePair2.Key;
                            list2.Add(key2);
                        }
                    }
                    foreach (string text in list2)
                    {
                        ADServerInfo configDc = instance.GetConfigDc(text);
                        if (configDc != null)
                        {
                            adserverSettings.SetConfigurationDomainController(text, configDc);
                        }
                    }
                }
            }
            adserverSettings.serversDown.Clear();
            newServerSettings = adserverSettings;
            return(result);
        }