public void Start(string[] args) { Console.Title = "LocalAdmin+ v" + VersionString; try { if (args.Length == 0) { ConsoleUtil.WriteLine("You can pass port number as first startup argument.", ConsoleColor.Green); Console.WriteLine(""); ConsoleUtil.Write("Port number (default: 7777): ", ConsoleColor.Green); ReadInput((input) => { if (input == "") { gamePort = 7777; return(true); } return(ushort.TryParse(input, out gamePort)); }, () => { }, () => { ConsoleUtil.WriteLine("Port number must be a unsigned short integer.", ConsoleColor.Red); }); } else { if (!ushort.TryParse(args[0], out gamePort)) { ConsoleUtil.WriteLine("Failed - Invalid port!"); Exit(); } } Console.Title += " | port " + gamePort; SetupPlatform(); RegisterCommands(); SetupReader(); Menu(); ConsoleUtil.WriteLine("Started new session.", ConsoleColor.DarkGreen); ConsoleUtil.WriteLine("Trying to start server...", ConsoleColor.Gray); consolePort = GetFirstFreePort(); SetupServer(); RunSCPSL(gamePort); readerTask.Start(); Task.WaitAll(readerTask); } catch (Exception ex) { Logger.Log("|===| Exception |===|"); Logger.Log("Time: " + DateTime.Now); Logger.Log(ex); Logger.Log("|===================|"); Logger.Log(""); } }