Example #1
0
 private void handleCommand(string data)
 {
     if (data.Contains("#disconnect$"))
     {
         _handler.Close();
     }
     if (data.Contains("#setnameandpass"))
     {
         _userName = data.Split('&')[1].Split('%')[0];
         _passWord = data.Split('&')[1].Split('%')[1];
     }
     if (data.Contains("#newmsg"))
     {
         string message = data.Split('&')[1];
         ChatController.AddMessage(_userName, message);
     }
     //Thread.Sleep(5000);
     UpdateChat();
     return;
 }
Example #2
0
 public static void EndClient(Client client)
 {
     client.End();
     Clients.Remove(client);
     if (!disTrigger)
     {
         Program.created.logBox.Invoke(new Form1.toLog((s) => Program.created.logBox.Text += s), String.Format("{0} left the server!{1}", client.UserName, Environment.NewLine));
         ChatController.AddMessage("#left-", client.UserName + " left to server!");
     }
     else
     {
         if (!disCount)
         {
             Program.created.logBox.Invoke(new Form1.toLog((s) => Program.created.logBox.Text += s), String.Format("{0} try connect to the server!{1}", client.UserName, Environment.NewLine));
             disCount = true;
         }
         else
         {
             disCount = false;
         }
     }
     Program.created.listUsersCalc();
     UpdateAllList();
 }
Example #3
0
 public void UpdateList()
 {
     Send(ChatController.GetList());
 }
Example #4
0
 public void UpdateChat()
 {
     Send(ChatController.GetChat());
 }