public static void Init(XElement xml)
        {
            if (GameManager.FlagDisableNameServer)
            {
                Global.Flag_NameServer = false;
                return;
            }
            NameServerIP    = Global.GetSafeAttributeStr(xml, "NameServer", "IP");
            NameServerPort  = (int)Global.GetSafeAttributeLong(xml, "NameServer", "Port");
            ServerPingTaiID = Global.GetSafeAttributeStr(xml, "NameServer", "PingTaiID");
            if (!int.TryParse(ServerPingTaiID, out NameServerConfig) || NameServerConfig > 1)
            {
                NameServerConfig = 1;
            }

            DefaultServerData.Host = NameServerIP;
            DefaultServerData.Port = NameServerPort;
            GetIPV4IP(DefaultServerData);

            if (!File.Exists("NameServer.xml"))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("警告:没有名字服务器列表文件(NameServer.xml)");
                Console.ForegroundColor = ConsoleColor.White;
                return;
            }
            XElement xmlNameServer = XElement.Load("NameServer.xml");

            foreach (var item in xmlNameServer.DescendantsAndSelf("Server"))
            {
                NameServerData serverData = new NameServerData();
                serverData.ID   = (int)Global.GetSafeAttributeLong(item, "ID");
                serverData.Host = Global.GetSafeAttributeStr(item, "host");
                serverData.Port = (int)Global.GetSafeAttributeLong(item, "port");
                int      start = (int)Global.GetSafeAttributeLong(item, "start");
                int      end   = (int)Global.GetSafeAttributeLong(item, "end");
                RangeKey range = new RangeKey(start, end);
                ZoneID2NameServerDict.Add(range, serverData);
            }
        }
        public static string GetIPV4IP(NameServerData serverData)
        {
            try
            {
                IPAddress ip;
                if (IPAddress.TryParse(serverData.Host, out ip))
                {
                    return(ip.ToString());
                }
                IPHostEntry hostEntry = Dns.GetHostEntry(serverData.Host);
                if (hostEntry.AddressList.Length >= 0)
                {
                    for (int i = 0; i < hostEntry.AddressList.Length; i++)
                    {
                        if (hostEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
                        {
                            serverData.ResolvedHost = serverData.Host;
                            serverData.ResolvedIP   = hostEntry.AddressList[i].ToString();
                            return(serverData.ResolvedIP);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteException("解析名字服务器域名异常: " + ex.ToString());
            }
            string result;

            if (serverData.ResolvedHost == serverData.Host)
            {
                result = serverData.ResolvedIP;
            }
            else
            {
                result = null;
            }
            return(result);
        }