예제 #1
0
파일: Program.cs 프로젝트: xdrie/Sor
        static void Main(string[] args)
        {
#if CORERT
            Glint.Platform.DesktopPlatform.setupCoreRTSupport();
#endif

            var banner = Assembly.GetExecutingAssembly().GetManifestResourceStream($"{nameof(SorDk)}.Res.banner.txt");
            using (var sr = new StreamReader(banner)) {
                Console.WriteLine(sr.ReadToEnd());
                Console.WriteLine(Config.GAME_VERSION);
#if DEBUG
                Console.WriteLine("[DEBUG] build, debug code paths enabled. maim mode enabled.");
#endif
            }

#if DEBUG
            // check MAIM (MAintenance IMmediate access) mode
            if (args.Length > 0 && args[0] == "maim")
            {
                var prompt = new MaimPrompt(args.Skip(1));
                Maim.install(prompt);
                prompt.launch();
                return;
            }
#endif

            // load configuration
#if DEBUG
            var defaultConf = Assembly.GetExecutingAssembly()
                              .GetManifestResourceStream($"{nameof(SorDk)}.Res.game.dbg.conf");
#else
            var defaultConf = Assembly.GetExecutingAssembly()
                              .GetManifestResourceStream($"{nameof(SorDk)}.Res.game.conf");
#endif
            var configHelper = new ConfigHelper <Config>();
            var confPath     = Path.Combine(Global.baseDir, conf);
            configHelper.ensureDefaultConfig(confPath, defaultConf);
            var confStr = File.ReadAllText(confPath);
            var config  = configHelper.load(confStr, args); // load and parse config
            // run in crash-cradle (only if NOT debug)
#if !DEBUG
            try {
#endif
            using (var game = new NGame(config)) {
                game.Run();
            }
#if !DEBUG
        }

        catch (Exception ex) {
            Glint.Global.log.crit($"fatal error: {ex}");
            throw;
        }
#endif
        }
예제 #2
0
파일: Maim.cs 프로젝트: xdrie/Sor
 public static void install(MaimPrompt prompt)
 {
     prompt.register("mapgen_tests", mapGeneratorTests);
     prompt.register("render_test", renderTest);
 }