BF2Statistics.Gamespy.GpcmServer.GpcmClient_OnSuccessfulLogin C# (CSharp) Method

GpcmClient_OnSuccessfulLogin() private method

Callback for a successful login
private GpcmClient_OnSuccessfulLogin ( object sender ) : void
sender object The GpcmClient that is logged in
return void
        private void GpcmClient_OnSuccessfulLogin(object sender)
        {
            // Wrap this in a try/catch
            try
            {
                GpcmClient oldC;
                GpcmClient client = sender as GpcmClient;

                // Check to see if the client is already logged in, if so disconnect the old user
                if (Clients.TryRemove(client.PlayerId, out oldC))
                {
                    oldC.Disconnect(1);
                    return;
                }

                // Remove connection from processing
                Processing.TryRemove(client.ConnectionId, out oldC);

                // Add current client to the dictionary
                if (!Clients.TryAdd(client.PlayerId, client))
                {
                    Program.ErrorLog.Write("ERROR: [GpcmServer._OnSuccessfulLogin] Unable to add client to HashSet.");
                    return;
                }

                // Fire event
                OnClientsUpdate(this, EventArgs.Empty);
            }
            catch (Exception E)
            {
                Program.ErrorLog.Write("ERROR: [GpcmServer._OnSuccessfulLogin] Exception was thrown, Generating exception log.");
                ExceptionHandler.GenerateExceptionLog(E);
            }
        }
    }