public static void Login(Int32 userNo, Int32 authKey, Action<GameUser, Int32> actionOnComplete) { GameUser user = Find(userNo); if (user != null) Logout(userNo); using (DBCommand cmd = AuthDB.NewCommand()) { Int32 dbAuthKey = -1; cmd.CommandText.Append($"select authkey from t_accounts where userno={userNo};"); cmd.PostQuery(() => { if (cmd.Reader.Read()) dbAuthKey = cmd.Reader.GetInt32(0); }, (exception) => { if (exception != null) { actionOnComplete(null, ResultCode.Database_Error); Logger.Write(LogType.Err, 2, exception.ToString()); } // 인증키 확인 else if (dbAuthKey == authKey) { // 유저데이터 및 게임데이터 로드 user = new GameUser(userNo); user.LoadFromDB((result) => { _users.Add(userNo, new UserData(user)); actionOnComplete(user, result); }); } // 잘못된 인증키 else actionOnComplete(null, ResultCode.InvalidAuthKey); }); } }