Exemplo n.º 1
0
        private static void MoveDatFilesClean(SettingsManager manager)
        {
            string sourceName = null;
            string destName = null;
            string destFolder = null;

            // lua files 00 -> 01,    texture files 01 -> texture7,   foxpatch 00 -> 00,   chunkfiles 00 -> chunk7
            Debug.LogLine("[DatMerge] First Time Setup Started", Debug.LogLevel.Debug);
            
            if (manager.SettingsExist()) manager.ClearAllMods();

            List<string> zeroFiles = GzsLib.ExtractArchive<QarFile>(ZeroPath, "_extr");
            List<string> chunk7Files = new List<string>();
            List<string> oneFiles = new List<string>();

            List<string> zeroOut = zeroFiles.ToList();

            foreach (string zeroFile in zeroFiles)
            {
                if (zeroFile == "foxpatch.dat") continue;

                sourceName = Path.Combine("_extr", Tools.ToWinPath(zeroFile));

                if (zeroFile.Contains(".lua"))
                {
                    destName = Path.Combine("_working1", Tools.ToWinPath(zeroFile)); // 00 -> 01
                    oneFiles.Add(zeroFile);
                } else
                {
                    destName = Path.Combine("_working2", Tools.ToWinPath(zeroFile)); // 00 -> chunk7
                    chunk7Files.Add(zeroFile);
                }
                zeroOut.Remove(zeroFile);

                destFolder = Path.GetDirectoryName(destName);
                if (!Directory.Exists(destFolder)) Directory.CreateDirectory(destFolder);
                if (!File.Exists(destName)) File.Move(sourceName, destName);
            }
            
            // Build a_chunk7.dat.SB_Build
            GzsLib.WriteQarArchive(c7Path + build_ext, "_working2", chunk7Files, GzsLib.chunk7Flags);

            // Build a_texture7.dat.SB_Build
            File.Copy(OnePath, t7Path + build_ext, true);

            // Build 00.dat.SB_Build
            GzsLib.WriteQarArchive(ZeroPath + build_ext, "_extr", zeroOut, GzsLib.zeroFlags);

            // Build 01.dat.SB_Build
            GzsLib.WriteQarArchive(OnePath + build_ext, "_working1", oneFiles, GzsLib.oneFlags);
        }
Exemplo n.º 2
0
        public static void RefreshXml(List <PreinstallEntry> Mods) // adds mods to an .xml file. Similar to snakebite.xml, but with yet-to-be-installed mods.
        {
            FastZip         unzipper = new FastZip();
            SettingsManager infoXml  = new SettingsManager("_extr", "buildInfo.xml");

            // SettingsManager was originally a static class for managing snakebite.xml. It has been modified to manage buildInfo.xml as well.

            infoXml.ClearAllMods();
            foreach (PreinstallEntry mod in Mods)
            {
                unzipper.ExtractZip(mod.filename, "_extr", "metadata.xml");
                ModEntry metaData = new ModEntry("_extr\\metadata.xml");
                infoXml.AddMod(metaData);
                mod.modInfo = metaData;
            } // adds each user-selected filename to the metadata list.
        }