mirror of
https://github.com/ppy/osu-tools.git
synced 2025-06-11 18:20:35 +09:00
Make processor accept folder as argument
This commit is contained in:
parent
99762f0da0
commit
b40d3f56a9
2 changed files with 19 additions and 4 deletions
|
@ -11,9 +11,9 @@ namespace PerformanceCalculator.Difficulty
|
|||
public class DifficultyCommand : ProcessorCommand
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[Required, FileExists]
|
||||
[Argument(0, Name = "beatmap", Description = "Required. The beatmap file (.osu) to compute the difficulty for.")]
|
||||
public string Beatmap { get; }
|
||||
[Required, FileOrDirectoryExists]
|
||||
[Argument(0, Name = "path", Description = "Required. A beatmap file (.osu), or a folder containing .osu files to compute the difficulty for.")]
|
||||
public string Path { get; }
|
||||
|
||||
[UsedImplicitly]
|
||||
[Option(CommandOptionType.SingleOrNoValue, Template = "-r|--ruleset:<ruleset-id>", Description = "Optional. The ruleset to compute the beatmap difficulty for, if it's a convertible beatmap.\n"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using McMaster.Extensions.CommandLineUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
|
@ -26,8 +27,22 @@ namespace PerformanceCalculator.Difficulty
|
|||
|
||||
protected override void Execute()
|
||||
{
|
||||
var beatmap = new ProcessorWorkingBeatmap(command.Beatmap);
|
||||
if (Directory.Exists(command.Path))
|
||||
{
|
||||
foreach (string file in Directory.GetFiles(command.Path, "*.osu", SearchOption.AllDirectories))
|
||||
{
|
||||
var beatmap = new ProcessorWorkingBeatmap(file);
|
||||
command.Console.WriteLine(beatmap.BeatmapInfo.ToString());
|
||||
|
||||
processBeatmap(beatmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
processBeatmap(new ProcessorWorkingBeatmap(command.Path));
|
||||
}
|
||||
|
||||
private void processBeatmap(WorkingBeatmap beatmap)
|
||||
{
|
||||
// Get the ruleset
|
||||
var ruleset = getRuleset(command.Ruleset ?? beatmap.BeatmapInfo.RulesetID);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue