// Token: 0x06001061 RID: 4193 RVA: 0x000431C8 File Offset: 0x000413C8
        internal void LoadFromAD(PickerServerList oldServers)
        {
            this.context.Tracer.TracePfd <int, string>(0L, "PFD EMS {0} Loading {1} servers From AD...", 30619, this.context.ServerRole.ToString());
            Server server = this.context.ConfigurationSession.FindLocalServer();

            if (server != null)
            {
                this.CheckForOverride(server);
                if (server.ServerSite == null)
                {
                    this.context.Tracer.TraceError(0L, "Local server doesn't belong to a site");
                    ExEventLog.EventTuple tuple = this.context.HasValidConfiguration ? ApplicationLogicEventLogConstants.Tuple_LocalServerNotInSiteWarning : ApplicationLogicEventLogConstants.Tuple_LocalServerNotInSite;
                    this.context.LogEvent(tuple, null, new object[0]);
                    return;
                }
                this.context.ServerPickerClient.LocalServerDiscovered(server);
                this.localSite = server.ServerSite;
                QueryFilter filter = new AndFilter(new QueryFilter[]
                {
                    new BitMaskAndFilter(ServerSchema.CurrentServerRole, (ulong)((long)this.context.ServerRole)),
                    new ComparisonFilter(ComparisonOperator.Equal, ServerSchema.ServerSite, server.ServerSite),
                    new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, ServerSchema.VersionNumber, Server.CurrentProductMinimumVersion),
                    new ComparisonFilter(ComparisonOperator.LessThan, ServerSchema.VersionNumber, Server.NextProductMinimumVersion)
                });
                HashSet <string>       hashSet       = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                HashSet <string>       hashSet2      = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                ADPagedReader <Server> adpagedReader = this.context.ConfigurationSession.FindPaged <Server>(null, QueryScope.SubTree, filter, null, 0);
                foreach (Server server2 in adpagedReader)
                {
                    ServiceState serviceState = ServerComponentStates.ReadEffectiveComponentState(server2.Fqdn, server2.ComponentStates, ServerComponentStateSources.AD, ServerComponentStates.GetComponentId(this.context.Component), ServiceState.Active);
                    if (this.context.Component != ServerComponentEnum.None && serviceState != ServiceState.Active)
                    {
                        this.context.Tracer.TraceDebug <string, string, ServiceState>(0L, "Component {0} is not active on server {1}. Current component state is {2}.", this.context.Component.ToString(), server2.DistinguishedName, serviceState);
                    }
                    else
                    {
                        bool flag = true;
                        if (this.overrideList != null && this.overrideList.Count > 0)
                        {
                            if (this.overrideList.Contains(server2.DistinguishedName))
                            {
                                this.context.Tracer.TraceDebug <string, string>(0L, "Adding {0} Server from override list: {1} to active list", this.context.ServerRole.ToString(), server2.DistinguishedName);
                            }
                            else
                            {
                                flag = false;
                            }
                        }
                        else
                        {
                            this.context.Tracer.TraceDebug <string, string, int>(0L, "Adding {0} Server: {1} Version: {2} to active list", this.context.ServerRole.ToString(), server2.DistinguishedName, server2.VersionNumber);
                        }
                        if (flag)
                        {
                            if (this.fqdnServers.ContainsKey(server2.Fqdn) || hashSet.Contains(server2.Name) || hashSet2.Contains(server2.ExchangeLegacyDN))
                            {
                                this.context.Tracer.TraceError <string, string, string>(0L, "Found more than one server with same FQDN {0} or LegacyDN {1} or MachineName {2}.", server2.Fqdn, server2.ExchangeLegacyDN, server2.Name);
                                this.context.LogEvent(ApplicationLogicEventLogConstants.Tuple_MisconfiguredServer, server2.Fqdn, new object[]
                                {
                                    server2.ExchangeLegacyDN,
                                    server2.Name
                                });
                            }
                            else
                            {
                                PickerServer pickerServer = this.context.ServerPickerClient.CreatePickerServer(server2, this);
                                if (oldServers != null)
                                {
                                    PickerServer pickerServer2 = oldServers.PickServerByFqdn(pickerServer.FQDN);
                                    if (pickerServer2 != null)
                                    {
                                        pickerServer2.CopyStatusTo(pickerServer);
                                    }
                                }
                                this.serverList.Add(pickerServer);
                                this.fqdnServers.Add(pickerServer.FQDN, pickerServer);
                                hashSet.Add(pickerServer.MachineName);
                                hashSet2.Add(pickerServer.LegacyDN);
                            }
                        }
                    }
                }
                this.context.ServerPickerClient.ServerListUpdated(this.serverList);
                if ((server.CurrentServerRole & this.context.ServerRole) == ServerRole.None)
                {
                    this.localServer = this.context.ServerPickerClient.CreatePickerServer(server, this);
                }
                else
                {
                    PickerServer pickerServer3 = this.FindMatchingServer(server);
                    if (pickerServer3 != null)
                    {
                        this.localServer = pickerServer3;
                    }
                    else
                    {
                        this.context.Tracer.TraceDebug <string>(0L, "Local server ({0}) meets criteria, but wasn't found in AD using list query; won't be preferred", server.Fqdn);
                        this.localServer = this.context.ServerPickerClient.CreatePickerServer(server, this);
                    }
                }
                try
                {
                    this.localIP = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0];
                }
                catch (SocketException ex)
                {
                    this.context.Tracer.TraceError <string>(0L, "Can't get local IP address due to: {0}", ex.ToString());
                    ExEventLog.EventTuple tuple2 = this.context.HasValidConfiguration ? ApplicationLogicEventLogConstants.Tuple_CantGetLocalIPWarning : ApplicationLogicEventLogConstants.Tuple_CantGetLocalIP;
                    this.context.LogEvent(tuple2, ex.GetType().FullName, new object[]
                    {
                        ex
                    });
                    return;
                }
                this.localIPBytes = this.localIP.GetAddressBytes();
                this.context.Tracer.TracePfd <int, string, int>(0L, "PFD EMS {0} Finished finding {1} servers: {2} found.", 19355, this.context.ServerRole.ToString(), this.serverList.Count);
                this.isValid = true;
            }
        }