public Guid?Login(string username, string password, out AccountManagerErrorCode accountManagerErrorCode) { // initialize connection InitializeConnection(); accountManagerErrorCode = AccountManagerErrorCode.Ok; Guid?login = null; try { login = _service.Login(username, HashHelper.GetMd5Hash(password), out accountManagerErrorCode); } catch (Exception e) { FatalError(e); } if (!login.HasValue) { MessageBox.Message = "Login error!"; MessageBox.Next = ScreenManager.ScreenEnum.LoginScreen; ScreenManager.Instance.SetActiveScreen(ScreenManager.ScreenEnum.MessageBoxScreen); } return(login); }
private bool Login(string username, string password) { try { AccountManagerErrorCode errorCode; Guid?id = _service.Login(username, HashHelper.GetMd5Hash(password), out errorCode); if (id != null) { _me = new AGameObject() { Coordinates = Vector2.Zero, Id = (Guid)id }; SetStatus("Logon successfull"); return(true); } SetStatus(String.Format("ERROR: {0}", errorCode)); return(false); } catch (Exception) { return(false); } }