Example #1
0
        static void Main(string[] args)
        {
            SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true);

            while (!isClosing)
            {
                Console.Title = "MerCraft Server";

                core = new Core();

            #if DEBUG
                core.Log("Initializing Updater to version " + core.version, logLevel.Debug);
            #endif
                Console.Title = "MerCraft Server Version " + core.version;

                updater = new Updater(core.version);
                updater.Update();

                while (!updater.Ready)
                {
                    //Do nothing
                }

            #if DEBUG
                core.Log("Initializing Launcher to version " + core.version + " and updater", logLevel.Debug);
            #endif

                serverConfig = new ServerConfiguration(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".mercraft-server", "Standard", "server.properties"));
                if (!serverConfig.configExists)
                    serverConfig.StartConfiguration();

                while (!serverConfig.Ready)
                {
                    //Do nothing
                }

                launcher = new Launcher(updater);
                launcher.Launch();
            }

            if (launcher != null)
                if (launcher.Running)
                    launcher.P.Kill();

            if (core != null)
                if (core.config != null)
                    core.config.SaveConfiguration();
        }
Example #2
0
 public Launcher(Updater updater)
 {
     U = updater;
     consoleInput = new StreamReader(Console.OpenStandardInput());
 }