Example #1
0
        public static void Switch(GPSPClient client, Dictionary <string, string> recv)
        {
            string command = recv.Keys.First();

            try
            {
                switch (command)
                {
                case "search":
                    SearchHandler.SearchUsers(client, recv);
                    break;

                case "valid":
                    ValidHandler.IsEmailValid(client, recv);
                    break;

                case "nicks":
                    NickHandler.SearchNicks(client, recv);
                    break;

                case "pmatch":
                    PmatchHandler.PlayerMatch(client, recv);
                    break;

                case "check":
                    CheckHandler.CheckProfileid(client, recv);
                    break;

                case "newuser":
                    NewUserHandler.NewUser(client, recv);
                    break;

                case "searchunique":
                    SearchUniqueHandler.SearchProfileWithUniquenick(client, recv);
                    break;

                case "others":
                    OthersHandler.SearchOtherBuddy(client, recv);
                    break;

                case "otherslist":
                    OthersListHandler.SearchOtherBuddyList(client, recv);
                    break;

                case "uniquesearch":
                    UniqueSearchHandler.SuggestUniqueNickname(client, recv);
                    break;

                default:
                    LogWriter.Log.Write("[GPSP] received unknown data " + command, LogLevel.Debug);
                    GameSpyUtils.PrintReceivedGPDictToLogger(command, recv);
                    GameSpyUtils.SendGPError(client, GPErrorCode.Parse, "An invalid request was sended.");
                    break;
                }
            }
            catch (Exception e)
            {
                LogWriter.Log.WriteException(e);
            }
        }
Example #2
0
        public static void Switch(GPCMClient client, Dictionary <string, string> recv, GPCMConnectionUpdate OnSuccessfulLogin, GPCMStatusChanged OnStatusChanged)
        {
            string command = recv.Keys.First();

            try
            {
                switch (command)
                {
                case "inviteto":
                    InviteToHandler.AddFriends(client, recv);
                    break;

                case "login":
                    LoginHandler.ProcessLogin(client, recv, OnSuccessfulLogin, OnStatusChanged);
                    break;

                case "getprofile":
                    GetProfileHandler.SendProfile(client, recv);
                    break;

                case "addbuddy":
                    AddBuddyHandler.Addfriends(client, recv);
                    break;

                case "delbuddy":
                    DelBuddyHandler.Handle(client, recv);
                    break;

                case "updateui":
                    UpdateUiHandler.UpdateUi(client, recv);
                    break;

                case "updatepro":
                    UpdateProHandler.UpdateUser(client, recv);
                    break;

                case "registernick":
                    RegisterNickHandler.RegisterNick(client, recv);
                    break;

                case "logout":
                    client.DisconnectByReason(DisconnectReason.NormalLogout);
                    break;

                case "status":
                    StatusHandler.UpdateStatus(client, recv, OnStatusChanged);
                    break;

                case "newuser":
                    NewUserHandler.NewUser(client, recv);
                    break;

                case "ka":
                    KAHandler.SendKeepAlive(client);
                    break;

                default:
                    LogWriter.Log.Write("[GPCM] received unknown data " + command, LogLevel.Debug);
                    GameSpyUtils.SendGPError(client, GPErrorCode.General, "An invalid request was sended.");
                    break;
                }
            }
            catch (Exception e)
            {
                LogWriter.Log.WriteException(e);
            }
        }