Esempio n. 1
0
 private void client_LayerClientLogin(PRoConLayerClient sender) {
     InvokeOnAllEnabled("OnAccountLogin", sender.Username, sender.IPPort, sender.Privileges);
 }
Esempio n. 2
0
 private void CPRoConLayerClient_LayerClientShutdown(PRoConLayerClient sender) {
     this.UnregisterEvents();
 }
Esempio n. 3
0
 private void Layer_ClientConnected(PRoConLayerClient client) {
     client.Login += new PRoConLayerClient.LayerClientHandler(client_LayerClientLogin);
     client.Logout += new PRoConLayerClient.LayerClientHandler(client_LayerClientLogout);
 }
Esempio n. 4
0
 private void PRoConLayer_ClientConnected(PRoConLayerClient client)
 {
     client.Login += new PRoConLayerClient.LayerClientHandler(client_LayerClientLogin);
     client.Logout += new PRoConLayerClient.LayerClientHandler(client_LayerClientLogout);
     client.Quit += new PRoConLayerClient.LayerClientHandler(client_LayerClientQuit);
     client.ClientShutdown += new PRoConLayerClient.LayerClientHandler(client_LayerClientShutdown);
     client.UidRegistered += new PRoConLayerClient.LayerClientHandler(client_UidRegistered);
 }
Esempio n. 5
0
        public void SendProconLayerPacket(PRoConLayerClient sender, Packet cpPassOn) {
            lock (new object()) {
                UInt32 ui32MainConnSequence = Game.Connection.AcquireSequenceNumber;

                if (m_dicForwardedPackets.ContainsKey(ui32MainConnSequence) == false) {
                    var spopForwardedPacket = new SOriginalForwardedPacket();
                    spopForwardedPacket.m_ui32OriginalSequence = cpPassOn.SequenceNumber;
                    spopForwardedPacket.m_sender = sender;
                    spopForwardedPacket.m_lstWords = new List<string>(cpPassOn.Words);

                    // Register the packet as forwared. 
                    m_dicForwardedPackets.Add(ui32MainConnSequence, spopForwardedPacket);

                    if (cpPassOn.Words.Count >= 5 && String.Compare(cpPassOn.Words[0], "procon.admin.yell") == 0) {
                        if (IsPRoConConnection == false) {
                            if (Game is MOHWClient) {
                                cpPassOn.Words.RemoveAt(3);
                            }
                            // Just yell it, we'll capture it and process the return in OnBeforePacketRecv
                            cpPassOn.Words.RemoveAt(1);
                            cpPassOn.Words[0] = "admin.yell";
                        }
                        // Else forward the packet as is so the layer above can append its username.
                    }
                    else if (cpPassOn.Words.Count >= 4 && String.Compare(cpPassOn.Words[0], "procon.admin.say") == 0) {
                        if (IsPRoConConnection == false) {
                            // Just yell it, we'll capture it and process the return in OnBeforePacketRecv
                            cpPassOn.Words.RemoveAt(1);
                            cpPassOn.Words[0] = "admin.say";
                        }
                        // Else forward the packet as is so the layer above can append its username.
                    }

                    // Now forward the packet.
                    SendPacket(new Packet(false, false, ui32MainConnSequence, cpPassOn.Words));
                }
            }
        }
Esempio n. 6
0
        private void client_LayerClientShutdown(PRoConLayerClient sender)
        {
            sender.Login -= new PRoConLayerClient.LayerClientHandler(client_LayerClientLogin);
            sender.Logout -= new PRoConLayerClient.LayerClientHandler(client_LayerClientLogout);
            sender.Quit -= new PRoConLayerClient.LayerClientHandler(client_LayerClientQuit);
            sender.ClientShutdown -= new PRoConLayerClient.LayerClientHandler(client_LayerClientShutdown);
            sender.UidRegistered -= new PRoConLayerClient.LayerClientHandler(client_UidRegistered);

            this.LayerClients.Remove(sender);

            this.SendAccountLogout(sender.Username);
        }
Esempio n. 7
0
 private void client_UidRegistered(PRoConLayerClient sender)
 {
     foreach (PRoConLayerClient clcClient in new List<PRoConLayerClient>(this.LayerClients)) {
         clcClient.OnRegisteredUid(sender.ProconEventsUid, sender.Username);
     }
 }
Esempio n. 8
0
 private void client_LayerClientQuit(PRoConLayerClient sender)
 {
     if (this.LayerClients.Contains(sender.IPPort) == true) {
         this.LayerClients.Remove(sender.IPPort);
         this.SendAccountLogout(sender.Username);
     }
 }
Esempio n. 9
0
 private void client_LayerClientLogout(PRoConLayerClient sender)
 {
     this.SendAccountLogout(sender.Username);
 }
Esempio n. 10
0
        private void client_LayerClientLogin(PRoConLayerClient sender)
        {
            if (this.LayerClients.Contains(sender.Username) == true) {
                // List a logged in account
            }

            foreach (PRoConLayerClient clcClient in new List<PRoConLayerClient>(this.LayerClients)) {
                clcClient.OnAccountLogin(sender.Username, sender.Privileges);
            }
        }
Esempio n. 11
0
        private static void ListenIncommingLayerConnections(IAsyncResult ar)
        {
            PRoConLayer plLayer = (PRoConLayer)ar.AsyncState;

            if (plLayer.m_tclLayerListener != null) {

                try {
                    TcpClient tcpNewConnection = plLayer.m_tclLayerListener.EndAcceptTcpClient(ar);

                    PRoConLayerClient cplcNewConnection = new PRoConLayerClient(new FrostbiteLayerConnection(tcpNewConnection), plLayer.m_praApplication, plLayer.m_prcClient);

                    plLayer.LayerClients.Add(cplcNewConnection);

                    if (plLayer.ClientConnected != null) {
                        FrostbiteConnection.RaiseEvent(plLayer.ClientConnected.GetInvocationList(), cplcNewConnection);
                    }

                    plLayer.m_tclLayerListener.BeginAcceptTcpClient(plLayer.m_asyncAcceptCallback, plLayer);
                }
                catch (SocketException skeError) {

                    if (plLayer.LayerSocketError != null) {
                        FrostbiteConnection.RaiseEvent(plLayer.LayerSocketError.GetInvocationList(), skeError);
                    }

                    plLayer.ShutdownLayerListener();

                    //cbfAccountsPanel.OnLayerServerSocketError(skeError);
                }
                catch (Exception) {

                }
            }
        }
Esempio n. 12
0
        public void ShutdownLayerListener()
        {
            if (this.m_tclLayerListener != null) {

                try {

                    PRoConLayerClient[] cplcShutdownClients = new PRoConLayerClient[this.LayerClients.Count];
                    this.LayerClients.CopyTo(cplcShutdownClients, 0);

                    foreach (PRoConLayerClient cplcShutdownClient in cplcShutdownClients) {

                        cplcShutdownClient.OnShutdown();
                        cplcShutdownClient.Shutdown();
                    }

                    //if (this.m_tclLayerListener != null) {
                        this.m_tclLayerListener.Stop();
                        this.m_tclLayerListener = null;
                    //}
                }
                catch (Exception) { }

                if (this.LayerOffline != null) {
                    FrostbiteConnection.RaiseEvent(this.LayerOffline.GetInvocationList());
                }
            }
            //this.OnLayerServerOffline();
        }