static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; Config = new ServerConfig(); bool loaded = args.Length > 1 ? Config.Load(args[1]) : Config.Load(); if (Config.SplashScreen == true) { Logger.WriteLine(" __ _______ ____ _____", false); Logger.WriteLine(" \\ \\ / / ____|/ __ \\ / ____|", false); Logger.WriteLine(" \\ \\_/ / | __| | | | | ___ _ __ ___", false); Logger.WriteLine(" \\ /| | |_ | | | | | / _ \\| '__/ _ \\", false); Logger.WriteLine(" | | | |__| | |__| | |___| (_) | | | __/", false); Logger.WriteLine(" |_| \\_____|\\____/ \\_____\\___/|_| \\___| Version: " + Version, false); Logger.WriteLine(string.Empty, false); } Logger.WriteLine("Accepting client version 0x" + Config.ClientVersion.ToString("x") + " or higher."); if (loaded) Console.WriteLine("Config loaded."); else Console.WriteLine("Unable to load config.txt, using default settings."); int coreport = 0; if (args.Length > 0) int.TryParse(args[0], out coreport); Random = new Random(); Server server = new Server(); if (!server.Start(coreport)) Thread.Sleep(5000); if (server.IsListening == true && Config.STDOUT == true) Console.WriteLine("::::network-ready"); while (server.IsListening) { server.Process(); Thread.Sleep(1); } if (Config.STDOUT == true) Console.WriteLine("::::network-end"); Process.GetCurrentProcess().Kill(); }
static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; Console.CancelKeyPress+= new ConsoleCancelEventHandler(Console_CancelKeyPress); Config = new ServerConfig(); bool loaded = args.Length > 0 ? Config.Load(args[0]): Config.Load(); ChatCommand.WriteHead(Config); if(loaded) Logger.WriteLine("Config loaded."); else Logger.WriteLine("Unable to load config.txt, using default settings."); if(Config.HandShuffle){ Logger.WriteLine("Warning: Hand shuffle requires a custom ocgcore to work."); } int coreport = Config.ServerPort; // // if (args.Length > 0){ // int.TryParse(args[0], out coreport); // if(coreport==0){ // coreport=Config.ServerPort; // }else{ // Config.setValue("serverport", ""+coreport); // if(coreport<=9999){ // Config.setValue("apiport", ""+(10000+coreport)); // } // } // } Random = new Random(); Server server = new Server(); if (!server.Start(coreport)) Thread.Sleep(5000); ThreadPool.SetMaxThreads(128, 256); Thread inputThread=new Thread(new ParameterizedThreadStart(Command)); inputThread.IsBackground=true; inputThread.Start(server); while (server.IsListening) { server.Process(); Thread.Sleep(1); } }