Пример #1
0
        public static Boolean ConnectToRealmListServer()
        {
            if (!inited)
            {
                throw new Exception("Run BoogieCore.Init() first.");
            }

            if (realmListClient != null)
            {
                throw new Exception("Already connected?");
            }

            IPAddress RLAddr;

            string Address = configFile.ReadString("Connection", "Host", "us.logon.worldofwarcraft.com");
            int    Port    = configFile.ReadInteger("Connection", "Port", 3724);

            Regex DnsMatch = new Regex("[a-zA-Z]");

            if (DnsMatch.IsMatch(Address))
            {
                RLAddr = Dns.GetHostEntry(Address).AddressList[0];
            }
            else
            {
                RLAddr = System.Net.IPAddress.Parse(Address);
            }

            IPEndPoint RLDest = new IPEndPoint(RLAddr, Port);

            Log(LogType.System, "Attempting connection to Realm List Server at {0}.", Address);

            try
            {
                realmListClient = new RealmListClient();

                if (!realmListClient.Connect(RLDest))
                {
                    realmListClient = null;
                    return(false);
                }

                if (!realmListClient.Logon())
                {
                    realmListClient = null;
                    return(false);
                }
            }
            catch (Exception ex)
            {
                BoogieCore.Log(LogType.System, "Failed to maintain connection with realm list server. Details below:\n{0}", ex.Message);
                realmListClient = null;
                return(false);
            }

            return(true);
        }
Пример #2
0
        public static void Disconnect()
        {
            if (!inited)
            {
                throw new Exception("Run BoogieCore.Init() first.");
            }

            realmListClient = null;

            if (worldServerClient != null)
            {
                // Stop the WS thread and wait till it ends.
                worldServerClient.StopThread(false); // causes deadlocks atm.
                worldServerClient = null;
            }
        }
Пример #3
0
        public static void Disconnect()
        {
            if (!inited)
                throw new Exception("Run BoogieCore.Init() first.");

            realmListClient = null;

            if (worldServerClient != null)
            {
                // Stop the WS thread and wait till it ends.
                worldServerClient.StopThread(false); // causes deadlocks atm.
                worldServerClient = null;
            }
        }
Пример #4
0
        public static Boolean ConnectToRealmListServer()
        {
            if (!inited)
                throw new Exception("Run BoogieCore.Init() first.");

            if (realmListClient != null)
                throw new Exception("Already connected?");

            IPAddress RLAddr;

            string Address = configFile.ReadString("Connection", "Host", "us.logon.worldofwarcraft.com");
            int Port = configFile.ReadInteger("Connection", "Port", 3724);

            Regex DnsMatch = new Regex("[a-zA-Z]");

            if (DnsMatch.IsMatch(Address))
                RLAddr = Dns.GetHostEntry(Address).AddressList[0];
            else
                RLAddr = System.Net.IPAddress.Parse(Address);

            IPEndPoint RLDest = new IPEndPoint(RLAddr, Port);

            Log(LogType.System, "Attempting connection to Realm List Server at {0}.", Address);

            try
            {
                realmListClient = new RealmListClient();

                if (!realmListClient.Connect(RLDest))
                {
                    realmListClient = null;
                    return false;
                }

                if (!realmListClient.Logon())
                {
                    realmListClient = null;
                    return false;
                }
            }
            catch (Exception ex)
            {
                BoogieCore.Log(LogType.System, "Failed to maintain connection with realm list server. Details below:\n{0}", ex.Message);
                realmListClient = null;
                return false;
            }

            return true;
        }