Пример #1
0
 public static void addMessage(Message message, string name)
 {
     for (int i = 0; i < Bdd.chatrooms.Count(); i++)
     {
         if (Bdd.chatrooms[i].name == name)
         {
             Bdd.chatrooms[i].addMessage(message);
         }
     }
 }
Пример #2
0
        public static void text()
        {
            string str = "";
            str = Console.ReadLine();
            if (str == "")
            {
                return;
            }
            else if (str.ElementAt<char>(0) == '/')
            {
                switch (str)
                {
                    case "/historic":
                        Client.writeHistoric(Session.chatRoom.messages);
                        break;
                    case "/all":
                        Client.writeSessionMessages(Session.messages);
                        break;
                    case "/exitroom":
                        Session.alive = false;
                        Client.chooseRoom();
                        break;
                    case "/exit":
                        Session.alive = false;
                        Environment.Exit(0);
                        break;
                }
                return;
            }
            else
            {
                Message message = new Message(Session.user.name, DateTime.Now, str);

                Session.addMessage(message);

                Server.addMessage(message, Session.chatRoom.name);

                return;
            }
        }
Пример #3
0
 public static void addMessage(Message message)
 {
     m_messages.Add(message);
 }
Пример #4
0
 public void delmessage(Message message)
 {
     m_messages.Remove(message);
 }