static void Main(string[] args) { AuxiliaryServerWorker.WriteInfo("Welcome to the AntVault 3 server."); AuxiliaryServerWorker.WriteInfo("Write /Start to get started!"); string Command = Console.ReadLine(); while (Command.ToLower() != "/exit") { if (Command.ToLower() == "/start") { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed ServerNetworking.StartServer(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed Command = Console.ReadLine(); } else if (Command.ToLower() == "/stop") { ServerNetworking.StopServer(); Command = Console.ReadLine(); } else if (Command.ToLower().StartsWith("/updatestatus")) { Command = Command + ";"; string NewStatus = AuxiliaryServerWorker.GetElement(Command, " ".ToUpperInvariant(), ";"); MainServerWorker.UpdateStatus(NewStatus); Command = Console.ReadLine(); } else if (Command.ToLower().StartsWith("/aboutuser")) { Command = Command + ";"; string UserToCheck = AuxiliaryServerWorker.GetElement(Command, " ".ToUpperInvariant(), ";"); MainServerWorker.AboutUser(UserToCheck); Command = Console.ReadLine(); } else { AuxiliaryServerWorker.WriteError("Command not recognised"); Command = Console.ReadLine(); } } if (Command.ToLower() == "/exit") { AuxiliaryServerWorker.WriteInfo("Application will exit in"); AuxiliaryServerWorker.WriteInfo("5"); Thread.Sleep(1000); AuxiliaryServerWorker.WriteInfo("4"); Thread.Sleep(1000); AuxiliaryServerWorker.WriteInfo("3"); Thread.Sleep(1000); AuxiliaryServerWorker.WriteInfo("2"); Thread.Sleep(1000); AuxiliaryServerWorker.WriteInfo("1"); Thread.Sleep(1000); Environment.Exit(0); } }
static void Main(string[] args) { PortSelection(); gameInfo.LoadGame(); server.StartServer(); Console.WriteLine("Server starting..."); while (true) { string command = Console.ReadLine(); if (command == "exit") { Environment.Exit(0); } else if (command == "players") { foreach (var name in server.GetConnectedUsernames()) { Console.WriteLine(name); } } else if (command == "get ore map") { for (int x = 0; x < 100; x++) { for (int y = 0; y < 100; y++) { Console.Write(gameInfo.oreMap[x, y] + " "); if ((y + 1) % 100 == 0) { Console.WriteLine(); } } } } } }