Пример #1
0
 // Token: 0x06000515 RID: 1301 RVA: 0x0001CBC8 File Offset: 0x0001ADC8
 public int CompareTo(object obj)
 {
     if (obj == null)
     {
         return(1);
     }
     ADRunspaceServerSettingsProvider.ADServerInfoState adserverInfoState = obj as ADRunspaceServerSettingsProvider.ADServerInfoState;
     if (adserverInfoState == null)
     {
         throw new ArgumentException("obj is not of the required type");
     }
     return(string.Compare(this.ServerInfo.Fqdn, adserverInfoState.ServerInfo.Fqdn, StringComparison.OrdinalIgnoreCase));
 }
Пример #2
0
        // Token: 0x0600051F RID: 1311 RVA: 0x0001CD7C File Offset: 0x0001AF7C
        internal static bool TryCreateNew(string partitionFqdn, TopologyProvider topologyProvider, PartitionBasedADRunspaceServerSettingsProvider previousInstance, out PartitionBasedADRunspaceServerSettingsProvider newInstance)
        {
            ArgumentValidator.ThrowIfNullOrEmpty("partitionFqdn", partitionFqdn);
            ArgumentValidator.ThrowIfNull("topologyProvider", topologyProvider);
            newInstance = null;
            Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState> dictionary  = new Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState>(StringComparer.OrdinalIgnoreCase);
            Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState> dictionary2 = new Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState>(StringComparer.OrdinalIgnoreCase);
            Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState> dictionary3 = new Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState>(StringComparer.OrdinalIgnoreCase);
            HashSet <string> hashSet;

            if (previousInstance != null)
            {
                hashSet = new HashSet <string>(previousInstance.GetAllGCs(), StringComparer.OrdinalIgnoreCase);
            }
            else
            {
                hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            }
            if (previousInstance != null && ExTraceGlobals.ServerSettingsProviderTracer.IsTraceEnabled(TraceType.DebugTrace))
            {
                string arg = string.Join(",", previousInstance.inSiteGCs.Keys);
                ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, int>((long)partitionFqdn.GetHashCode(), "Previous in site servers {0} (from instance {1})", arg, previousInstance.GetHashCode());
                string arg2 = string.Join(",", previousInstance.outOfSiteGCs.Keys);
                ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, int>((long)partitionFqdn.GetHashCode(), "Previous out of site servers {0} (from instance {1})", arg2, previousInstance.GetHashCode());
            }
            List <string>        currentlyUsedServers = (previousInstance != null) ? previousInstance.GetAllGCs().ToList <string>() : new List <string>();
            IList <ADServerInfo> serversForRole       = topologyProvider.GetServersForRole(partitionFqdn, currentlyUsedServers, ADServerRole.GlobalCatalog, 25, false);

            ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <int, string>((long)partitionFqdn.GetHashCode(), "GetServersForRole returned a list of length: {0} for forest ={1}", serversForRole.Count, partitionFqdn);
            List <string> list  = new List <string>();
            List <string> list2 = new List <string>();
            List <string> list3 = new List <string>();

            for (int i = 0; i < serversForRole.Count; i++)
            {
                ADRunspaceServerSettingsProvider.ADServerInfoState adserverInfoState = new ADRunspaceServerSettingsProvider.ADServerInfoState(serversForRole[i])
                {
                    IsDown = false
                };
                bool flag  = adserverInfoState.IsInLocalSite && previousInstance != null && !previousInstance.inSiteGCs.ContainsKey(adserverInfoState.ServerInfo.Fqdn);
                bool flag2 = !adserverInfoState.IsInLocalSite && previousInstance != null && !previousInstance.outOfSiteGCs.ContainsKey(adserverInfoState.ServerInfo.Fqdn);
                bool flag3 = flag || flag2;
                if (!hashSet.Contains(adserverInfoState.ServerInfo.Fqdn))
                {
                    if (adserverInfoState.IsInLocalSite)
                    {
                        list.Add(adserverInfoState.ServerInfo.Fqdn);
                    }
                    else
                    {
                        list2.Add(adserverInfoState.ServerInfo.Fqdn);
                    }
                }
                ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug((long)partitionFqdn.GetHashCode(), "Forest = {0}. {1} server: {2}, {3} site.", new object[]
                {
                    partitionFqdn,
                    flag3 ? "Adding a new" : "Keeping",
                    adserverInfoState.ServerInfo.Fqdn,
                    adserverInfoState.IsInLocalSite ? "in the local" : "out of"
                });
                if (adserverInfoState.IsInLocalSite)
                {
                    dictionary[adserverInfoState.ServerInfo.Fqdn] = adserverInfoState;
                }
                else
                {
                    dictionary2[adserverInfoState.ServerInfo.Fqdn] = adserverInfoState;
                }
            }
            list.Sort();
            list2.Sort();
            if (previousInstance != null)
            {
                list.InsertRange(0, previousInstance.allInSiteGCs);
                list2.InsertRange(0, previousInstance.allOutOfSiteGCs);
            }
            List <string> list4 = new List <string>(1);

            if (previousInstance != null && previousInstance.ConfigDC != null)
            {
                list4.Add(previousInstance.ConfigDC.Fqdn);
            }
            serversForRole = topologyProvider.GetServersForRole(partitionFqdn, list4, ADServerRole.ConfigurationDomainController, 1, false);
            ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <int, string>((long)partitionFqdn.GetHashCode(), "GetServersForRole returned a list of length: {0} for forest={1}", serversForRole.Count, partitionFqdn);
            ADServerInfo adserverInfo = null;

            if (serversForRole.Count > 0)
            {
                adserverInfo = serversForRole[0];
                ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, string, string>((long)partitionFqdn.GetHashCode(), "Forest = {0}. {1} Config DC {2}", partitionFqdn, (previousInstance != null && previousInstance.configDC != null && string.Equals(serversForRole[0].Fqdn, previousInstance.configDC.Fqdn, StringComparison.OrdinalIgnoreCase)) ? "New" : "Same", adserverInfo.Fqdn);
            }
            else if (previousInstance != null && previousInstance.configDC != null)
            {
                adserverInfo = previousInstance.ConfigDC;
            }
            if (previousInstance != null && ExTraceGlobals.ServerSettingsProviderTracer.IsTraceEnabled(TraceType.DebugTrace))
            {
                string arg3 = string.Join(",", previousInstance.inForestGCs.Keys);
                ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, int>((long)partitionFqdn.GetHashCode(), "Previous in forest servers {0} (from instance {1})", arg3, previousInstance.GetHashCode());
            }
            serversForRole = topologyProvider.GetServersForRole(partitionFqdn, currentlyUsedServers, ADServerRole.GlobalCatalog, 25, true);
            ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <int, string, string>((long)partitionFqdn.GetHashCode(), "GetServersForRole returned a list of length: {0} for forest = {1}. The list is: {2}.", serversForRole.Count, partitionFqdn, string.Join <ADServerInfo>(",", serversForRole));
            for (int j = 0; j < serversForRole.Count; j++)
            {
                ADRunspaceServerSettingsProvider.ADServerInfoState adserverInfoState2 = new ADRunspaceServerSettingsProvider.ADServerInfoState(serversForRole[j], true);
                list3.Add(adserverInfoState2.ServerInfo.Fqdn);
                if (adserverInfoState2.ServerInfo.IsServerSuitable)
                {
                    adserverInfoState2.IsDown = false;
                    dictionary3[adserverInfoState2.ServerInfo.Fqdn] = adserverInfoState2;
                }
                else
                {
                    adserverInfoState2.IsDown = true;
                }
            }
            if (adserverInfo != null && (dictionary.Count > 0 || dictionary2.Count > 0))
            {
                newInstance = new PartitionBasedADRunspaceServerSettingsProvider(partitionFqdn, dictionary, dictionary2, dictionary3, adserverInfo, list, list2, list3);
                return(true);
            }
            ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug((long)partitionFqdn.GetHashCode(), "{0} unable to create a new PartitionBasedADRunspaceServerSettingsProvider. CDC {1} InSiteGCs {2} OutOfSiteGCs {3}", new object[]
            {
                partitionFqdn,
                (adserverInfo != null) ? adserverInfo.FqdnPlusPort : "<NULL>",
                dictionary.Count,
                dictionary2.Count
            });
            return(false);
        }