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(); }
private void connBt_Click(object sender, RoutedEventArgs e) { string endpoint = serverTbx.Text; if (options.GetEndpoints() != null) { options.GetEndpoints().Clear(); } if (!string.IsNullOrEmpty(endpoint)) { JArray ja = new JArray(); ja.Add(endpoint); options.SetEndpoints(ja); } //options.AuthCb = new AuthenticationCallback( // (username, Login) => // { // Debug.WriteLine("AuthenticationCallback called!"); // Login(username, "u1"); // } // ); client.Connect(usernamTbx.Text, passwordTbx.Text, options); }
protected void DoConnect() { _client.Connect(HClient.ServerAddress, HClient.ServerPort); }