/// <summary> /// Relay a message sent by one client to the other clients. /// </summary> /// <param name="client"></param> /// <param name="message"></param> static void ReceiveMessage(int client, Message message) { Libs.DisplayMessage(message); foreach (int otherClient in clients.Keys) { if (otherClient != client) { Libs.SendMessage(clients[otherClient].GetStream(), message); } } }
/// <summary> /// Parses user input and decides what to do with it. /// </summary> /// <param name="input"></param> static void InputParser(string input) { if (input.Trim().StartsWith("/")) { Libs.HandleCommand(input, commands); } else { if (client.Connected) { Libs.SendMessage(client.GetStream(), new Message(input, name, color)); } } }
/// <summary> /// Parses user input and decides what to do with it. /// </summary> /// <param name="input"></param> static void InputParser(string input) { if (input.Trim().StartsWith("/")) { Libs.HandleCommand(input, commands); } else { foreach (TcpClient client in clients.Values) { Libs.SendMessage(client.GetStream(), new Message(input, "Server", (int)ConsoleColor.Gray)); } } }