void ServerRequestFunc() { _loadStatus = LoadStatus.FetchingFromServer; // Connect to server HClient client = new HClient("ServerRequestFunc"); client.Connect(HClient.ServerAddress, HClient.ServerPort); client.OnGameInfoResponse += Client_OnGameInfoResponse; client.OnAccountResponse += Client_OnAccountResponse; if (!client.Connected) { _loadStatus = LoadStatus.ServerUnreachable; } else { // Send request client.SendAccountRequest(_userName, _passWord, _accountCreate ? _userName : null, _oauthMode); // Wait for response while (client.Connected && _loadStatus == LoadStatus.FetchingFromServer) { client.Update(); Task.Delay(10).Wait(); } client.Close(); } }
void ValidateWithServer() { _loadStatus = LoadStatus.FetchingFromServer; // Connect to server HClient client = new HClient("ValidateWithServer"); client.Connect(HClient.ServerAddress, HClient.ServerPort); client.OnGameInfoResponse += Client_OnGameInfoResponse; client.OnAccountResponse += Client_OnAccountResponse; // Send request client.SendValidateGameInfoRequest(m_GameInfo.AuthString, Encoding.UTF8.GetString(m_GameInfo.Hash, 0, m_GameInfo.Hash.Length)); // Wait for response while (client.Connected && _loadStatus == LoadStatus.FetchingFromServer) { client.Update(); Task.Delay(10).Wait(); } client.Close(); }