Ejemplo 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
        }
Ejemplo 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);
        }
Ejemplo 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());
        }
Ejemplo 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());

        }
Ejemplo 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
        }