Exemple #1
0
        internal static void DetachClient(AttachedClient client, string reason)
        {
            if (client == null)
            {
                return;
            }

            lock (addRemoveClientLock)
            {
                if (client.IsConnected())
                {
                    client.Disconnect(reason);
                }

                // Remove the client
                if (Clients.ContainsKey(client.TrackingId))
                {
                    Clients.Remove(client.TrackingId);
                }

                // Remove the client's focus on the character they may be tracking
                if (ClientFocusedCharacters.ContainsKey(client.TrackingId))
                {
                    ClientFocusedCharacters.Remove(client.TrackingId);
                }
            }
        }
Exemple #2
0
 internal static void AttachClient(AttachedClient client)
 {
     lock (addRemoveClientLock)
     {
         if (!Clients.ContainsKey(client.TrackingId))
         {
             Clients.Add(client.TrackingId, client);
         }
     }
 }
Exemple #3
0
 internal static AttachedClient GetClientFromConnection(Connection connection)
 {
     lock (addRemoveClientLock)
     {
         var client = Clients.Values.FirstOrDefault(c => c.EqualsConnection(connection));
         if (client == null)
         {
             client = new AttachedClient();
             client.SetConnection(connection);
             AttachClient(client);
         }
         return(client);
     }
 }