static void Main(string[] args) { //This must be the first line!! ServerConfigManager.LoadMyConfigs(); port = (int)ServerConfigManager.MyConfigs["port"]; Process.GetCurrentProcess().Exited += Program_Exited; Console.WriteLine((string)ServerConfigManager.MyConfigs["ServerName"]); serverDB = new ServerDB(); serverCmd = new ServerCmd(serverDB); listener = new Listener(port); listener.SocketAccepted += new EventHandler <SocketAcceptedEventHandler>(listener_SocketAccepted); listener.Start(); clients = new List <Client>(); //Schließe das Programm nicht System.Diagnostics.Process.GetCurrentProcess().WaitForExit(); }
private static void Program_Exited(object sender, EventArgs e) { ServerConfigManager.SaveMyConfigs(); }