Beispiel #1
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                if (args.Length == 2 && args[0] == "--upgrade" && Directory.Exists(args[1]))
                {
                    Installation.Upgrade(args[1]);
                }

                if (args[0] == "--install")
                {
                    Installation.Install();
                }
            }

            Application.EnableVisualStyles();
            Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
            Application.SetCompatibleTextRenderingDefault(false);

            if (Installation.GetInstallationStatus() == Installation.Status.FirstLaunch)
            {
                new FirstLaunch().ShowDialog();
            }

            Settings.Load();
            Application.Run(new MainForm(args));
        }
        private void UpdateInstallationStatus()
        {
            var  status          = Installation.GetInstallationStatus();
            bool force_uninstall = cb_ForceUninstall.Checked;

            label5.Enabled                              =
                rb_rename.Enabled                       =
                    rb_delete.Enabled                   =
                        cbKeepConfigs.Enabled           =
                            cb_Uninstall_OCMI.Enabled   =
                                cb_recover_orig.Enabled = false;
            bInstall.Text = "Install";

            rb_rename.Checked             = true;
            rb_delete.Checked             = false;
            cb_recover_orig.Checked       =
                cb_Uninstall_OCMI.Checked = false;
            bInstall.Enabled = false;

            if (status == Installation.Status.Installed || force_uninstall)
            {
                bInstall.Text          = "Uninstall";
                rb_rename.Enabled      =
                    rb_delete.Enabled  =
                        label5.Enabled =
                            cb_recover_orig.Enabled = true;
                bInstall.Enabled = true;
                if (force_uninstall)
                {
                    rb_rename.Enabled     =
                        rb_rename.Checked = false;
                    rb_delete.Checked     = true;
                }
            }
            else if (status == Installation.Status.NotInstalled || status == Installation.Status.FirstLaunch)
            {
                bInstall.Enabled = true;
            }

            var statusText = "Current directory is not the game directory";

            switch (status)
            {
            case Installation.Status.Installed: statusText = "Installed"; break;

            case Installation.Status.NotInstalled:
            case Installation.Status.FirstLaunch: statusText = "Not installed"; break;
            }

            label_Installation_status.Text = statusText;
        }