Ejemplo n.º 1
0
        private static void ProcessFullModule()
        {
            File.Copy(Path.Combine(Common.InputPath, "variables.txt"), Path.Combine(Common.OutputPath, "variables.txt"), true);

            var decompileShaders = Common.DecompileShaders;

            if (!Common.IsVanillaMode)
            {
                Win32FileWriter.WriteAllText(Path.Combine(Common.OutputPath, "module_constants.py"), Header.Standard + Common.ModuleConstantsText);
            }
            else
            {
                Win32FileWriter.WriteAllText(Path.Combine(Common.OutputPath, "module_constants.py"), Header.Standard + Common.ModuleConstantsVanillaText);
            }

            string[] strModFiles = { "actions.txt", "conversation.txt",  "factions.txt",          "info_pages.txt",  "item_kinds1.txt",       "map_icons.txt",
                                     "menus.txt",   "meshes.txt",        "mission_templates.txt", "music.txt",       "particle_systems.txt",  "parties.txt",  "party_templates.txt",
                                     "postfx.txt",  "presentations.txt", "quests.txt",            "scene_props.txt", "scenes.txt",            "scripts.txt",  "simple_triggers.txt",
                                     "skills.txt",  "skins.txt",         "sounds.txt",            "strings.txt",     "tableau_materials.txt", "triggers.txt", "troops.txt" };
            string[] strModDataFiles = { "flora_kinds.txt", "ground_specs.txt", "skyboxes.txt" };

            int iNumFiles = strModFiles.Length;

            if (Common.IsVanillaMode)
            {
                iNumFiles -= 2;
            }

            iNumFiles += strModDataFiles.Count(strModDataFile => File.Exists(Path.Combine(Common.InputPath, "Data", strModDataFile)));

            var sShadersFile = GetShadersFullFileName(out var b);

            if (b && decompileShaders)
            {
                iNumFiles++;
            }

            double dblProgressForOneFile = 100.0 / iNumFiles, dblProgress = 0;

            foreach (var strModFile in strModFiles.Where(strModFile => !(Common.IsVanillaMode && (strModFile == "info_pages.txt" || strModFile == "postfx.txt"))))
            {
                ProcessFile(strModFile);
                dblProgress += dblProgressForOneFile;
                Status       = $"Decompiling {dblProgress:F2}%";
            }

            if (b && decompileShaders)
            {
                ProcessShaders(sShadersFile);
                dblProgress += dblProgressForOneFile;
                Status       = $"Decompiling  {dblProgress:F2}%";
            }

            Common.InputPath = Path.Combine(Common.InputPath, "Data");

            foreach (var strModDataFile in strModDataFiles.Where(strModDataFile => File.Exists(Common.InputPath + "/" + strModDataFile)))
            {
                ProcessFile(strModDataFile);
                dblProgress += dblProgressForOneFile;
                Status       = $"Decompiling  {dblProgress:F2}%";
            }
        }