コード例 #1
0
 public PSPCommandHandlerBase(ISession client, Dictionary <string, string> recv) : base(client)
 {
     _recv        = recv;
     _errorCode   = GPErrorCode.NoError;
     _namespaceid = 0;
     _operationID = 1;
 }
コード例 #2
0
ファイル: ErrorMsg.cs プロジェクト: nzgamer41/RetroSpyServer
        /// <summary>
        /// Send a presence error
        /// </summary>
        /// <param name="session">The stream that will receive the error</param>
        /// <param name="errorCode">The error code</param>
        /// <param name="operationID">The operation id</param>
        public static void SendGPSPError(ISession client, GPErrorCode errorCode, uint operationID)
        {
            string errorMsg      = GetErrorMsg(errorCode);
            string sendingBuffer = $@"\error\\err\{errorCode}\fatal\\errmsg\{errorMsg}\id\{operationID}\final\";

            client.SendAsync(sendingBuffer);
        }
コード例 #3
0
ファイル: ErrorMsg.cs プロジェクト: nzgamer41/RetroSpyServer
        /// <summary>
        /// Send a presence error
        /// </summary>
        /// <param name="client">The stream that will receive the error</param>
        /// <param name="errorCode">The error code</param>
        /// <param name="operationID">The operation id</param>
        public static void SendGPCMError(ISession client, GPErrorCode errorCode, uint operationID)
        {
            string errorMsg      = ErrorMsg.GetErrorMsg(errorCode);
            string sendingBuffer = string.Format(@"\error\\err\{0}\fatal\\errmsg\{1}\id\{2}\final\", (uint)errorCode, errorMsg, operationID);

            client.SendAsync(sendingBuffer);
        }
コード例 #4
0
 private static void IsContainAllKey()
 {
     if (!_recv.ContainsKey("sesskey") || !_recv.ContainsKey("newprofileid") || !_recv.ContainsKey("reason"))
     {
         _errorCode = GPErrorCode.Parse;
     }
 }
コード例 #5
0
 public PCMCommandHandlerBase(ISession session, Dictionary <string, string> recv) : base(session)
 {
     _recv        = recv;
     _errorCode   = GPErrorCode.NoError;
     _operationID = 1;
     _namespaceid = 0;
     _session     = (GPCMSession)session.GetInstance();
 }
コード例 #6
0
        //public static GPCMDBQuery DBQuery = null;
        public static void AddFriends(GPCMClient client, Dictionary <string, string> recv)
        {
            GPErrorCode error = IsContainAllKeys(recv);

            if (error != GPErrorCode.NoError)
            {
                GameSpyLib.Common.GameSpyUtils.SendGPError(client, error, "Parsing error in request");
            }
        }
コード例 #7
0
 protected virtual void CheckRequest(GPCMSession session)
 {
     if (_recv.ContainsKey("id"))
     {
         if (!ushort.TryParse(_recv["id"], out _operationID))
         {
             _errorCode = GPErrorCode.Parse;
         }
     }
 }
コード例 #8
0
        //public static GPCMDBQuery DBQuery = null;
        public static void InvitePlayer(GPCMSession session, Dictionary <string, string> recv)
        {
            GPErrorCode error = IsContainAllKeys(recv);

            if (error != GPErrorCode.NoError)
            {
                GameSpyLib.Common.GameSpyUtils.SendGPError(session, error, "Parsing error in request");
            }
            //session.SendAsync(@"\pinvite\\sesskey\223\profileid\13\productid\1038\final\");
        }
コード例 #9
0
 private static void IsContainAllKey()
 {
     if (!_recv.ContainsKey("profileid"))
     {
         _error = GPErrorCode.Parse;
         return;
     }
     if (!_recv.ContainsKey("sesskey"))
     {
         _error = GPErrorCode.Parse;
         return;
     }
     _error = GPErrorCode.NoError;
 }
コード例 #10
0
        /// <summary>
        /// Get nickname through email and password
        /// </summary>
        /// <param name="client"></param>
        /// <param name="dict"></param>
        public static void SearchNicks(GPSPClient client, Dictionary <string, string> dict)
        {
            //Format the password for our database storage
            //if not recieved correct request we terminate
            GPErrorCode error = IsSearchNicksContianAllKeys(dict);

            if (error != GPErrorCode.NoError)
            {
                GameSpyUtils.SendGPError(client, (int)error, "Error recieving SearchNicks request.");
                return;
            }

            List <Dictionary <string, object> > queryResult;

            try
            {
                //get nicknames from GPSPDBQuery class
                queryResult = NickQuery.RetriveNicknames(dict);
            }
            catch (Exception ex)
            {
                LogWriter.Log.Write(ex.Message, LogLevel.Error);
                GameSpyUtils.SendGPError(client, GPErrorCode.DatabaseError, "This request cannot be processed because of a database error.");
                return;
            }

            if (queryResult.Count < 1)
            {
                GameSpyUtils.SendGPError(client, GPErrorCode.DatabaseError, "No match found !");
                return;
            }

            string sendingBuffer;

            sendingBuffer = @"\nr\";
            foreach (Dictionary <string, object> row in queryResult)
            {
                sendingBuffer += @"\nick\";
                sendingBuffer += row["nick"];
                sendingBuffer += @"\uniquenick\";
                sendingBuffer += row["uniquenick"];
            }

            sendingBuffer += @"\ndone\final\";
            client.Stream.SendAsync(sendingBuffer);
        }
コード例 #11
0
        protected virtual void CheckRequest()
        {
            if (_recv.ContainsKey("id"))
            {
                if (!ushort.TryParse(_recv["id"], out _operationID))
                {
                    _errorCode = GPErrorCode.Parse;
                }
            }

            if (_recv.ContainsKey("namespaceid"))
            {
                if (!uint.TryParse(_recv["namespaceid"], out _namespaceid))
                {
                    _errorCode = GPErrorCode.Parse;
                }
            }
        }
コード例 #12
0
        public static void Addfriends(GPCMSession session, Dictionary <string, string> recv)
        {
            _recv      = recv;
            _errorCode = GPErrorCode.NoError;

            //\addbuddy\\sesskey\<>\newprofileid\<>\reason\<>\final\
            IsContainAllKey();
            if (_errorCode != GPErrorCode.NoError)
            {
                return;
            }
            if (session.PlayerInfo.Profileid == Convert.ToUInt16(_recv["profileid"]))
            {
                //you can not add yourself friend
                return;
            }
            AddBuddyQuery.SaveAddBuddyRequest(session.PlayerInfo.Profileid, Convert.ToUInt16(_recv["newprofileid"]), session.PlayerInfo.NamespaceID, _recv["reason"]);
        }
コード例 #13
0
 protected virtual void CheckRequest(GPSPSession session)
 {
     if (_recv.ContainsKey("id"))
     {
         if (!ushort.TryParse(_recv["id"], out _operationID))
         {
             //default operationID
             _operationID        = 1;
             session.OperationID = 1;
         }
     }
     if (_recv.ContainsKey("namespaceid"))
     {
         if (!ushort.TryParse(_recv["namespaceid"], out _namespaceid))
         {
             _errorCode = GPErrorCode.Parse;
         }
     }
 }
コード例 #14
0
        /// <summary>
        /// update the uniquenick
        /// </summary>
        /// <param name="session"></param>
        /// <param name="dict"></param>
        public static void RegisterNick(GPCMSession session, Dictionary <string, string> dict)
        {
            GPErrorCode error = IsContainAllKeys(dict);

            if (error != GPErrorCode.NoError)
            {
                GameSpyUtils.SendGPError(session, error, "Parsing error");
                return;
            }
            string sendingBuffer;

            try
            {
                RegisterNickQuery.UpdateUniquenick(dict["uniquenick"], session.PlayerInfo.SessionKey, Convert.ToUInt16(dict["patnerid"]));
                sendingBuffer = @"\rn\final\";
                session.Send(sendingBuffer);
            }
            catch (Exception e)
            {
                LogWriter.Log.WriteException(e);
            }
        }
コード例 #15
0
        /// <summary>
        /// update the uniquenick
        /// </summary>
        /// <param name="client"></param>
        /// <param name="dict"></param>
        public static void RegisterNick(GPCMClient client, Dictionary <string, string> dict)
        {
            GPErrorCode error = IsContainAllKeys(dict);

            if (error != GPErrorCode.NoError)
            {
                GameSpyUtils.SendGPError(client, error, "Parsing error");
                return;
            }
            string sendingBuffer;

            try
            {
                RegisterNickQuery.UpdateUniquenick(dict);
                sendingBuffer = @"\rn\final\";
                client.Send(sendingBuffer);
            }
            catch (Exception e)
            {
                LogWriter.Log.WriteException(e);
            }
        }
コード例 #16
0
        /// <summary>
        /// Creates an account and use new account to login
        /// </summary>
        /// <param name="client">The client that sended the data</param>
        /// <param name="dict">The request that the stream sended</param>
        public static void NewUser(GPCMClient client, Dictionary <string, string> dict)
        {
            //Format the password for our database storage
            GPErrorCode error = IsRequestContainAllKeys(dict);

            //if there do not recieved right <key,value> pairs we send error
            if (error != GPErrorCode.NoError)
            {
                GameSpyUtils.SendGPError(client, error, "Error recieving request. Please check the input!");
                return;
            }

            //Check the nick and uniquenick is formated correct and uniquenick is existed in database
            string sendingBuffer;

            error = IsEmailNickUniquenickValied(dict);
            if (error != GPErrorCode.NoError)
            {
                sendingBuffer = string.Format(@"\nur\{0}\final\", (int)error);
                client.Send(sendingBuffer);
                return;
            }

            //if the request did not contain uniquenick and namespaceid we use our way to create it.
            PreProcessRequest(dict);
            //we get the userid in database. If no userid found according to email we create one
            //and store the new account into database.
            int profileid = CreateAccount(dict);

            if (profileid == -1)
            {
                GameSpyUtils.SendGPError(client, GPErrorCode.DatabaseError, "Account is existed, please use another one.");
            }
            else
            {
                sendingBuffer = string.Format(@"\nur\0\pid\{0}\final\", profileid);
                client.Send(sendingBuffer);
            }
        }
コード例 #17
0
        /// <summary>
        /// we just simply check the existance of the unique nickname in the database and suggest some numbered postfix nickname
        /// </summary>
        /// <param name="client"></param>
        /// <param name="dict"></param>
        public static void SuggestUniqueNickname(GPSPClient client, Dictionary <string, string> dict)
        {
            //The multiple nick suggest correct response is like
            //@"\us\<number of suggested nick>\nick\<nick1>\nick\<nick2>\usdone\final\";
            string      sendingBuffer;
            GPErrorCode error = IsContainAllKeys(dict);

            if (error != GPErrorCode.NoError)
            {
                GameSpyUtils.SendGPError(client, GPErrorCode.Parse, "There was an error parsing an incoming request.");
                return;
            }

            if (UniqueSearchQuery.IsUniqueNickExist(dict))
            {
                GameSpyUtils.SendGPError(client, GPErrorCode.General, "The Nick is existed, please choose another name");
            }
            else
            {
                sendingBuffer = @"\us\1\nick\" + dict["preferrednick"] + @"\usdone\final\";
                client.Send(sendingBuffer);
            }
        }
コード例 #18
0
ファイル: ErrorMsg.cs プロジェクト: nzgamer41/RetroSpyServer
        public static string GetErrorMsg(GPErrorCode errorCode)
        {
            switch (errorCode)
            {
            ///General error message
            case GPErrorCode.General:
                return("There was an unknown error.");

            case GPErrorCode.Parse:
                return("There was an error parsing an incoming request.");

            case GPErrorCode.NotLoggedIn:
                return("This request cannot be processed because you are not logged in.");

            case GPErrorCode.BadSessionKey:
                return("This request cannot be processed because the _session key is invalid.");

            case GPErrorCode.DatabaseError:
                return("Can not find information in database");

            case GPErrorCode.Network:
                return("here was an error connecting a network socket.");

            case GPErrorCode.ForcedDisconnect:
                return("This profile has been disconnected by another login.");

            case GPErrorCode.ConnectionClose:
                return("The server has closed the connection");

            case GPErrorCode.UdpLayer:
                return("There was a problem with the UDP layer.");


            ///Login error message
            case GPErrorCode.Login:
                return("There was an error logging in to the GP backend.");

            case GPErrorCode.LoginTimeOut:
                return("The login attempt timed out.");

            case GPErrorCode.LoginBadNick:
                return("The nickname provided was incorrect.");

            case GPErrorCode.LoginBadEmail:
                return("The email address provided was incorrect.");

            case GPErrorCode.LoginBadPassword:
                return("The password provided was incorrect.");

            case GPErrorCode.LoginBadProfile:
                return("The profile provided was incorrect.");

            case GPErrorCode.LoginProfileDeleted:
                return("The profile has been deleted.");

            case GPErrorCode.LoginConnectionFailed:
                return("The server has refused the connection.");

            case GPErrorCode.LoginServerAuthFaild:
                return("The server could not be authenticated.");

            case GPErrorCode.LoginBadUniquenick:
                return("The uniquenick provided is incorrect.");

            case GPErrorCode.LoginBadPreAuth:
                return("There was an error validating the pre-authentication.");

            case GPErrorCode.LoginBadLoginTicket:
                return("The login ticket was unable to be validated.");

            case GPErrorCode.LoginTicketExpired:
                return("The login ticket had expired and could not be used.");


            ///New user errors
            case GPErrorCode.NewUser:
                return("There was an error creating a new user.");

            case GPErrorCode.NewUserBadNick:
                return("A profile with that nick already exists.");

            case GPErrorCode.NewUserBadPasswords:
                return("The password does not match the email address.");

            case GPErrorCode.NewUserUniquenickInvalid:
                return("The uniquenick is invalid.");

            case GPErrorCode.NewUserUniquenickInUse:
                return("The uniquenick is already in use.");


            ///UpdateUi
            case GPErrorCode.UpdateUI:
                return("There was an error updating the user information.");

            case GPErrorCode.UpdateUIBadEmail:
                return("A user with the email adress provided already exists.");


            ///Newprofile
            case GPErrorCode.NewProfile:
                return("There was an error creating a new profile.");

            case GPErrorCode.NewProfileBadNick:
                return("The nickname to be replaced does not exist.");

            case GPErrorCode.NewProfileBadOldNick:
                return("A profile with the nickname provided already exists.");


            ///Updatepro
            case GPErrorCode.UpdatePro:
                return("There was an error updating the profile information.");

            case GPErrorCode.UpdatePROBadNick:
                return("A user with the nickname provided already exists.");


            ///Addbuddy
            case GPErrorCode.AddBuddy:
                return("There was an error adding a buddy.");

            case GPErrorCode.AddBuddyBadForm:
                return("The profile requesting to add a buddy is invaild.");

            case GPErrorCode.AddBuddyBadNew:
                return("The profile requested is invalid.");

            case GPErrorCode.AddBuddyAlreadyBuddy:


            //_return "The profile requested is already a buddy.You tried to register a profile id which is already in your friendlist.";
            //_return "The profile requested is on the local profile's block list.";
            //_return "Reserved for future use The profile requested is blocking you.";


            ///Authadd
            case GPErrorCode.AuthAdd:
                return("There was an error authorizing an add buddy request.");

            case GPErrorCode.AuthAddBadForm:
                return("The profile being authorized is invalid.");

            case GPErrorCode.AuthAddBadSig:
                return("The signature for the authorization is invalid.");

            case GPErrorCode.Status:
                return("There was an error with the status string.");

            case GPErrorCode.Bm:
                return("There was an error sending a buddy message.");

            case GPErrorCode.BmNotBuddy:
                return("The profile the message was to be sent to is not a buddy.");

            case GPErrorCode.BmExtInfoNotSupported:
                return("The profile does not support extended info keys.");

            case GPErrorCode.BmBuddyOffline:
                return("The buddy to send a message to is offline.");

            case GPErrorCode.GetProfile:
                return("There was an error getting profile info.");

            case GPErrorCode.GetProfileBadProfile:
                return("The profile info was requested on is invalid.");

            case GPErrorCode.DelBuddy:
                return("There was an error deleting the buddy.");

            case GPErrorCode.DelBuddyNotBuddy:
                return("The buddy to be deleted is not a buddy.");

            case GPErrorCode.DelProfile:
                return("There was an error deleting the profile.");

            case GPErrorCode.DelProfileLastProfile:
                return("The last profile cannot be deleted.");


            ///AddBlock
            case GPErrorCode.AddBlock:
                return("There was an error adding the player to the blocked list.");

            case GPErrorCode.AddBlockAlreadyBlocked:
                return("The profile specified is already blocked.");


            ///RemoveBlock
            case GPErrorCode.RemoveBlock:
                return("There was an error removing the player from the blocked list.");

            case GPErrorCode.RemoveBlockNotBlocked:
                return("The profile specified was not a member of the blocked list.");


            ///Registeruniquenick
            case GPErrorCode.RegisterUniquenick:
                return("There was an error registering the uniquenick.");

            case GPErrorCode.RegisterUniquenickTaken:
                return("The uniquenick is already taken.");

            case GPErrorCode.RegisterUniquenickReserved:
                return("The uniquenick is reserved.");

            case GPErrorCode.RegisterUniquenickBadNamespace:
                return("Tried to register a nick with no namespace set.");


            default:
                return("General error.");
            }
        }
コード例 #19
0
 public GPException(string message, GPErrorCode errorCode, System.Exception innerException) : base(message, innerException)
 {
     ErrorCode = errorCode;
 }
コード例 #20
0
 public GPLoginException(string message, GPErrorCode errorCode) : base(message, errorCode)
 {
 }
コード例 #21
0
 public GPNewProfileException(string message, GPErrorCode errorCode, System.Exception innerException) : base(message, errorCode, innerException)
 {
 }
コード例 #22
0
 public GPNewProfileException(string message, GPErrorCode errorCode) : base(message, errorCode)
 {
 }
コード例 #23
0
 public GPNewUserException(string message, GPErrorCode errorCode) : base(message, errorCode)
 {
 }
コード例 #24
0
 public GPUpdateUIException(string message, GPErrorCode errorCode) : base(message, errorCode)
 {
 }
コード例 #25
0
 public CheckException(string message, GPErrorCode errorCode) : base(message, errorCode)
 {
 }
コード例 #26
0
 public GPException(string message, GPErrorCode errorCode) : base(message)
 {
     ErrorCode = errorCode;
 }
コード例 #27
0
 public CheckException(string message, GPErrorCode errorCode, System.Exception innerException) : base(message, errorCode, innerException)
 {
 }
コード例 #28
0
        /// <summary>
        /// This method verifies the login information sent by
        /// the client, and returns encrypted data for the client
        /// to verify as well
        /// </summary>
        public static void ProcessLogin(GPCMClient client, Dictionary <string, string> recv, GPCMConnectionUpdate OnSuccessfulLogin, GPCMStatusChanged OnStatusChanged)
        {
            uint partnerID = 0;

            // Make sure we have all the required data to process this login
            //if (!recv.ContainsKey("challenge") || !recv.ContainsKey("response"))
            //{
            //    GameSpyUtils.SendGPError(client, GPErrorCode.General, "Invalid response received from the client!");
            //    client.DisconnectByReason(DisconnectReason.InvalidLoginQuery);
            //    return;
            //}
            if (IsContainAllKeys(recv) != GPErrorCode.NoError)
            {
                GameSpyUtils.SendGPError(client, GPErrorCode.General, "Invalid response received from the client!");
                client.DisconnectByReason(DisconnectReason.InvalidLoginQuery);
                return;
            }


            // Parse the partnerid, required since it changes the challenge for Unique nick and User login
            ParseRequestToPlayerInfo(client, recv, ref partnerID);


            // Dispose connection after use
            try
            {
                // Try and fetch the user from the database

                Dictionary <string, object> queryResult;

                try
                {
                    if (client.PlayerInfo.PlayerUniqueNick.Length > 0)
                    {
                        queryResult = LoginQuery.GetUserFromUniqueNick(recv);
                    }
                    else if (client.PlayerInfo.PlayerAuthToken.Length > 0)
                    {
                        //TODO! Add the database entry
                        GameSpyUtils.SendGPError(client, GPErrorCode.General, "AuthToken is not supported yet");
                        return;
                    }
                    else
                    {
                        queryResult = LoginQuery.GetUserFromNickAndEmail(recv);
                    }
                }
                catch (Exception ex)
                {
                    LogWriter.Log.WriteException(ex);
                    GameSpyUtils.SendGPError(client, GPErrorCode.DatabaseError, "This request cannot be processed because of a database error.");
                    return;
                }

                //if no match found we disconnect the game
                if (queryResult == null)
                {
                    if (client.PlayerInfo.PlayerUniqueNick.Length > 0)
                    {
                        GameSpyUtils.SendGPError(client, GPErrorCode.LoginBadUniquenick, "The uniquenick provided is incorrect!");
                    }
                    else
                    {
                        GameSpyUtils.SendGPError(client, GPErrorCode.LoginBadUniquenick, "The information provided is incorrect!");
                    }
                    client.DisconnectByReason(DisconnectReason.InvalidUsername);
                    return;
                }

                // Check if user is banned
                string           msg;
                DisconnectReason reason;
                GPErrorCode      error = CheckUsersAccountAvailability(queryResult, out msg, out reason);
                if (error != GPErrorCode.NoError)
                {
                    GameSpyUtils.SendGPError(client, error, msg);
                    client.DisconnectByReason(reason);
                    return;
                }

                // we finally set the player variables and return challengeData
                string challengeData = SetPlayerInfo(client, queryResult, recv);
                string sendingBuffer;
                // Use the GenerateProof method to compare with the "response" value. This validates the given password
                if (recv["response"] == GenerateProof(recv["challenge"], client.ServerChallengeKey, challengeData, client.PlayerInfo.PlayerAuthToken.Length > 0 ? 0 : partnerID, client.PlayerInfo))
                {
                    // Create session key
                    client.SessionKey = Crc.ComputeChecksum(client.PlayerInfo.PlayerUniqueNick);

                    //actually we should store sesskey in database at namespace table, when we want someone's profile we just
                    //access to the sesskey to find the uniquenick for particular game
                    LoginQuery.UpdateSessionKey(recv, client.SessionKey, client.PlayerInfo);

                    // Password is correct
                    sendingBuffer = string.Format(@"\lc\2\sesskey\{0}\proof\{1}\userid\{2}\profileid\{2}\uniquenick\{3}\lt\{4}__\id\1\final\",
                                                  client.SessionKey,
                                                  GenerateProof(client.ServerChallengeKey, recv["challenge"], challengeData, client.PlayerInfo.PlayerAuthToken.Length > 0 ? 0 : partnerID, client.PlayerInfo), // Do this again, Params are reversed!
                                                  client.PlayerInfo.PlayerId,
                                                  client.PlayerInfo.PlayerUniqueNick,
                                                  // Generate LT whatever that is (some sort of random string, 22 chars long)
                                                  GameSpyLib.Common.Random.GenerateRandomString(22, GameSpyLib.Common.Random.StringType.Hex)
                                                  );
                    //Send response to client
                    client.Send(sendingBuffer);
                    // Log Incoming Connections
                    //LogWriter.Log.Write(LogLevel.Info, "{0,-8} [Login] {1} - {2} - {3}", client.ServerName, client.PlayerInfo.PlayerNick, client.PlayerInfo.PlayerId, RemoteEndPoint);
                    //string statusString = string.Format(" [Login Success!] Nick:{0} - Profileid:{1} - IP:{2}", client.PlayerInfo.PlayerNick, client.PlayerInfo.PlayerId, client.RemoteEndPoint);
                    client.StatusToLog("Login Success", client.PlayerInfo.PlayerNick, client.PlayerInfo.PlayerId, client.RemoteEndPoint, null);
                    // Update status last, and call success login
                    client.PlayerInfo.LoginStatus          = LoginStatus.Completed;
                    client.PlayerInfo.PlayerStatus         = PlayerStatus.Online;
                    client.PlayerInfo.PlayerStatusString   = "Online";
                    client.PlayerInfo.PlayerStatusLocation = "";
                    client.CompletedLoginProcess           = true;

                    OnSuccessfulLogin?.Invoke(client);
                    OnStatusChanged?.Invoke(client);
                    SendBuddiesHandler.HandleSendBuddies(client, recv);
                }
                else
                {
                    // Log Incoming Connection
                    string statusString = string.Format(@"[Login Failed!] Nick:{0} - Profileid:{1} - IP:{2}", client.PlayerInfo.PlayerNick, client.PlayerInfo.PlayerId, client.RemoteEndPoint);
                    client.ToLog(LogLevel.Info, statusString);
                    // Password is incorrect with database value.
                    client.Send(@"\error\\err\260\fatal\\errmsg\The password provided is incorrect.\id\1\final\");
                    client.DisconnectByReason(DisconnectReason.InvalidPassword);
                }
            }
            catch (Exception ex)
            {
                LogWriter.Log.Write(ex.ToString(), LogLevel.Error);
                client.DisconnectByReason(DisconnectReason.GeneralError);
                return;
            }
        }
コード例 #29
0
 public GPUpdateUIException(string message, GPErrorCode errorCode, System.Exception innerException) : base(message, errorCode, innerException)
 {
 }
コード例 #30
0
ファイル: ErrorMsg.cs プロジェクト: nzgamer41/RetroSpyServer
        public static string GetErrorMsg(GPErrorCode errorCode)
        {
            switch (errorCode)
            {
            ///General error message
            case GPErrorCode.General:
                return("There was an unknown error.");

            case GPErrorCode.Parse:
                return("There was an error parsing an incoming request.");

            case GPErrorCode.NotLoggedIn:
                return("This request cannot be processed because you are not logged in.");

            case GPErrorCode.BadSessionKey:
                return("This request cannot be processed because the session key is invalid.");

            case GPErrorCode.DatabaseError:
                return("Can not find information in database");

            case GPErrorCode.Network:
                return("here was an error connecting a network socket.");

            case GPErrorCode.ForcedDisconnect:
                return("This profile has been disconnected by another login.");

            case GPErrorCode.ConnectionClose:
                return("The server has closed the connection");

            case GPErrorCode.UdpLayer:
                return("There was a problem with the UDP layer.");


            // Search.
            //////////
            case GPErrorCode.Search:
                return("There was an error searching for a profile.");

            case GPErrorCode.SearchConnectionFailed:
                return("The search attempt failed to connect to the server.");

            case GPErrorCode.SearchTimeOut:
                return("The search did not return in a timely fashion.");


            // Check.
            /////////
            case GPErrorCode.Check:
                return("There was an error checking the user account.");

            case GPErrorCode.CheckBadMail:
                return("No account exists with the provided e-mail address.");

            case GPErrorCode.CheckBadNick:
                return("No such profile exists for the provided e-mail adress.");

            case GPErrorCode.CheckBadPassword:
                return("The password is incorrect.");


            // Revoke.
            //////////
            case GPErrorCode.Revoke:
                return("There was an error revoking the buddy.");

            case GPErrorCode.RevokeNotBuddy:
                return("You are not a buddy of the profile.");


            // Register cdkey.
            //////////////////
            case GPErrorCode.RegisterCDKey:
                return("There was an error registering the cdkey.");

            case GPErrorCode.RegisterCDKeyBadKey:
                return("The cdkey is invalid.");

            case GPErrorCode.RegisterCDKeyAlreadySet:
                return("The profile has already been registered with a different cdkey.");

            case GPErrorCode.RegisterCDKeyAlreadyTaken:
                return("The cdkey has already been registered to another profile.");


            default:
                return("General error.");
            }
        }