コード例 #1
0
ファイル: formQuickMod.cs プロジェクト: yhyu13/SnakeBite
        private void NextPage()
        {
            switch (page)
            {
            case 0:
                panelContent.Controls.Clear();
                panelContent.Controls.Add(wp);
                labelHeader.Text = "Zip Installer";
                page++;
                break;

            case 1:
                var modName = Path.GetFileNameWithoutExtension(wp.textZipFile.Text);
                if (modName.Contains("-"))
                {
                    modName = modName.Substring(0, modName.IndexOf("-"));
                }
                cm.textModName.Text = modName;
                panelContent.Controls.Clear();
                panelContent.Controls.Add(cm);
                labelHeader.Text = "Confirm Installation";
                page++;
                break;

            case 2:
                if (wp.textZipFile.Text.Trim() == string.Empty)
                {
                    return;
                }
                var exportFileName = cm.textModName.Text + ".mgsv";
                if (cm.checkExport.Checked)
                {
                    SaveFileDialog sfd = new SaveFileDialog();
                    sfd.Filter   = "MGSV Mod File|*.mgsv";
                    sfd.FileName = exportFileName;
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        exportFileName = sfd.FileName;
                    }
                    else
                    {
                        exportFileName = "temp.mgsv";
                    }
                }
                if (Directory.Exists("_temp"))
                {
                    Directory.Delete("_temp", true);
                }
                Methods.ExtractFiles(wp.textZipFile.Text, "_temp");
                Methods.GenerateMgsv(exportFileName, cm.textModName.Text, "_temp");
                if (ModManager.CheckConflicts(exportFileName))
                {
                    DoInstall(exportFileName);

                    Close();
                }
                else
                {
                }
                if (cm.checkExport.Checked)
                {
                    MessageBox.Show("Successfully exported MGSV file", "Quick Install", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    File.Delete(exportFileName);
                }
                break;
            }
        }