/// <summary> /// Sets up the filesystem with the given parameters /// </summary> /// <param name="fileSystem">Filesystem to set up</param> /// <param name="baseDirectory">Base directory for all search paths</param> /// <param name="defaultGameDirectory">Default game directory to search for content when not found in the game directory</param> /// <param name="gameDirectory">The game directory to search for content</param> /// <param name="defaultLanguage">Default game language</param> /// <param name="language">Current game language</param> /// <param name="lowViolence">Whether to add low violence search paths</param> /// <param name="enableHDModels">Whether to add HD models search paths</param> /// <param name="enableAddonsFolder">Whether to add the addons search paths</param> public static void SetupFileSystem(this IFileSystem fileSystem, string baseDirectory, string defaultGameDirectory, string gameDirectory, string defaultLanguage, string language, bool lowViolence, bool enableHDModels, bool enableAddonsFolder) { if (string.IsNullOrWhiteSpace(baseDirectory)) { throw new ArgumentException("Filesystem base directory must be valid", nameof(baseDirectory)); } if (string.IsNullOrWhiteSpace(defaultGameDirectory)) { throw new ArgumentException("Filesystem default game directory must be valid", nameof(defaultGameDirectory)); } if (string.IsNullOrWhiteSpace(gameDirectory)) { throw new ArgumentException("Filesystem game directory must be valid", nameof(gameDirectory)); } if (string.IsNullOrWhiteSpace(defaultLanguage)) { throw new ArgumentException("Filesystem default language must be valid", nameof(defaultLanguage)); } if (string.IsNullOrWhiteSpace(language)) { throw new ArgumentException("Filesystem language must be valid", nameof(language)); } var addLanguage = language != defaultLanguage; void AddGameDirectories(string gameDirectoryName, string pathID) { if (lowViolence) { fileSystem.AddSearchPath($"{baseDirectory}/{gameDirectoryName}{FileSystemConstants.Suffixes.LowViolence}", pathID, false); } if (enableAddonsFolder) { fileSystem.AddSearchPath($"{baseDirectory}/{gameDirectoryName}{FileSystemConstants.Suffixes.Addon}", pathID, false); } if (addLanguage) { fileSystem.AddSearchPath($"{baseDirectory}/{gameDirectoryName}_{language}", pathID, false); } if (enableHDModels) { fileSystem.AddSearchPath($"{baseDirectory}/{gameDirectoryName}{FileSystemConstants.Suffixes.HD}", pathID, false); } } AddGameDirectories(gameDirectory, FileSystemConstants.PathID.Game); fileSystem.AddSearchPath($"{baseDirectory}/{gameDirectory}", FileSystemConstants.PathID.Game); fileSystem.AddSearchPath($"{baseDirectory}/{gameDirectory}", FileSystemConstants.PathID.GameConfig); fileSystem.AddSearchPath($"{baseDirectory}/{gameDirectory}{FileSystemConstants.Suffixes.Downloads}", FileSystemConstants.PathID.GameDownload); AddGameDirectories(defaultGameDirectory, FileSystemConstants.PathID.DefaultGame); fileSystem.AddSearchPath(baseDirectory, FileSystemConstants.PathID.Base); fileSystem.AddSearchPath($"{baseDirectory}/{defaultGameDirectory}", FileSystemConstants.PathID.Game, false); fileSystem.AddSearchPath($"{baseDirectory}/{FileSystemConstants.PlatformDirectory}", FileSystemConstants.PathID.Platform); }