示例#1
0
        private void Start()
        {
            DontDestroyOnLoad(this);

            loadedMods = new List <InternalMod>();
            loadedMods.Add(new InternalMod(new LoaderMod(),
                                           Assembly.GetExecutingAssembly()));

            Commands.Initialize();

            // Create the console before loading the config so it can display
            // possible errors.
            var console = Tools.Console.Instance;

            Configuration.Load();
            Keybindings.LoadFromConfig();
            Game.Initialize();
            SettingsMenu.Initialize();
            OptionsMenu.Initialize();
            MachineData.Initialize();
            Tools.ModToggle.Initialize();
            Tools.Keymapper.Initialize();

#if DEV_BUILD
            Tools.ObjectExplorer.Initialize();
            if (Environment.CommandLine.Contains("-enable-debug-server"))
            {
                Tools.DebugServer.Initialize();
                Tools.DebugServer.Instance.StartDebugServer(5000);
            }
#endif

            // Enable the console interface since it can now ask the configuration
            // for the correct keys to use.
            console.EnableInterface();

            var blockLoaderInfo = new TheGuysYouDespise.BlockLoaderInfo();
            blockLoaderInfo.LoadBlockLoader();

            LoadMods();

            RegisterModManagementCommands();

            InitializeMods();

            UpdateChecker.Initialize();
        }
示例#2
0
        public static void Main(string[] args)
        {
            var host = CreateWebHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                try
                {
                    var context = services.GetRequiredService <ApplicationDbContext>();
                    context.Database.Migrate();

                    PatientData.Initialize(services);
                    MachineData.Initialize(services);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occurred seeding the DB.");
                }
            }
            host.Run();
        }