Exemple #1
0
        private static void CommandLoop()
        {
            while (true)
            {
                string command = Console.ReadLine();

                if (command == "")
                {
                    webServer.Close();
                    Environment.Exit(1);
                    return;
                }

                if (command == "kickall")
                {
                    // -- Kick all clients
                    foreach (Client clientData in clientManager.GetClients())
                    {
                        clientData.KickClient();
                    }
                    continue;
                }

                // -- Assume raw message
                string[] segments = command.Split(':');
                if (segments.Length > 1)
                {
                    int port = 0;
                    Int32.TryParse(segments[0], out port);

                    networkMessenger.SendMessage(IPAddress.Parse("127.0.0.1"), port, segments[1]);
                }
            }
        }