public override void Execute() { var ruleset = Ruleset; var mods = GetMods(ruleset).ToArray(); if (!Beatmap.EndsWith(".osu")) { if (!int.TryParse(Beatmap, out _)) { Console.WriteLine("Incorrect beatmap ID."); return; } string cachePath = Path.Combine("cache", $"{Beatmap}.osu"); if (!File.Exists(cachePath)) { Console.WriteLine($"Downloading {Beatmap}.osu..."); new FileWebRequest(cachePath, $"https://osu.ppy.sh/osu/{Beatmap}").Perform(); } Beatmap = cachePath; } var workingBeatmap = new ProcessorWorkingBeatmap(Beatmap); var beatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods); var beatmapMaxCombo = GetMaxCombo(beatmap); var maxCombo = Combo ?? (int)Math.Round(PercentCombo / 100 * beatmapMaxCombo); var statistics = GenerateHitResults(Accuracy / 100, beatmap, Misses, Mehs, Goods); var score = Score; var accuracy = GetAccuracy(statistics); var scoreInfo = new ScoreInfo { Accuracy = accuracy, MaxCombo = maxCombo, Statistics = statistics, Mods = mods, TotalScore = score, RulesetID = Ruleset.RulesetInfo.ID ?? 0 }; var difficultyCalculator = ruleset.CreateDifficultyCalculator(workingBeatmap); var difficultyAttributes = difficultyCalculator.Calculate(LegacyHelper.TrimNonDifficultyAdjustmentMods(ruleset, scoreInfo.Mods).ToArray()); var performanceCalculator = ruleset.CreatePerformanceCalculator(difficultyAttributes, scoreInfo); var categoryAttribs = new Dictionary <string, double>(); double pp = performanceCalculator.Calculate(categoryAttribs); if (OutputJson) { var o = new JObject { { "Beatmap", workingBeatmap.BeatmapInfo.ToString() } }; foreach (var info in getPlayValues(scoreInfo, beatmap)) { o[info.Key] = info.Value; } o["Mods"] = mods.Length > 0 ? mods.Select(m => m.Acronym).Aggregate((c, n) => $"{c}, {n}") : "None"; foreach (var kvp in categoryAttribs) { o[kvp.Key] = kvp.Value; } o["pp"] = pp; string json = o.ToString(); Console.Write(json); if (OutputFile != null) { File.WriteAllText(OutputFile, json); } } else { var document = new Document(); document.Children.Add(new Span(workingBeatmap.BeatmapInfo.ToString()), "\n"); document.Children.Add(new Span(GetPlayInfo(scoreInfo, beatmap)), "\n"); document.Children.Add(new Span(GetAttribute("Mods", mods.Length > 0 ? mods.Select(m => m.Acronym).Aggregate((c, n) => $"{c}, {n}") : "None")), "\n"); foreach (var kvp in categoryAttribs) { document.Children.Add(new Span(GetAttribute(kvp.Key, kvp.Value.ToString(CultureInfo.InvariantCulture))), "\n"); } document.Children.Add(new Span(GetAttribute("pp", pp.ToString(CultureInfo.InvariantCulture)))); OutputDocument(document); } }