예제 #1
0
 public void ChangeChatroom(Chatroom chatroom)
 {
     if (CurrentChatroom != null)
     {
         CurrentChatroom.RemoveUser(UserName);
     }
     CurrentChatroom = chatroom;
     Send($"Welcome to the {CurrentChatroom.Name} chatroom.  To change rooms enter '>>' or enter '>>' + the name of the room, for example, '>>Main' to move to the Main chatroom.\n");
     CurrentChatroom.AddUser(UserName, this);
 }
예제 #2
0
        private void JoinRoom(JObject j, TcpClient r)
        {
            string room = j["Room"].ToString();
            User   s    = clientUsers.GetOrAdd(r, z => null);

            if (s == null)
            {
                return;
            }

            Chatroom roomToAddTo = chatrooms.First(w => w.Name == j["Room"].ToString());

            usersChatRoom.AddOrUpdate(s, roomToAddTo, (z, c) => c);
            roomToAddTo.AddUser(s);
            string t = ";";
        }