private CustomWorkingBeatmap(Beatmap beatmap, int?beatmapId = null) : base(beatmap.BeatmapInfo, null) { this.beatmap = beatmap; beatmap.BeatmapInfo.Ruleset = LegacyHelper.GetRulesetFromLegacyID(beatmap.BeatmapInfo.RulesetID).RulesetInfo; if (beatmapId.HasValue) { beatmap.BeatmapInfo.OnlineBeatmapID = beatmapId; } }
public ComputeDifficultyResult ComputeDifficulty(string beatmapPath, int rulesetId, int mods) { var working = new CustomWorkingBeatmap(beatmapPath); var targetRuleset = LegacyHelper.GetRulesetFromLegacyID(rulesetId); var targetMods = targetRuleset.ConvertFromLegacyMods((LegacyMods)mods).ToArray(); var attributes = targetRuleset.CreateDifficultyCalculator(working).Calculate(targetMods); return(new ComputeDifficultyResult { Stars = attributes.StarRating }); }