Example #1
0
        private void bModPath_Click(object sender, EventArgs e)
        {
            var path = MyDirectory.Select("mod", "arc/dir");

            if (path != null)
            {
                tbModURL.Text = path;
            }
        }
Example #2
0
        private void bPathDownloadedArchives_Click(object sender, EventArgs e)
        {
            var path = MyDirectory.Select("directory where you want to save downloaded archives", "dir");

            if (path != null)
            {
                tbDownloadedArchiveLocation.Text = path;
            }
        }
Example #3
0
        private void bPath7z_Click(object sender, EventArgs e)
        {
            var path = MyDirectory.Select("7z.exe", "7z");

            if (path != null)
            {
                tbPath7z.Text = path;
            }
        }
Example #4
0
        private void bPathCheatTables_Click(object sender, EventArgs e)
        {
            var path = MyDirectory.Select("Cheat Tables", "dir");

            if (path != null)
            {
                tbPathCheatTables.Text = path;
            }
        }
Example #5
0
        public void ContinueInstallation()
        {
            progressBar.Style = ProgressBarStyle.Marquee;
            if (Installation.Platform == ModType.ModLoader)
            {
                File.Delete(Installation.ArchiveName);
                var result = MessageBox.Show("One-Click Mod Installer detected a Mod Loader distributive. Do you want to replace the current version of Mod Loader with the downloaded one?"
                                             , "Mod Loader update"
                                             , MessageBoxButtons.YesNo
                                             , MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    Process.Start("Sonic4ModManager", "--upgrade \"" + Installation.ArchiveDir + "\"");
                    Application.Exit();
                }
                else
                {
                    Installation.Status = "Cancelled";
                    statusBar.Text      = "Installation was cancelled";
                    return;
                }
            }
            else if (Installation.Platform == ModType.Unknown)
            {
                //Status description

                /*  1 - start (open SelectRoots window)
                 *  2 - continue (choose destination directory)
                 *  0 - ok (user selected destination directory)
                 *  -1 - break (user cancelled SelectRoots window)
                 */
                var status = 1;
                var sr     = new SelectRoots(Installation.ArchiveDir);

                while (status > 0)
                {
                    if (status == 1)
                    {
                        status = -1;
                        if (sr.ShowDialog() == DialogResult.Yes)
                        {
                            status = 2;
                            Installation.ModRoots = sr.output.ToArray();
                            if (Installation.ModRoots.Length == 0)
                            {
                                status = -1;
                            }
                        }
                    }
                    else if (status == 2)
                    {
                        status = 1;
                        var path = MyDirectory.Select("test", "dir");
                        if (path != null)
                        {
                            Installation.CustomPath = path;
                            status = 0;
                        }
                    }
                }

                if (status == -1)
                {
                    Installation.Status = "Cancelled";
                    statusBar.Text      = "Installation was cancelled";
                    return;
                }
            }
            else if (Installation.Platform == ModType.Mixed)
            {
                //TODO: think up a better explanation
                MessageBox.Show("Looks like this thing is complicated, try to install it manually. bye"
                                , "Couldn't install the mod"
                                , MessageBoxButtons.OK
                                , MessageBoxIcon.Exclamation);
                Installation.Status = "Mod is complicated";
                return;
            }
            else
            {
                if (Installation.ModRoots.Length > 1)
                {
                    var tmm_form = new TooManyMods(Installation.ModRoots, Installation.Platform);
                    tmm_form.ShowDialog();

                    Installation.ModRoots = tmm_form.mods;
                }

                if (Settings.Paths.ContainsKey(Installation.Platform.ToString()))
                {
                    if (Settings.Paths[Installation.Platform.ToString()] == "")
                    {
                        tcMain.SelectTab(tabSettings);

                        MessageBox.Show("Looks like the mod you installed requires a special path to be installed to.\nPlease, specify "
                                        + Installation.Platform + "\nand then press the \"Continue Installation\" button in the \"Download\" tab."
                                        , "Please specify a path"
                                        , MessageBoxButtons.OK
                                        , MessageBoxIcon.Information);
                        Installation.Status = "Waiting for path";
                        UpdateWindow();
                    }
                }
            }

            if (Installation.ModRoots.Length > 0)
            {
                Installation.LastMod = Path.GetFileName(Installation.ModRoots[0]);
            }

            if (Installation.Status == "Ready to install")
            {
                FinishInstallation();
            }
        }