예제 #1
0
 internal static void UpdateDatHash()
 {
     // updates dat file hash
     string datHash = Tools.HashFile(GameArchivePath);
     Settings oSet = new Settings();
     oSet.LoadSettings();
     oSet.GameData.DatHash = datHash;
     oSet.SaveSettings();
 }
예제 #2
0
        internal static void CleanupModSettings()
        {
            // Load current settings
            Settings oSet = new Settings();
            oSet.LoadSettings();

            // Unpack game archive
            ExtractGameArchive();

            // Load archive data
            QarFile gameQar = new QarFile();
            gameQar.LoadFromFile(GameArchiveXmlPath);

            // recurse through all installed mods
            foreach (ModEntry mod in oSet.ModEntries)
            {
                List<string> remQar = new List<string>(); // list of files to remove
                foreach (ModQarEntry modQarFile in mod.ModQarEntries) // check all mod files
                {
                    if (!File.Exists(GameArchiveDir + Tools.ToWinPath(modQarFile.FilePath)))
                    {
                        // if the file doesn't exist, it will be removed
                        remQar.Add(modQarFile.FilePath);
                    }
                }
                foreach (string remFile in remQar)
                {
                    mod.ModQarEntries.RemoveAll(entry => entry.FilePath == remFile); // remove files from db
                    mod.ModFpkEntries.RemoveAll(entry => entry.FpkFile == remFile); // fpks from db
                }
            }

            // remove empty mods
            oSet.ModEntries.RemoveAll(entry => entry.ModQarEntries.Count == 0 && entry.ModFpkEntries.Count == 0);
            oSet.SaveSettings();

            DeleteGameArchive();
        }