コード例 #1
0
ファイル: Program.cs プロジェクト: saladyears/SettlersOnline
        static void Main(string[] args)
        {
            ILogger logger = new NLogger();

            // Create the threads.
            ServerThread server = new ServerThread(logger);
            ListenThread listen = new ListenThread(logger, server, 4530);
            DatabaseThread database = new DatabaseThread(logger);

            // Create the login handler.
            Login login = new Login(logger, server, database);

            // Start things up.
            server.Run();
            listen.Run();
            database.Run();

            // We could potentially make this a service so there's no infinite
            // looping.
            while (true) {
                if (server.Fatal || listen.Fatal) {
                    // TODO: Potentially attempt to restart?
                    break;
                }

                Thread.Sleep(100);
            }
        }
        public ApplicationPresenter()
        {
            var settings = LoadSettings();

#pragma warning disable CA2000 // Dispose objects before losing scope
            DistLogger logger = new DistLogger(@"c:\work\DistCalc.Server.Log.sqlite", "Log", null);
#pragma warning restore CA2000 // Dispose objects before losing scope
#pragma warning disable CA2000 // Dispose objects before losing scope
            DistLogger errorlogger = new DistLogger(@"c:\work\DistCalc.Server.CalcErrors.sqlite", "Log", null);
#pragma warning restore CA2000 // Dispose objects before losing scope
            ServerThread = new ServerThread(settings, new ThreadId("Server", 1), logger, errorlogger);
            //AutoClosingMessageBox.Show("Starting the server", "ServerStart", 5000);
            var t = new Thread(() => ServerThread.Run(ShowMessageBox));
            t.Start();
        }