Beispiel #1
0
 /// <summary>
 /// Deletes the specified room
 /// </summary>
 /// <param name="roomID"></param>
 public static void DeleteRoom(string roomID)
 {
     if (!Rooms.ContainsKey(roomID))
     {
         return;
     }
     lock (Rooms)
     {
         ChatRoom room = Rooms[roomID];
         room.Dispose();
         Rooms.Remove(roomID);
     }
 }
Beispiel #2
0
        /// <summary>

        /// Deletes the specified room

        /// </summary>

        /// <param name="roomID"></param>

        public static void DeleteRoom(string roomID)

        {
            Monitor.Enter(Rooms);

            ChatRoom room = (ChatRoom)Rooms[roomID];

            room.Dispose();

            Rooms.Remove(roomID);

            Monitor.Exit(Rooms);
        }
Beispiel #3
0
 /// <summary>
 /// Cleans all the chat roomsDeletes the empty chat rooms
 /// </summary>
 /// <param name="state"></param>
 public static void CleanChatRooms(object state)
 {
     lock (Rooms)
     {
         foreach (object key in Rooms.Keys)
         {
             ChatRoom room = Rooms[key.ToString()];
             room.ExpireUsers(userChatRoomSessionTimeout);
             if (room.IsEmpty())
             {
                 room.Dispose();
                 Rooms.Remove(key.ToString());
             }
         }
     }
 }
Beispiel #4
0
        /// <summary>

        /// Deletes the empty chat rooms

        /// </summary>

        /// <param name="state"></param>

        public static void CleanChatRooms(object state)

        {
            Monitor.Enter(Rooms);

            foreach (object key in Rooms.Keys)

            {
                ChatRoom room = (ChatRoom)Rooms[key.ToString()];

                room.ExpireUsers(100);

                if (room.IsEmpty())

                {
                    room.Dispose();

                    Rooms.Remove(key.ToString());
                }
            }

            Monitor.Exit(Rooms);
        }