1
0
Fork 0
mirror of https://github.com/ppy/osu-tools.git synced 2025-06-09 09:35:15 +09:00

Fix r# issues

This commit is contained in:
smoogipoo 2019-06-16 00:06:51 +09:00
parent 50e2e1416b
commit 25bb0dc493
5 changed files with 15 additions and 1 deletions

View file

@ -113,6 +113,7 @@ namespace PerformanceCalculator.Difficulty
};
break;
case TaikoDifficultyAttributes taiko:
result.AttributeData = new List<(string, object)>
{
@ -121,6 +122,7 @@ namespace PerformanceCalculator.Difficulty
};
break;
case CatchDifficultyAttributes @catch:
result.AttributeData = new List<(string, object)>
{
@ -129,6 +131,7 @@ namespace PerformanceCalculator.Difficulty
};
break;
case ManiaDifficultyAttributes mania:
result.AttributeData = new List<(string, object)>
{
@ -148,11 +151,13 @@ namespace PerformanceCalculator.Difficulty
return mods;
var availableMods = ruleset.GetAllMods().ToList();
foreach (var modString in Mods)
{
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.CurrentCultureIgnoreCase));
if (newMod == null)
throw new ArgumentException($"Invalid mod provided: {modString}");
mods.Add(newMod);
}

View file

@ -18,12 +18,16 @@ namespace PerformanceCalculator
{
default:
throw new ArgumentException("Invalid ruleset ID provided.");
case 0:
return new OsuRuleset();
case 1:
return new TaikoRuleset();
case 2:
return new CatchRuleset();
case 3:
return new ManiaRuleset();
}

View file

@ -47,11 +47,13 @@ namespace PerformanceCalculator.Profile
dynamic userData = getJsonFromApi($"get_user?k={Key}&u={ProfileName}&m={Ruleset}")[0];
Console.WriteLine("Getting user top scores...");
foreach (var play in getJsonFromApi($"get_user_best?k={Key}&u={ProfileName}&m={Ruleset}&limit=100"))
{
string beatmapID = play.beatmap_id;
string cachePath = Path.Combine("cache", $"{beatmapID}.osu");
if (!File.Exists(cachePath))
{
Console.WriteLine($"Downloading {beatmapID}.osu...");

View file

@ -20,7 +20,7 @@ namespace PerformanceCalculator.Simulate
[Command(Name = "simulate osu", Description = "Computes the performance (pp) of a simulated osu! play.")]
public class OsuSimulateCommand : SimulateCommand
{
[UsedImplicitly]
[UsedImplicitly]
[Required, FileExists]
[Argument(0, Name = "beatmap", Description = "Required. The beatmap file (.osu).")]
public override string Beatmap { get; }
@ -111,6 +111,7 @@ namespace PerformanceCalculator.Simulate
{
WriteAttribute("Accuracy", (scoreInfo.Accuracy * 100).ToString(CultureInfo.InvariantCulture) + "%");
WriteAttribute("Combo", FormattableString.Invariant($"{scoreInfo.MaxCombo} ({Math.Round(100.0 * scoreInfo.MaxCombo / GetMaxCombo(beatmap), 2)}%)"));
foreach (var statistic in scoreInfo.Statistics)
{
WriteAttribute(Enum.GetName(typeof(HitResult), statistic.Key), statistic.Value.ToString(CultureInfo.InvariantCulture));

View file

@ -94,11 +94,13 @@ namespace PerformanceCalculator.Simulate
return mods;
var availableMods = ruleset.GetAllMods().ToList();
foreach (var modString in Mods)
{
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.CurrentCultureIgnoreCase));
if (newMod == null)
throw new ArgumentException($"Invalid mod provided: {modString}");
mods.Add(newMod);
}