public static IEnumerable <string> GetOfficialFiles(MEGame game) => GetOfficialDLCFiles(game).Prepend(MEDirectories.BioGamePath(game)).SelectMany(directory => GetCookedFiles(game, directory));
/// <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(MEGame game, bool forceReload = false, bool includeTFCs = false, bool includeAFCs = false) { if (!forceReload) { if (game == MEGame.ME1 && cachedME1LoadedFiles != null) { return(cachedME1LoadedFiles); } if (game == MEGame.ME2 && cachedME2LoadedFiles != null) { bool useCached = true; useCached &= !includeTFCs || !cachedME2LoadedFiles.Keys.Any(x => x.EndsWith(".tfc")); useCached &= !includeAFCs || !cachedME2LoadedFiles.Keys.Any(x => x.EndsWith(".afc")); if (useCached) { return(cachedME2LoadedFiles); } } if (game == MEGame.ME3 && cachedME3LoadedFiles != null) { bool useCached = true; useCached &= !includeTFCs || !cachedME3LoadedFiles.Keys.Any(x => x.EndsWith(".tfc")); useCached &= !includeAFCs || !cachedME3LoadedFiles.Keys.Any(x => x.EndsWith(".afc")); if (useCached) { return(cachedME3LoadedFiles); } } } //make dictionary from basegame files var loadedFiles = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); if (game == MEGame.UDK) { return(loadedFiles); } foreach (string directory in GetEnabledDLCFiles(game).OrderBy(dir => GetMountPriority(dir, game)).Prepend(MEDirectories.BioGamePath(game))) { foreach (string filePath in GetCookedFiles(game, directory, includeTFCs, includeAFCs)) { string fileName = Path.GetFileName(filePath); if (fileName != null) { loadedFiles[fileName] = filePath; } } } if (game == MEGame.ME1) { cachedME1LoadedFiles = loadedFiles; } if (game == MEGame.ME2) { cachedME2LoadedFiles = loadedFiles; } if (game == MEGame.ME3) { cachedME3LoadedFiles = loadedFiles; } return(loadedFiles); }