コード例 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Program.MasterForm.Size = new System.Drawing.Size(577, 455);
            version_lbl.Text        = Config.version;
            int r = Config.LoadCfg();

            if (r == 3)     // Config error, user refused to regenerate config
            {
                Utility.ShowMsg("MCC Mod Manager cannot load because there are problems with the configuration file.", "Error");
                Environment.Exit(1);
            }
            Backups.LoadBackups();

            if (r == 2)     // User refused to stabilize the game
            {
                patchButton.Enabled        = false;
                delModpack.Enabled         = false;
                restoreSelectedBtn.Enabled = false;
                restoreAllBaksBtn.Enabled  = false;
                delSelectedBak.Enabled     = false;
                delAllBaksBtn.Enabled      = false;
                manualOverride.Enabled     = false;

                megaCaution.Visible = true;
                tt.SetToolTip(megaCaution, "MCC Mod Manager has detected an update and needs to stabilize the game. Please restart the app.");
            }
            else if (r == 1)        // User allowed the manager to stabilize the game
            {
                Modpacks.StabilizeGame();
                Backups.LoadBackups();
            }
            MyMods.LoadModpacks();
            LoadEventHandlers();
            PBar_init();
        }
コード例 #2
0
ファイル: Config.cs プロジェクト: mythis890/MCC_Mod_Manager
 public static void doResetApp()
 {
     patched     = new Dictionary <string, Dictionary <string, string> >();
     MCC_version = getCurrentBuild();
     saveCfg();
     Modpacks.loadModpacks();
     if (!Backups.deleteAll(true))
     {
         form1.showMsg("There was an issue deleting at least one backup. Please delete these in the Backups tab to avoid restoring an old " +
                       "version of the file in the future.", "Error");
     }
     Backups.loadBackups();
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: mythis890/MCC_Mod_Manager
        private void Form1_Load(object sender, EventArgs e)
        {
            version_lbl.Text = Config.version;
            Config.form1     = this;
            int r = Config.loadCfg();

            if (r == 3)
            {
                showMsg("MCC Mod Manager cannot load because there are problems with the configuration file.", "Error");
                Environment.Exit(1);
            }
            Backups.form1 = this;
            Backups.loadBackups();

            if (r == 2)
            {
                patchButton.Enabled        = false;
                delModpack.Enabled         = false;
                restoreSelectedBtn.Enabled = false;
                restoreAllBaksBtn.Enabled  = false;
                delSelectedBak.Enabled     = false;
                delAllBaksBtn.Enabled      = false;
                manualOverride.Enabled     = false;

                megaCaution.Visible = true;
                tt.SetToolTip(megaCaution, "MCC Mod Manager has detected an update and needs to stabilize the game. Please restart the app.");
            }
            else if (r == 1)
            {
                Modpacks.stabilizeGame();
                Backups.loadBackups();
            }

            Modpacks.form1 = this;
            Modpacks.loadModpacks();
            AssemblyPatching.form1 = this;
            IO.form1 = this;
            pBar_init();
            tt.SetToolTip(addRowButton, "Select mod file(s) to add");
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: mythis890/MCC_Mod_Manager
        private void manualOverride_CheckedChanged(object sender, EventArgs e)
        {
            if (manualOverride.Checked == false)     // make warning only show if checkbox is getting enabled
            {
                Modpacks.loadModpacks();
                return;
            }
            else
            {
                DialogResult ans = showMsg("Please do not mess with this unless you know what you are doing or are trying to fix a syncing issue.\r\n\r\n" +
                                           "This option allows you to click the red/green icons beside modpack entries to force the mod manager to flag a modpack as enabled/disabled. " +
                                           "This does not make changes to files, but it does make the mod manager 'think' that modpacks are/aren't installed." +
                                           "\r\n\r\nEnable this feature?", "Question");
                if (ans == DialogResult.No)
                {
                    manualOverride.Checked = false;
                    return;
                }

                Modpacks.loadModpacks();
            }
        }
コード例 #5
0
ファイル: Backups.cs プロジェクト: mythis890/MCC_Mod_Manager
        private static List <string> filterNeededBackups(List <string> paths)
        {
            List <string> requiredBaks = new List <string>();

            foreach (string enabledModpack in Config.getEnabledModpacks())
            {
                modpackCfg modpackConfig = Modpacks.getModpackConfig(enabledModpack);

                foreach (modpackEntry entry in modpackConfig.entries)
                {
                    foreach (string path in paths)
                    {
                        if (path == Modpacks.expandPath(entry.dest))
                        {
                            requiredBaks.Add(path);
                        }
                    }
                }
            }

            return(requiredBaks);
        }
コード例 #6
0
ファイル: Config.cs プロジェクト: mythis890/MCC_Mod_Manager
        public static bool addPatched(string modpackName)
        {
            Dictionary <string, string> modfiles = new Dictionary <string, string>();
            modpackCfg mCfg = Modpacks.getModpackConfig(modpackName);

            using (ZipArchive archive = ZipFile.OpenRead(Config.modpack_dir + @"\" + modpackName + ".zip")) {
                if (mCfg == null)
                {
                    form1.showMsg("Cannot set state to enabled. The file '" + modpackName + ".zip' is either not a compatible modpack or the config is corrupted.", "Error");
                    return(false);
                }

                List <string> patched = new List <string>();   // track patched files in case of failure mid patch
                foreach (modpackEntry entry in mCfg.entries)
                {
                    modfiles[entry.dest] = Modpacks.getMD5(Modpacks.expandPath(entry.dest));
                }
            }

            patched[modpackName] = modfiles;
            return(true);
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: mythis890/MCC_Mod_Manager
 private void createModpackBtn_Click(object sender, EventArgs e)
 {
     Modpacks.createModpack(modpackName_txt.Text, createFilesPanel.Controls.OfType <Panel>());
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: mythis890/MCC_Mod_Manager
 private void delModpack_Click(object sender, EventArgs e)
 {
     Modpacks.delModpack(modListPanel.Controls.OfType <CheckBox>());
 }
コード例 #9
0
ファイル: Form1.cs プロジェクト: mythis890/MCC_Mod_Manager
 private void patchButton_Click(object sender, EventArgs e)
 {
     Modpacks.runPatchUnpatch(modListPanel.Controls.OfType <CheckBox>());
 }
コード例 #10
0
ファイル: Form1.cs プロジェクト: mythis890/MCC_Mod_Manager
 private void refreshButton_Click(object sender, EventArgs e)
 {
     Config.loadCfg();
     Backups.loadBackups();
     Modpacks.loadModpacks();
 }
コード例 #11
0
ファイル: Config.cs プロジェクト: mythis890/MCC_Mod_Manager
        public static int loadCfg()
        {
            bool stabilize      = false;
            bool needsStabilize = false;

            if (!File.Exists(_cfgLocation))
            {
                createDefaultCfg();
            }
            else
            {
                int r = readCfg();
                if (r == 1)
                {
                    DialogResult ans = form1.showMsg("Your configuration has formatting errors, would you like to overwrite it with a default config?", "Question");
                    if (ans == DialogResult.No)
                    {
                        return(3);
                    }
                    createDefaultCfg();
                }
                else if (r == 2)
                {
                    DialogResult ans = form1.showMsg("Your config file is using an old format, would you like to overwrite it with a default config?", "Question");
                    if (ans == DialogResult.No)
                    {
                        return(3);
                    }
                    createDefaultCfg();
                }
                else
                {
                    // check if game was updated
                    if (MCC_version != getCurrentBuild())
                    {
                        DialogResult ans = form1.showMsg("It appears that MCC has been updated. MCC Mod Manager needs to stabilize the game by uninstalling certain modpacks." +
                                                         "\r\nWould you like to do this now? Selecting 'No' will disable features.", "Question");
                        if (ans == DialogResult.Yes)
                        {
                            stabilize = true;
                        }
                        else
                        {
                            needsStabilize = true;
                        }
                    }
                }
            }

            bool          msg = false;
            List <string> tmp = new List <string>();

            foreach (KeyValuePair <string, Dictionary <string, string> > modpack in patched)
            {
                if (!Modpacks.verifyExists(modpack.Key))
                {
                    if (!msg)
                    {
                        msg = true;
                        form1.showMsg("The '" + modpack.Key + "' modpack is missing from the modpacks folder. If this modpack is actually installed, " +
                                      "MCC Mod Manager won't be able to uninstall it. You should restore from backups or verify the game files through Steam." +
                                      "\r\nThis warning will only show once.", "Warning");
                    }
                    tmp.Add(modpack.Key);
                }
            }
            foreach (string modpack in tmp)
            {
                rmPatched(modpack);
            }
            saveCfg();

            // Update config tab
            form1.cfgTextBox1Text = MCC_home;
            form1.cfgTextBox2Text = backup_dir;
            form1.cfgTextBox3Text = modpack_dir;
            form1.delOldBaks      = deleteOldBaks;

            if (stabilize)
            {
                return(1);
            }
            else if (needsStabilize)
            {
                return(2);
            }
            else
            {
                return(0);
            }
        }