コード例 #1
0
ファイル: PluginManager.cs プロジェクト: phelom/Procon-1
 private void client_LayerClientLogin(PRoConLayerClient sender) {
     InvokeOnAllEnabled("OnAccountLogin", sender.Username, sender.IPPort, sender.Privileges);
 }
コード例 #2
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
 private void CPRoConLayerClient_LayerClientShutdown(PRoConLayerClient sender) {
     this.UnregisterEvents();
 }
コード例 #3
0
ファイル: PluginManager.cs プロジェクト: phelom/Procon-1
 private void Layer_ClientConnected(PRoConLayerClient client) {
     client.Login += new PRoConLayerClient.LayerClientHandler(client_LayerClientLogin);
     client.Logout += new PRoConLayerClient.LayerClientHandler(client_LayerClientLogout);
 }
コード例 #4
0
ファイル: PRoConLayer.cs プロジェクト: eaceaser/PRoCon
 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);
 }
コード例 #5
0
ファイル: PRoConClient.cs プロジェクト: phelom/Procon-1
        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));
                }
            }
        }
コード例 #6
0
ファイル: PRoConLayer.cs プロジェクト: eaceaser/PRoCon
        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);
        }
コード例 #7
0
ファイル: PRoConLayer.cs プロジェクト: eaceaser/PRoCon
 private void client_UidRegistered(PRoConLayerClient sender)
 {
     foreach (PRoConLayerClient clcClient in new List<PRoConLayerClient>(this.LayerClients)) {
         clcClient.OnRegisteredUid(sender.ProconEventsUid, sender.Username);
     }
 }
コード例 #8
0
ファイル: PRoConLayer.cs プロジェクト: eaceaser/PRoCon
 private void client_LayerClientQuit(PRoConLayerClient sender)
 {
     if (this.LayerClients.Contains(sender.IPPort) == true) {
         this.LayerClients.Remove(sender.IPPort);
         this.SendAccountLogout(sender.Username);
     }
 }
コード例 #9
0
ファイル: PRoConLayer.cs プロジェクト: eaceaser/PRoCon
 private void client_LayerClientLogout(PRoConLayerClient sender)
 {
     this.SendAccountLogout(sender.Username);
 }
コード例 #10
0
ファイル: PRoConLayer.cs プロジェクト: eaceaser/PRoCon
        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);
            }
        }
コード例 #11
0
ファイル: PRoConLayer.cs プロジェクト: eaceaser/PRoCon
        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) {

                }
            }
        }
コード例 #12
0
ファイル: PRoConLayer.cs プロジェクト: eaceaser/PRoCon
        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();
        }