mirror of
https://github.com/ppy/osu-tools.git
synced 2025-06-09 17:44:46 +09:00
Fix r# issues
This commit is contained in:
parent
50e2e1416b
commit
25bb0dc493
5 changed files with 15 additions and 1 deletions
|
@ -113,6 +113,7 @@ namespace PerformanceCalculator.Difficulty
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TaikoDifficultyAttributes taiko:
|
case TaikoDifficultyAttributes taiko:
|
||||||
result.AttributeData = new List<(string, object)>
|
result.AttributeData = new List<(string, object)>
|
||||||
{
|
{
|
||||||
|
@ -121,6 +122,7 @@ namespace PerformanceCalculator.Difficulty
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CatchDifficultyAttributes @catch:
|
case CatchDifficultyAttributes @catch:
|
||||||
result.AttributeData = new List<(string, object)>
|
result.AttributeData = new List<(string, object)>
|
||||||
{
|
{
|
||||||
|
@ -129,6 +131,7 @@ namespace PerformanceCalculator.Difficulty
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ManiaDifficultyAttributes mania:
|
case ManiaDifficultyAttributes mania:
|
||||||
result.AttributeData = new List<(string, object)>
|
result.AttributeData = new List<(string, object)>
|
||||||
{
|
{
|
||||||
|
@ -148,11 +151,13 @@ namespace PerformanceCalculator.Difficulty
|
||||||
return mods;
|
return mods;
|
||||||
|
|
||||||
var availableMods = ruleset.GetAllMods().ToList();
|
var availableMods = ruleset.GetAllMods().ToList();
|
||||||
|
|
||||||
foreach (var modString in Mods)
|
foreach (var modString in Mods)
|
||||||
{
|
{
|
||||||
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.CurrentCultureIgnoreCase));
|
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.CurrentCultureIgnoreCase));
|
||||||
if (newMod == null)
|
if (newMod == null)
|
||||||
throw new ArgumentException($"Invalid mod provided: {modString}");
|
throw new ArgumentException($"Invalid mod provided: {modString}");
|
||||||
|
|
||||||
mods.Add(newMod);
|
mods.Add(newMod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,16 @@ namespace PerformanceCalculator
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException("Invalid ruleset ID provided.");
|
throw new ArgumentException("Invalid ruleset ID provided.");
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
return new OsuRuleset();
|
return new OsuRuleset();
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return new TaikoRuleset();
|
return new TaikoRuleset();
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
return new CatchRuleset();
|
return new CatchRuleset();
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
return new ManiaRuleset();
|
return new ManiaRuleset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,11 +47,13 @@ namespace PerformanceCalculator.Profile
|
||||||
dynamic userData = getJsonFromApi($"get_user?k={Key}&u={ProfileName}&m={Ruleset}")[0];
|
dynamic userData = getJsonFromApi($"get_user?k={Key}&u={ProfileName}&m={Ruleset}")[0];
|
||||||
|
|
||||||
Console.WriteLine("Getting user top scores...");
|
Console.WriteLine("Getting user top scores...");
|
||||||
|
|
||||||
foreach (var play in getJsonFromApi($"get_user_best?k={Key}&u={ProfileName}&m={Ruleset}&limit=100"))
|
foreach (var play in getJsonFromApi($"get_user_best?k={Key}&u={ProfileName}&m={Ruleset}&limit=100"))
|
||||||
{
|
{
|
||||||
string beatmapID = play.beatmap_id;
|
string beatmapID = play.beatmap_id;
|
||||||
|
|
||||||
string cachePath = Path.Combine("cache", $"{beatmapID}.osu");
|
string cachePath = Path.Combine("cache", $"{beatmapID}.osu");
|
||||||
|
|
||||||
if (!File.Exists(cachePath))
|
if (!File.Exists(cachePath))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Downloading {beatmapID}.osu...");
|
Console.WriteLine($"Downloading {beatmapID}.osu...");
|
||||||
|
|
|
@ -111,6 +111,7 @@ namespace PerformanceCalculator.Simulate
|
||||||
{
|
{
|
||||||
WriteAttribute("Accuracy", (scoreInfo.Accuracy * 100).ToString(CultureInfo.InvariantCulture) + "%");
|
WriteAttribute("Accuracy", (scoreInfo.Accuracy * 100).ToString(CultureInfo.InvariantCulture) + "%");
|
||||||
WriteAttribute("Combo", FormattableString.Invariant($"{scoreInfo.MaxCombo} ({Math.Round(100.0 * scoreInfo.MaxCombo / GetMaxCombo(beatmap), 2)}%)"));
|
WriteAttribute("Combo", FormattableString.Invariant($"{scoreInfo.MaxCombo} ({Math.Round(100.0 * scoreInfo.MaxCombo / GetMaxCombo(beatmap), 2)}%)"));
|
||||||
|
|
||||||
foreach (var statistic in scoreInfo.Statistics)
|
foreach (var statistic in scoreInfo.Statistics)
|
||||||
{
|
{
|
||||||
WriteAttribute(Enum.GetName(typeof(HitResult), statistic.Key), statistic.Value.ToString(CultureInfo.InvariantCulture));
|
WriteAttribute(Enum.GetName(typeof(HitResult), statistic.Key), statistic.Value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
|
|
@ -94,11 +94,13 @@ namespace PerformanceCalculator.Simulate
|
||||||
return mods;
|
return mods;
|
||||||
|
|
||||||
var availableMods = ruleset.GetAllMods().ToList();
|
var availableMods = ruleset.GetAllMods().ToList();
|
||||||
|
|
||||||
foreach (var modString in Mods)
|
foreach (var modString in Mods)
|
||||||
{
|
{
|
||||||
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.CurrentCultureIgnoreCase));
|
Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.CurrentCultureIgnoreCase));
|
||||||
if (newMod == null)
|
if (newMod == null)
|
||||||
throw new ArgumentException($"Invalid mod provided: {modString}");
|
throw new ArgumentException($"Invalid mod provided: {modString}");
|
||||||
|
|
||||||
mods.Add(newMod);
|
mods.Add(newMod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue