Exemple #1
0
        public static TempFolder SetupDataFolder(TempFolder tempFolder, GameRelease release, string?loadOrderPath = null)
        {
            var dataFolder = new TempFolder(Path.Combine(tempFolder.Dir.Path, "Data"));

            loadOrderPath ??= PathToLoadOrderFile;
            string testPath, overridePath;

            switch (release)
            {
            case GameRelease.Oblivion:
                testPath     = OblivionPathToTestFile;
                overridePath = OblivionPathToOverrideFile;
                break;

            case GameRelease.SkyrimLE:
            case GameRelease.SkyrimSE:
                testPath     = LePathToTestFile;
                overridePath = LePathToOverrideFile;
                break;

            default:
                throw new NotImplementedException();
            }
            File.Copy(testPath, Path.Combine(dataFolder.Dir.Path, TestFileName));
            File.Copy(overridePath, Path.Combine(dataFolder.Dir.Path, OverrideFileName));
            var loadOrderListing = LoadOrder.FromPath(loadOrderPath, release, dataFolder.Dir);

            LoadOrder.AlignTimestamps(loadOrderListing.OnlyEnabled().Select(m => m.ModKey), dataFolder.Dir.Path);
            return(dataFolder);
        }
        public IEnumerable <LoadOrderListing> GetLoadOrder(
            GameRelease release,
            string loadOrderFilePath,
            string dataFolderPath,
            UserPreferences?userPrefs = null,
            bool throwOnMissingMods   = true)
        {
            var loadOrderListing = LoadOrder.FromPath(loadOrderFilePath, release, dataFolderPath);

            if (userPrefs?.InclusionMods != null)
            {
                var inclusions = userPrefs.InclusionMods.ToHashSet();
                loadOrderListing = loadOrderListing
                                   .Where(m => inclusions.Contains(m.ModKey));
            }
            if (userPrefs?.ExclusionMods != null)
            {
                var exclusions = userPrefs.ExclusionMods.ToHashSet();
                loadOrderListing = loadOrderListing
                                   .Where(m => !exclusions.Contains(m.ModKey));
            }
            return(loadOrderListing);
        }
Exemple #3
0
 public static IEnumerable <LoadOrderListing> TypicalLoadOrder(GameRelease release, DirectoryPath dir) => LoadOrder.FromPath(PathToLoadOrderFile, release, dir);