public static async Task Run(RunPatcherPipelineInstructions run, 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 = LoadOrder.GetPluginsPath(run.GameRelease); } reporter?.Write(default, "Patchers to run:");