private static void Install(ref int returnval)
        {
            if (!Program.ValidateUnityGamePath(ref ExePath))
            {
                // Output Error
                return;
            }
            Program.GetCurrentInstallVersion(Path.GetDirectoryName(ExePath));
            if (!string.IsNullOrEmpty(ZipPath))
            {
                InstallFromZip(ref returnval);
                return;
            }
            Releases.RequestLists();
            if (Releases.All.Count <= 0)
            {
                // Output Error
                return;
            }

            // Pull Latest Version

            string selected_version = "v0.0.0.0";

            if (Program.CurrentInstalledVersion == null)
            {
                OperationHandler.CurrentOperation = OperationHandler.Operations.INSTALL;
            }
            else
            {
                Version selected_ver = new Version(selected_version);
                int     compare_ver  = selected_ver.CompareTo(Program.CurrentInstalledVersion);
                if (compare_ver < 0)
                {
                    OperationHandler.CurrentOperation = OperationHandler.Operations.DOWNGRADE;
                }
                else if (compare_ver > 0)
                {
                    OperationHandler.CurrentOperation = OperationHandler.Operations.UPDATE;
                }
                else
                {
                    OperationHandler.CurrentOperation = OperationHandler.Operations.REINSTALL;
                }
            }
            OperationHandler.Automated_Install(Path.GetDirectoryName(ExePath), selected_version, Requested32Bit, (selected_version.StartsWith("v0.2") || selected_version.StartsWith("v0.1")));
        }
Esempio n. 2
0
        internal static void RefreshReleases()
        {
            Program.mainForm.Invoke(new Action(() => {
                Program.mainForm.PageManager.Cursor                  = Cursors.Hand;
                Program.mainForm.Tab_Automated.Text                  = "Automated   ";
                Program.mainForm.PleaseWait_PleaseWait.Visible       = true;
                Program.mainForm.PleaseWait_PleaseWait.ForeColor     = SystemColors.Highlight;
                Program.mainForm.PleaseWait_PleaseWait.Text          = "PLEASE WAIT";
                Program.mainForm.PleaseWait_PleaseWait.Location      = new Point(161, 36);
                Program.mainForm.PleaseWait_PleaseWait.Size          = new Size(127, 25);
                Program.mainForm.PleaseWait_Text.Visible             = true;
                Program.mainForm.PleaseWait_Text.Text                = "Getting List of Releases from GitHub...";
                Program.mainForm.PleaseWait_Text.Location            = new Point(105, 79);
                Program.mainForm.PleaseWait_Text.Size                = new Size(250, 22);
                Program.mainForm.Error_Retry.Visible                 = false;
                Program.mainForm.Automated_UnityGame_Text.Visible    = false;
                Program.mainForm.Automated_UnityGame_Select.Visible  = false;
                Program.mainForm.Automated_UnityGame_Display.Visible = false;
                Program.mainForm.Automated_Arch_Text.Visible         = false;
                Program.mainForm.Automated_Arch_Selection.Visible    = false;
                Program.mainForm.Automated_Arch_AutoDetect.Visible   = false;
                Program.mainForm.Automated_x64Only.Visible           = false;
                Program.mainForm.Automated_Divider.Visible           = false;
                Program.mainForm.Automated_Install.Visible           = false;
                Program.mainForm.Automated_Version_Text.Visible      = false;
                Program.mainForm.Automated_Version_Selection.Visible = false;
                Program.mainForm.Automated_Version_Latest.Visible    = false;
                Program.mainForm.Automated_Version_Selection.Items.Clear();
            }));
            if (Releases.All.Count <= 0)
            {
                Releases.RequestLists();
            }
            Program.mainForm.Invoke(new Action(() =>
            {
                Program.mainForm.RefreshReleasesListing();
                if (Program.mainForm.Automated_Version_Selection.Items.Count <= 0)
                {
                    Program.mainForm.PageManager.Cursor = Cursors.Hand;
                    Program.mainForm.PleaseWait_PleaseWait.ForeColor = Color.Red;
                    Program.mainForm.PleaseWait_PleaseWait.Text      = "ERROR";
                    Program.mainForm.PleaseWait_PleaseWait.Location  = new Point(184, 36);
                    Program.mainForm.PleaseWait_PleaseWait.Size      = new Size(72, 25);
                    Program.mainForm.PleaseWait_Text.Text            = "Failed to get List of Releases from GitHub!";
                    Program.mainForm.PleaseWait_Text.Location        = new Point(94, 79);
                    Program.mainForm.PleaseWait_Text.Size            = new Size(266, 19);
                    Program.mainForm.Error_Retry.Visible             = true;
                    return;
                }
                Program.mainForm.PleaseWait_PleaseWait.Visible       = false;
                Program.mainForm.PleaseWait_Text.Visible             = false;
                Program.mainForm.Error_Retry.Visible                 = false;
                Program.mainForm.Automated_UnityGame_Text.Visible    = true;
                Program.mainForm.Automated_UnityGame_Select.Visible  = true;
                Program.mainForm.Automated_UnityGame_Display.Visible = true;
                Program.mainForm.Automated_Arch_Text.Visible         = true;
                Program.mainForm.Automated_Divider.Visible           = true;
                Program.mainForm.Automated_Install.Visible           = true;
                Program.mainForm.Automated_Version_Text.Visible      = true;
                Program.mainForm.Automated_Version_Selection.Visible = true;
                Program.mainForm.Automated_Version_Latest.Visible    = true;

                if (Config.RememberLastSelectedGame)
                {
                    if (!string.IsNullOrEmpty(Config.LastSelectedGamePath))
                    {
                        Program.mainForm.SetUnityGame(Config.LastSelectedGamePath);
                    }
                }
                else
                {
                    Config.LastSelectedGamePath = null;
                }

                /*
                 * if (!string.IsNullOrEmpty(CommandLine.ExePath))
                 * {
                 *  if (Program.ValidateUnityGamePath(ref CommandLine.ExePath))
                 *  {
                 *      MessageBox.Show(CommandLine.ExePath);
                 *      Program.mainForm.SetUnityGame(CommandLine.ExePath);
                 *  }
                 *  else
                 *      MessageBox.Show("Invalid File Selected!", BuildInfo.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
                 * }
                 */
            }));
        }