Пример #1
0
            private void SendProtocolEvent(XmlRequest xmlRequest)
            {
                switch (xmlRequest.FirstTag) {
                    case "login":
                        Login login = new Login(peer, xmlRequest);
                        if (login.Authentication() == true && login.User != null) {
                            // Add to Known User
                            P2PManager.AddPeer(login.User, peer);

                            // Start Login Event
                            CmdManager.LoginEvent(peer, login.User);
                        } else {
                            Debug.Log("Auth Failed: {0}", peer.GetRemoteIP());
                        }
                        break;
                    case "quit":
                        CmdManager.QuitEvent(peer, xmlRequest);
                        break;
                    case "error":
                        CmdManager.ErrorEvent(peer, xmlRequest);
                        break;
                    case "get":
                        CmdManager.GetEvent(peer, xmlRequest);
                        break;
                    case "ask":
                        CmdManager.AskEvent(peer, xmlRequest);
                        break;
                    case "snd":
                        CmdManager.SndEvent(peer, xmlRequest);
                        break;
                    case "snd-start":
                        CmdManager.SndStartEvent(peer, xmlRequest);
                        break;
                    case "snd-end":
                        CmdManager.SndEndEvent(peer, xmlRequest);
                        break;
                    case "snd-abort":
                        CmdManager.SndAbortEvent(peer, xmlRequest);
                        break;
                    case "recv-abort":
                        CmdManager.RecvAbortEvent(peer, xmlRequest);
                        break;
                    default:
                        CmdManager.UnknownEvent(peer, xmlRequest);
                        break;
                }
            }