Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }