public void Dispose() { if (IsDisposed) { return; } IsDisposed = true; if (GetBlockPartyServerTimer != null) { GetBlockPartyServerTimer.Stop(); } if (Socket != null) { if (Socket.IsConnected) { //Leave server if we're in a server if (LastServer != "NONE") { leave_server(LastServer); } Socket.Close(); } } OnDisposed?.Invoke(this, EventArgs.Empty); }
private void Socket_Opened(object sender, EventArgs e) { Debug.WriteLine("\nConnection opened\nStarting get server loop..."); GetBlockPartyServerTimer.Elapsed += track_user; GetBlockPartyServerTimer.Start(); }