Пример #1
0
        public static bool stabilizeGame()  // used after update is detected to uninstall half clobbered mods
        {
            Dictionary <string, List <string> > restoreMap = getFilesToRestore();

            foreach (KeyValuePair <string, List <string> > modpack in restoreMap)
            {
                foreach (KeyValuePair <string, string> entry in Config.patched[modpack.Key])
                {
                    if (modpack.Value.Contains(entry.Key))
                    {
                        Backups.restoreBak(expandPath(entry.Key));
                    }
                    else
                    {
                        Backups.deleteBak(expandPath(entry.Key));
                    }
                }

                Config.rmPatched(modpack.Key);
            }
            Config.MCC_version = Config.getCurrentBuild();
            Config.saveCfg();
            Backups.saveBackups();

            return(true);
        }
Пример #2
0
        private static int unpatchModpacks(List <CheckBox> toUnpatch)
        {
            bool packErr = false;

            form1.pBar_show(toUnpatch.Count());
            foreach (CheckBox chb in toUnpatch)
            {
                form1.pBar_update();
                string modpackname = chb.Text.Replace(Config.dirtyPadding, "");
                int    ret         = unpatchModpack(modpackname);
                if (ret == 2)
                {
                    packErr     = true;
                    chb.Checked = true;
                }
                else        // modpack was unpatched
                {
                    Config.rmPatched(modpackname);
                    ((PictureBox)chb.Parent.GetChildAtPoint(new Point(chb.Location.X - 45, chb.Location.Y))).Image = Properties.Resources.redDot_15px;
                }
            }

            if (Config.deleteOldBaks)   // update backup pane because backups will have been deleted
            {
                Backups.saveBackups();
                Backups.updateBackupList();
            }

            form1.pBar_hide();
            if (packErr)   // fail / partial success - At least one modpack was not patched
            {
                return(2);
            }
            else        // success, no errors
            {
                return(0);
            }
        }