/// <summary> /// Purges the client. /// </summary> private void PurgeClient() { if (CurrentServerInfo != null) { CurrentServerInfo = null; } Client?.Dispose(); HostnameUpdated?.Invoke(this, new HostnameEventArgs() { NewHostname = "", Timestamp = DateTime.Now }); CurrentPlayerCountUpdated?.Invoke(this, new PlayerCountEventArgs() { PlayerCount = 0 }); }
/// <summary> /// Handles the <see cref="E:ServerConnectionSucceeded" /> event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="ServerConnectionEventArgs" /> instance containing the event data.</param> public void OnServerConnectionSucceeded(object sender, ServerConnectionEventArgs args) { try { args.ConnectionInfo = CurrentServerInfo; ServerConnectionSucceeded?.Invoke(this, args); HostnameUpdated?.Invoke(this, new HostnameEventArgs() { NewHostname = CurrentServerInfo.Hostname, Timestamp = DateTime.Now }); RequestAuth(CurrentServerInfo.Password); } catch { // ignored } }