示例#1
0
        public Boolean ConnectToLogonServer(string username,string password)
        {
            if (!inited)
                throw new Exception("Run BoogieCore.Init() first.");

            if (logonSession != 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.WriteLine(netLogic.Shared.LogType.Debug, "Attempting connection to Realm List Server at {0}.", Address);

            try
            {
                logonSession = new LogonSession(username, password);

                if (!logonSession.Connect(RLDest))
                {
                    logonSession = null;
                    return false;
                }
                //StartCoroutine("Generate");
                if (!logonSession.Authenticate())
                {
                    logonSession = null;
                    return false;
                }
                else
                {
                   // logonSession.
                }
            }
            catch (Exception ex)
            {
                Log.WriteLine(netLogic.Shared.LogType.Debug, "Failed to maintain connection with realm list server. Details below:\n{0}", ex.Message);
                logonSession = null;
                return false;
            }

            return true;
        }
示例#2
0
        public void Disconnect()
        {
            if (!inited)
                throw new Exception("Run BoogieCore.Init() first.");

            if (logonSession != null)
            {
                // Stop the WS thread and wait till it ends.
                logonSession.HardDisconnect(); // causes deadlocks atm.
                logonSession = null;
            }

            if (worldSession != null)
            {
                // Stop the WS thread and wait till it ends.
                worldSession.StopThread(false); // causes deadlocks atm.
                worldSession = null;
            }
        }
示例#3
0
 public PacketHandler(LogonSession client)
 {
     Handles = new List<PacketHandle>();
     tClient = client;
 }