Пример #1
0
        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;
            }
        }
Пример #2
0
        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
            });
        }