Ejemplo n.º 1
0
        // Stop the server
        public void Stop(string message = "Shutting Down")
        {
            Console.WriteLine("Server Shutting Down");
            Administration.SaveServerKeys();

            SendToClients(0, new Packet(Messages.SHUTDOWN, Encoding.ASCII.GetBytes(message)));
            Disconnect();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.CursorVisible = false;

            server = new Server();
            do
            {
                string         command = "";
                ConsoleKeyInfo lastKey;

                do
                {
                    lastKey = Console.ReadKey(true);
                    // If key was delete, remove last char of string.
                    if (command != "" && (lastKey.Key == ConsoleKey.Backspace || lastKey.Key == ConsoleKey.Delete))
                    {
                        command = command.Remove(command.Length - 1);
                    }
                    else if (lastKey.Key != ConsoleKey.Enter)
                    {
                        command += lastKey.KeyChar;
                    }

                    WriteLastLine(command);
                } while (lastKey.Key != ConsoleKey.Enter);

                // Type the command in the 'normal' area, and clear the bottom line.
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine(command);
                Console.ForegroundColor = ConsoleColor.Gray;

                WriteLastLine(new string(' ', Console.BufferWidth));

                //command = command.ToLower();
                string[] inputs = command.Split(' ');
                DoCommand(inputs[0], inputs);
            } while (server.IsListening);
            Administration.SaveServerKeys();
            Console.WriteLine("Exited");
            Console.ReadLine();
        }
Ejemplo n.º 3
0
 protected override void Tick()
 {
     Administration.SaveServerKeys();
 }