BF2Statistics.Database.GamespyDatabase.GetUsersByEmailPass C# (CSharp) Method

GetUsersByEmailPass() public method

Fetches an account from the gamespy database
public GetUsersByEmailPass ( string Email, string Password ) : object>>.List
Email string The Account email
Password string the MD5 HASHED Account Password
return object>>.List
        public List<Dictionary<string, object>> GetUsersByEmailPass(string Email, string Password)
        {
            return base.Query("SELECT * FROM accounts WHERE email=@P0 AND password=@P1", Email.ToLowerInvariant(), Password);
        }

Usage Example

        /// <summary>
        /// This method is requested by the client when logging in to fetch all the account
        /// names that have the specified email address and password combination
        /// </summary>
        /// <param name="recvData"></param>
        private void SendNicks(Dictionary<string, string> recvData)
        {
            // Make sure we have the needed data
            if (!recvData.ContainsKey("email") || (!recvData.ContainsKey("pass") && !recvData.ContainsKey("passenc")))
            {
                Stream.SendAsync(@"\error\\err\0\fatal\\errmsg\Invalid Query!\id\1\final\");
                return;
            }

            // Try to get user data from database
            try
            {
                // Get our password from the provided query
                string password = (recvData.ContainsKey("pass"))
                    ? recvData["pass"]
                    : GamespyUtils.DecodePassword(recvData["passenc"]);

                // Fetch accounts
                using (GamespyDatabase Db = new GamespyDatabase())
                {
                    var Clients = Db.GetUsersByEmailPass(recvData["email"], password.GetMD5Hash(false));
                    StringBuilder Response = new StringBuilder(@"\nr\" + Clients.Count);
                    for (int i = 0; i < Clients.Count; i++)
                        Response.AppendFormat(@"\nick\{0}\uniquenick\{0}", Clients[i]["name"]);

                    Response.Append(@"\ndone\\final\");
                    Stream.SendAsync(Response.ToString());
                }
            }
            catch
            {
                Stream.SendAsync(@"\error\\err\551\fatal\\errmsg\Unable to get any associated profiles.\id\1\final\");
            }
        }