示例#1
0
        public void StartLauncherApplication()
        {
            NLogUtils.SetLoggingForAppDomain();
            var app = new LauncherApp();

            app.Run();
        }
        private static void RunHostApplication()
        {
            NLogUtils.SetLoggingForAppDomain();
            Logger.Info("Starting Splash Screen on new AppDomain");
            var app = new HostApplication();

            app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            app.Run();
            app.Shutdown(0);
        }
        public static void Main(string[] args)
        {
            if (!Get48FromRegistry())
            {
                Environment.Exit(0);
            }

            // Gotta catch 'em all.
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledExceptionReceived;

            var lastResult = ExternalUpdaterResult.NoUpdate;

            if (args.Length >= 1)
            {
                var argument = args[0];
                if (int.TryParse(argument, out var value) && Enum.IsDefined(typeof(ExternalUpdaterResult), value))
                {
                    lastResult = (ExternalUpdaterResult)value;
                }
            }

            InitializeApplicationBasePath();
            if (lastResult == ExternalUpdaterResult.NoUpdate)
            {
                NLogUtils.DeleteOldLogFile();
            }
            NLogUtils.SetLoggingForAppDomain();

            Logger.Debug($"Started FoC Launcher with arguments: {lastResult}");

            var update = LauncherInitializer.Initialize(lastResult);

#if !DEBUG
            if (update)
            {
                ShowSplashScreen();
            }
#endif


            StartLauncher();
            LogManager.Shutdown();
        }