static void Main(string[] args) { //string query = "SELECT TOP (1000) [Id] ,[Username] ,[Password] FROM[SpellBookPact].[dbo].[LoginTable]"; DBLogin.GetPlayer("MyName", "MyPassword"); Console.WriteLine(Console.ReadKey()); //DBConnector.ExecuteSQL(); }
public void Handle(object objData, Server_ServerClient client) { var data = (Message_ClientRequest_Login)objData; var passwordHashed = DBPasswordHash.GetHashString(data.password); var player = DBLogin.GetPlayer(data.name, passwordHashed); var msg = new Message_ServerResponse_Login(player); server.messageSender.Send(msg, client); }
/// <summary> /// Returns the profile of a player /// </summary> /// <param name="username"></param> /// <param name="hashedPassword"></param> /// <returns>Returns the profile of a player, returns null if none were found</returns> public static DBProfile_Stats GetPlayer(string username, string hashedPassword) { var player = DBLogin.GetPlayer(username, hashedPassword); if (player == null) { return(null); } string sql = String.Format("SELECT * FROM [dbo].[{0}] WHERE Id = {1}" , tableName , player.id); Dictionary <string, object> results = new Dictionary <string, object>(); if (DBEndPoint.GetSingleRowSqlSearch(sql, results)) { DBProfile_Stats profile; profile = new DBProfile_Stats((int)results["Wins"], (int)results["Losses"], (int)results["Kills"], (int)results["Deaths"]); return(profile); } return(null); }