예제 #1
0
파일: Utility.cs 프로젝트: Noggog/Synthesis
        public static TempFolder SetupDataFolder(TempFolder tempFolder, GameRelease release, string?loadOrderPath = null)
        {
            var dataFolder = new TempFolder(Path.Combine(tempFolder.Dir.Path, "Data"));

            dataFolder.Dir.DeleteEntireFolder();
            dataFolder.Dir.Create();
            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 = PluginListings.ListingsFromPath(loadOrderPath, release, dataFolder.Dir);

            LoadOrder.AlignTimestamps(loadOrderListing.OnlyEnabled().Select(m => m.ModKey), dataFolder.Dir.Path);
            return(dataFolder);
        }
예제 #2
0
 public void HasEnabledMarkers()
 {
     foreach (var release in EnumExt.GetValues <GameRelease>())
     {
         PluginListings.HasEnabledMarkers(release);
     }
 }
예제 #3
0
        public static IEnumerable <LoadOrderListing> GetLoadOrder(
            GameRelease release,
            string loadOrderFilePath,
            string dataFolderPath,
            PatcherPreferences?userPrefs = null)
        {
            // This call will impliticly get Creation Club entries, too, as the Synthesis systems should be merging
            // things into a singular load order file for consumption here
            var loadOrderListing =
                ImplicitListings.GetListings(release, dataFolderPath)
                .Select(x => new LoadOrderListing(x, enabled: true));

            if (!loadOrderFilePath.IsNullOrWhitespace())
            {
                loadOrderListing = loadOrderListing.Concat(PluginListings.RawListingsFromPath(loadOrderFilePath, release));
            }
            loadOrderListing = loadOrderListing.Distinct(x => x.ModKey);
            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);
        }
예제 #4
0
        public async Task LiveLoadOrder()
        {
            using var tmpFolder = Utility.GetTempFolder(nameof(ModListings_Tests));
            var path = Path.Combine(tmpFolder.Dir.Path, "Plugins.txt");

            File.WriteAllLines(path,
                               new string[]
            {
                Skyrim.Constants.Skyrim.ToString(),
                Skyrim.Constants.Update.ToString(),
                Skyrim.Constants.Dawnguard.ToString(),
            });
            var live = PluginListings.GetLiveLoadOrder(GameRelease.SkyrimLE, path, default, out var state);
예제 #5
0
 public void Integration(
     [Frozen] FilePath pluginsTxt,
     [Frozen] MockFileSystemWatcher watcher,
     [Frozen] MockFileSystem fs)
 {
     fs.File.WriteAllLines(pluginsTxt,
                           new string[]
     {
         TestConstants.PluginModKey.ToString(),
         TestConstants.PluginModKey2.ToString(),
         TestConstants.PluginModKey3.ToString(),
     });
     var live = PluginListings.GetLiveLoadOrder(
         GameRelease.SkyrimLE,
         pluginsTxt,
예제 #6
0
        public static async Task Run(RunPatcherPipelineInstructions run, CancellationToken cancel, IRunReporter?reporter = null)
        {
            try
            {
                // Locate profile
                if (string.IsNullOrWhiteSpace(run.ProfileDefinitionPath))
                {
                    throw new ArgumentNullException("Profile", "Could not locate profile to run");
                }

                SynthesisProfile?profile;
                if (string.IsNullOrWhiteSpace(run.ProfileName))
                {
                    profile = JsonConvert.DeserializeObject <SynthesisProfile>(File.ReadAllText(run.ProfileDefinitionPath), Constants.JsonSettings) !;
                }
                else
                {
                    var settings = JsonConvert.DeserializeObject <PipelineSettings>(File.ReadAllText(run.ProfileDefinitionPath), Constants.JsonSettings) !;
                    profile = settings.Profiles.FirstOrDefault(profile =>
                    {
                        if (run.ProfileName.Equals(profile.Nickname))
                        {
                            return(true);
                        }
                        if (run.ProfileName.Equals(profile.ID))
                        {
                            return(true);
                        }
                        return(false);
                    });
                }

                if (string.IsNullOrWhiteSpace(profile?.ID))
                {
                    throw new ArgumentException("File did not point to a valid profile");
                }

                if (profile.TargetRelease != run.GameRelease)
                {
                    throw new ArgumentException($"Target game release did not match profile's: {run.GameRelease} != {profile.TargetRelease}");
                }

                if (run.LoadOrderFilePath.IsNullOrWhitespace())
                {
                    run.LoadOrderFilePath = PluginListings.GetListingsPath(run.GameRelease);
                }

                reporter?.Write(default, "Patchers to run:");
예제 #7
0
파일: Utility.cs 프로젝트: Noggog/Synthesis
 public static IEnumerable <LoadOrderListing> TypicalLoadOrder(GameRelease release, DirectoryPath dir) => PluginListings.ListingsFromPath(PathToLoadOrderFile, release, dir);