BF2Statistics.Gamespy.GpcmClient.Dispose C# (CSharp) Method

Dispose() public method

Disposes of the client object. The connection is no longer closed here and the Disconnect even is NO LONGER fired
public Dispose ( ) : void
return void
        public void Dispose()
        {
            // Preapare to be unloaded from memory
            if (Disposed) return;
            Disposed = true;

            // Disconenct if we havent already
            if (Status != LoginStatus.Disconnected)
                Disconnect(1);
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Callback for when a connection had disconnected
        /// </summary>
        /// <param name="client">The client object whom is disconnecting</param>
        private void GpcmClient_OnDisconnect(GpcmClient client)
        {
            // Remove client, and call OnUpdate Event
            try
            {
                // Remove client from online list
                if (Clients.TryRemove(client.PlayerId, out client) && !client.Disposed)
                {
                    client.Dispose();
                }

                // Call Event
                OnClientsUpdate(this, EventArgs.Empty);
            }
            catch (Exception e)
            {
                L.LogError("An Error occured at [GpcmServer.GpcmClient_OnDisconnect] : Generating Exception Log");
                ExceptionHandler.GenerateExceptionLog(e);
            }
        }
All Usage Examples Of BF2Statistics.Gamespy.GpcmClient::Dispose