private MSession getSession(AuthenticationResponse mcToken) { if (mcToken == null) { throw new ArgumentNullException("mcToken was null"); } if (!MojangAPI.CheckGameOwnership(mcToken.AccessToken)) { MessageBox.Show("로그인 실패 : 게임 구매를 하지 않았습니다."); this.Close(); } var profile = MojangAPI.GetProfileUsingToken(mcToken.AccessToken); return(new MSession { AccessToken = mcToken.AccessToken, UUID = profile.UUID, Username = profile.Name }); }
public MLoginResponse RequestSession(string accessToken) { try { if (!MojangAPI.CheckGameOwnership(accessToken)) { return(new MLoginResponse(MLoginResult.NoProfile, null, null, null)); } var profile = MojangAPI.GetProfileUsingToken(accessToken); var session = new MSession { Username = profile.Name, AccessToken = accessToken, UUID = profile.UUID }; return(new MLoginResponse(MLoginResult.Success, session, null, null)); } catch (Exception ex) { return(new MLoginResponse(MLoginResult.UnknownError, null, ex.ToString(), null)); } }