Esempio n. 1
0
        //TODO: Add code here

        #endregion

        #region Register Realm Events

        private void RegisterRealmProxyEvents(RealmProxy proxy)
        {
            proxy.OnJoinGameRequest  += this.OnJoinGameRequest;
            proxy.OnJoinGameResponse += this.OnJoinGameResponse;

            //TODO: Add the rest of the events
        }
Esempio n. 2
0
        public static RealmProxy FindRealmProxyForGame(string characterName)
        {
            if (string.IsNullOrEmpty(characterName))
            {
                return(RealmProxyJoiningGame);
            }

            RealmProxy result = null;

            foreach (RealmProxy proxy in RealmProxies)
            {
                if (proxy.CharacterName == characterName)
                {
                    result = proxy;
                    break;
                }
            }

            return(result);
        }
Esempio n. 3
0
        private void OnAcceptTcpClient(IAsyncResult ar)
        {
            TcpClient tcpClient   = tcpListener.EndAcceptTcpClient(ar);
            BaseProxy proxyClient = null;

            try
            {
                tcpListener.BeginAcceptTcpClient(new AsyncCallback(OnAcceptTcpClient), null);
            }
            catch (Exception)
            {
                tcpListener = null;
                throw;
            }

            switch (proxyType)
            {
            case ProxyType.Bnet:
                proxyClient             = new BnetProxy(tcpClient);
                proxyClient.ProxyServer = this;
                BnetProxies.Add((BnetProxy)proxyClient);
                break;

            case ProxyType.Realm:
                proxyClient = new RealmProxy(tcpClient);
                RealmProxies.Add((RealmProxy)proxyClient);
                break;

            case ProxyType.Game:
                proxyClient = new GameProxy(tcpClient);
                GameProxies.Add((GameProxy)proxyClient);
                break;
            }

            this.ClientConnected(proxyClient, new EventArgs());
        }
Esempio n. 4
0
        private void OnAcceptTcpClient(IAsyncResult ar)
        {
            TcpClient tcpClient = tcpListener.EndAcceptTcpClient(ar);
            BaseProxy proxyClient = null;

            try
            {
                tcpListener.BeginAcceptTcpClient(new AsyncCallback(OnAcceptTcpClient), null);
            }
            catch (Exception)
            {
                tcpListener = null;
                throw;
            }

            switch (proxyType)
            {
                case ProxyType.Bnet :
                    proxyClient = new BnetProxy(tcpClient);
                    proxyClient.ProxyServer = this;
                    BnetProxies.Add((BnetProxy)proxyClient);
                    break;

                case ProxyType.Realm  :
                    proxyClient = new RealmProxy(tcpClient);
                    RealmProxies.Add((RealmProxy)proxyClient);
                    break;

                case ProxyType.Game :
                    proxyClient = new GameProxy(tcpClient);
                    GameProxies.Add((GameProxy)proxyClient);
                    break;
            }

            this.ClientConnected(proxyClient, new EventArgs());

        }
Esempio n. 5
0
        //TODO: Add code here

        #endregion

        #region Register Realm Events

        private void RegisterRealmProxyEvents(RealmProxy proxy)
        {
            proxy.OnJoinGameRequest += this.OnJoinGameRequest;
            proxy.OnJoinGameResponse += this.OnJoinGameResponse;

            //TODO: Add the rest of the events
        }