Beispiel #1
0
        /// <summary>
        /// Gets a Dictionary of all loaded files in the given target. Key is the filename, value is file path
        /// </summary>
        /// <param name="target">Game target</param>
        /// <returns>Mapping of files</returns>
        public static Dictionary <string, string> GetFilesLoadedInGame(GameTarget target, bool includeTFC = false, bool includeBasegame = true)
        {
            Mod.MEGame game = target.Game;
            //make dictionary from basegame files
            var loadedFiles = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase);
            var directories = GetEnabledDLC(target).OrderBy(dir => GetMountPriority(dir, target.Game));

            if (includeBasegame)
            {
                directories.Prepend(MEDirectories.BioGamePath(target));
            }
            foreach (string directory in directories)
            {
                foreach (string filePath in GetCookedFiles(target.Game, directory, includeTFC))
                {
                    string fileName = Path.GetFileName(filePath);
                    if (fileName != null)
                    {
                        loadedFiles[fileName] = filePath;
                    }
                }
            }

            return(loadedFiles);
        }
Beispiel #2
0
        /// <summary>
        /// Gets a Dictionary of all loaded files in the given game. Key is the filename, value is file path
        /// </summary>
        /// <param name="game"></param>
        /// <returns></returns>
        public static Dictionary <string, string> GetFilesLoadedInGame(Mod.MEGame game, bool forceReload = false, bool includeTFC = false)
        {
            if (!forceReload)
            {
                if (game == Mod.MEGame.ME1 && cachedME1LoadedFiles != null)
                {
                    return(cachedME1LoadedFiles);
                }
                if (game == Mod.MEGame.ME2 && cachedME2LoadedFiles != null)
                {
                    return(cachedME2LoadedFiles);
                }
                if (game == Mod.MEGame.ME3 && cachedME3LoadedFiles != null)
                {
                    return(cachedME3LoadedFiles);
                }
            }

            //make dictionary from basegame files
            var loadedFiles = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase);

            foreach (string directory in GetEnabledDLC(game).OrderBy(dir => GetMountPriority(dir, game)).Prepend(MEDirectories.BioGamePath(game)))
            {
                foreach (string filePath in GetCookedFiles(game, directory, includeTFC))
                {
                    string fileName = Path.GetFileName(filePath);
                    if (fileName != null)
                    {
                        loadedFiles[fileName] = filePath;
                    }
                }
            }

            if (game == Mod.MEGame.ME1)
            {
                cachedME1LoadedFiles = loadedFiles;
            }
            if (game == Mod.MEGame.ME2)
            {
                cachedME2LoadedFiles = loadedFiles;
            }
            if (game == Mod.MEGame.ME3)
            {
                cachedME3LoadedFiles = loadedFiles;
            }

            return(loadedFiles);
        }
Beispiel #3
0
 public static IEnumerable <string> GetAllFiles(Mod.MEGame game) => GetEnabledDLC(game).Prepend(MEDirectories.BioGamePath(game)).SelectMany(directory => GetCookedFiles(game, directory));