diff --git a/PerformanceCalculator/Difficulty/DifficultyCommand.cs b/PerformanceCalculator/Difficulty/DifficultyCommand.cs index 8bdb8fd..83cb473 100644 --- a/PerformanceCalculator/Difficulty/DifficultyCommand.cs +++ b/PerformanceCalculator/Difficulty/DifficultyCommand.cs @@ -71,7 +71,7 @@ namespace PerformanceCalculator.Difficulty { var document = new Document(); - foreach (var error in resultSet.Errors) + foreach (string error in resultSet.Errors) document.Children.Add(new Span(error), "\n"); if (resultSet.Errors.Count > 0) document.Children.Add("\n"); diff --git a/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs b/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs index 375b84e..2ec6467 100644 --- a/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs +++ b/PerformanceCalculator/Difficulty/LegacyScoreAttributesCommand.cs @@ -67,7 +67,7 @@ namespace PerformanceCalculator.Difficulty { var document = new Document(); - foreach (var error in resultSet.Errors) + foreach (string error in resultSet.Errors) document.Children.Add(new Span(error), "\n"); if (resultSet.Errors.Count > 0) document.Children.Add("\n"); @@ -85,7 +85,7 @@ namespace PerformanceCalculator.Difficulty // Headers if (firstResult) { - foreach (var column in new[] { "Beatmap", "Mods", "Accuracy score", "Combo score", "Bonus score ratio", "Mod multiplier" }) + foreach (string column in new[] { "Beatmap", "Mods", "Accuracy score", "Combo score", "Bonus score ratio", "Mod multiplier" }) { grid.Columns.Add(GridLength.Auto); grid.Children.Add(new Cell(column)); @@ -121,7 +121,7 @@ namespace PerformanceCalculator.Difficulty var attributes = simulator.Simulate(beatmap, playableBeatmap); var conversionInfo = LegacyBeatmapConversionDifficultyInfo.FromBeatmap(playableBeatmap); - var modMultiplier = simulator.GetLegacyScoreMultiplier(mods, conversionInfo); + double modMultiplier = simulator.GetLegacyScoreMultiplier(mods, conversionInfo); return new Result { @@ -142,7 +142,7 @@ namespace PerformanceCalculator.Difficulty var availableMods = ruleset.CreateAllMods().ToList(); - foreach (var modString in Mods) + foreach (string modString in Mods) { Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.OrdinalIgnoreCase)); if (newMod == null) diff --git a/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs b/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs index a773181..751c586 100644 --- a/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs +++ b/PerformanceCalculator/Difficulty/LegacyScoreConversionCommand.cs @@ -97,7 +97,7 @@ namespace PerformanceCalculator.Difficulty var availableMods = ruleset.CreateAllMods().ToList(); var mods = new List(); - foreach (var modString in Mods) + foreach (string modString in Mods) { Mod newMod = availableMods.FirstOrDefault(m => string.Equals(m.Acronym, modString, StringComparison.OrdinalIgnoreCase)); if (newMod == null) diff --git a/PerformanceCalculator/Difficulty/ModsCommand.cs b/PerformanceCalculator/Difficulty/ModsCommand.cs index 4298ab9..8c93202 100644 --- a/PerformanceCalculator/Difficulty/ModsCommand.cs +++ b/PerformanceCalculator/Difficulty/ModsCommand.cs @@ -67,7 +67,7 @@ namespace PerformanceCalculator.Difficulty foreach (var (settingsSource, propertyInfo) in sourceProperties) { - var bindable = propertyInfo.GetValue(mod); + object? bindable = propertyInfo.GetValue(mod); Debug.Assert(bindable != null); diff --git a/PerformanceCalculator/Leaderboard/LeaderboardCommand.cs b/PerformanceCalculator/Leaderboard/LeaderboardCommand.cs index a9455ae..42958a5 100644 --- a/PerformanceCalculator/Leaderboard/LeaderboardCommand.cs +++ b/PerformanceCalculator/Leaderboard/LeaderboardCommand.cs @@ -33,7 +33,7 @@ namespace PerformanceCalculator.Leaderboard public override void Execute() { - var rulesetApiName = LegacyHelper.GetRulesetShortNameFromId(Ruleset ?? 0); + string rulesetApiName = LegacyHelper.GetRulesetShortNameFromId(Ruleset ?? 0); var leaderboard = GetJsonFromApi($"rankings/{rulesetApiName}/performance?cursor[page]={LeaderboardPage - 1}"); var calculatedPlayers = new List(); @@ -78,7 +78,7 @@ namespace PerformanceCalculator.Leaderboard double nonBonusLivePP = liveOrdered.Sum(play => Math.Pow(0.95, index++) * play); //todo: implement properly. this is pretty damn wrong. - var playcountBonusPP = (totalLivePP - nonBonusLivePP); + double playcountBonusPP = (totalLivePP - nonBonusLivePP); totalLocalPP += playcountBonusPP; calculatedPlayers.Add(new LeaderboardPlayerInfo @@ -94,7 +94,7 @@ namespace PerformanceCalculator.Leaderboard if (OutputJson) { - var json = JsonConvert.SerializeObject(calculatedPlayers); + string json = JsonConvert.SerializeObject(calculatedPlayers); Console.Write(json); } diff --git a/PerformanceCalculator/ProcessorCommand.cs b/PerformanceCalculator/ProcessorCommand.cs index d090120..39738a8 100644 --- a/PerformanceCalculator/ProcessorCommand.cs +++ b/PerformanceCalculator/ProcessorCommand.cs @@ -118,9 +118,9 @@ namespace PerformanceCalculator { ConsoleRenderer.RenderDocumentToText(document, new TextRenderTarget(writer), new Rect(0, 0, 250, Size.Infinity)); - var str = writer.GetStringBuilder().ToString(); + string str = writer.GetStringBuilder().ToString(); - var lines = str.Split('\n'); + string[] lines = str.Split('\n'); for (int i = 0; i < lines.Length; i++) lines[i] = lines[i].TrimEnd(); str = string.Join('\n', lines); @@ -143,7 +143,7 @@ namespace PerformanceCalculator var mods = new List(); - foreach (var acronym in acronyms) + foreach (string acronym in acronyms) { APIMod mod = new APIMod { Acronym = acronym }; diff --git a/PerformanceCalculator/ProcessorWorkingBeatmap.cs b/PerformanceCalculator/ProcessorWorkingBeatmap.cs index 5eac8c0..b8ecfa6 100644 --- a/PerformanceCalculator/ProcessorWorkingBeatmap.cs +++ b/PerformanceCalculator/ProcessorWorkingBeatmap.cs @@ -58,7 +58,7 @@ namespace PerformanceCalculator return new ProcessorWorkingBeatmap(fileOrId); } - if (!int.TryParse(fileOrId, out var beatmapId)) + if (!int.TryParse(fileOrId, out int beatmapId)) throw new ArgumentException("Could not parse provided beatmap ID."); string cachePath = Path.Combine("cache", $"{beatmapId}.osu"); diff --git a/PerformanceCalculator/Profile/ProfileCommand.cs b/PerformanceCalculator/Profile/ProfileCommand.cs index 7cb90d6..7d61071 100644 --- a/PerformanceCalculator/Profile/ProfileCommand.cs +++ b/PerformanceCalculator/Profile/ProfileCommand.cs @@ -32,7 +32,7 @@ namespace PerformanceCalculator.Profile var displayPlays = new List(); var ruleset = LegacyHelper.GetRulesetFromLegacyID(Ruleset ?? 0); - var rulesetApiName = LegacyHelper.GetRulesetShortNameFromId(Ruleset ?? 0); + string rulesetApiName = LegacyHelper.GetRulesetShortNameFromId(Ruleset ?? 0); Console.WriteLine("Getting user data..."); var userData = GetJsonFromApi($"users/{ProfileName}/{ruleset.ShortName}"); @@ -81,13 +81,13 @@ namespace PerformanceCalculator.Profile double nonBonusLivePP = liveOrdered.Sum(play => Math.Pow(0.95, index++) * play.LivePP); //todo: implement properly. this is pretty damn wrong. - var playcountBonusPP = (totalLivePP - nonBonusLivePP); + double playcountBonusPP = (totalLivePP - nonBonusLivePP); totalLocalPP += playcountBonusPP; double totalDiffPP = totalLocalPP - totalLivePP; if (OutputJson) { - var json = JsonConvert.SerializeObject(new + string json = JsonConvert.SerializeObject(new { Username = userData.Username, LivePp = totalLivePP, diff --git a/PerformanceCalculator/Simulate/CatchSimulateCommand.cs b/PerformanceCalculator/Simulate/CatchSimulateCommand.cs index 86fa471..d1b1c33 100644 --- a/PerformanceCalculator/Simulate/CatchSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/CatchSimulateCommand.cs @@ -40,7 +40,7 @@ namespace PerformanceCalculator.Simulate private static Dictionary generateHitResults(IBeatmap beatmap, double accuracy, int countMiss, int? countMeh, int? countGood) { - var maxCombo = beatmap.GetMaxCombo(); + int maxCombo = beatmap.GetMaxCombo(); int maxTinyDroplets = beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.OfType().Count()); int maxDroplets = beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.OfType().Count()) - maxTinyDroplets; int maxFruits = beatmap.HitObjects.Sum(h => h is Fruit ? 1 : (h as JuiceStream)?.NestedHitObjects.Count(n => n is Fruit) ?? 0); diff --git a/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs b/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs index 0287c50..ff79ca7 100644 --- a/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs @@ -41,7 +41,7 @@ namespace PerformanceCalculator.Simulate private static Dictionary generateHitResults(IBeatmap beatmap, double accuracy, int countMiss, int? countMeh, int? countOk, int? countGood, int? countGreat) { // One judgement per normal note. Two judgements per hold note (head + tail). - var totalHits = beatmap.HitObjects.Count + beatmap.HitObjects.Count(ho => ho is HoldNote); + int totalHits = beatmap.HitObjects.Count + beatmap.HitObjects.Count(ho => ho is HoldNote); if (countMeh != null || countOk != null || countGood != null || countGreat != null) { @@ -59,7 +59,7 @@ namespace PerformanceCalculator.Simulate } // Let Great=Perfect=6, Good=4, Ok=2, Meh=1, Miss=0. The total should be this. - var targetTotal = (int)Math.Round(accuracy * totalHits * 6); + int targetTotal = (int)Math.Round(accuracy * totalHits * 6); // Start by assuming every non miss is a meh // This is how much increase is needed by the rest diff --git a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs index 337a9c2..08c5149 100644 --- a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs @@ -62,7 +62,7 @@ namespace PerformanceCalculator.Simulate { int countGreat; - var totalResultCount = beatmap.HitObjects.Count; + int totalResultCount = beatmap.HitObjects.Count; if (countMeh != null || countGood != null) { @@ -153,17 +153,17 @@ namespace PerformanceCalculator.Simulate protected override double GetAccuracy(IBeatmap beatmap, Dictionary statistics) { - var countGreat = statistics[HitResult.Great]; - var countGood = statistics[HitResult.Ok]; - var countMeh = statistics[HitResult.Meh]; - var countMiss = statistics[HitResult.Miss]; + int countGreat = statistics[HitResult.Great]; + int countGood = statistics[HitResult.Ok]; + int countMeh = statistics[HitResult.Meh]; + int countMiss = statistics[HitResult.Miss]; double total = 6 * countGreat + 2 * countGood + countMeh; double max = 6 * (countGreat + countGood + countMeh + countMiss); if (statistics.TryGetValue(HitResult.SliderTailHit, out int countSliderTailHit)) { - var countSliders = beatmap.HitObjects.Count(x => x is Slider); + int countSliders = beatmap.HitObjects.Count(x => x is Slider); total += 3 * countSliderTailHit; max += 3 * countSliders; @@ -171,8 +171,8 @@ namespace PerformanceCalculator.Simulate if (statistics.TryGetValue(HitResult.LargeTickMiss, out int countLargeTickMiss)) { - var countLargeTicks = beatmap.HitObjects.Sum(obj => obj.NestedHitObjects.Count(x => x is SliderTick or SliderRepeat)); - var countLargeTickHit = countLargeTicks - countLargeTickMiss; + int countLargeTicks = beatmap.HitObjects.Sum(obj => obj.NestedHitObjects.Count(x => x is SliderTick or SliderRepeat)); + int countLargeTickHit = countLargeTicks - countLargeTickMiss; total += 0.6 * countLargeTickHit; max += 0.6 * countLargeTicks; diff --git a/PerformanceCalculator/Simulate/SimulateCommand.cs b/PerformanceCalculator/Simulate/SimulateCommand.cs index 6854325..ca88346 100644 --- a/PerformanceCalculator/Simulate/SimulateCommand.cs +++ b/PerformanceCalculator/Simulate/SimulateCommand.cs @@ -66,7 +66,7 @@ namespace PerformanceCalculator.Simulate var mods = ParseMods(ruleset, Mods, ModOptions); var beatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods); - var beatmapMaxCombo = beatmap.GetMaxCombo(); + int beatmapMaxCombo = beatmap.GetMaxCombo(); var statistics = GenerateHitResults(beatmap, mods); var scoreInfo = new ScoreInfo(beatmap.BeatmapInfo, ruleset.RulesetInfo) { diff --git a/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs b/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs index bf537a7..a1ebe4e 100644 --- a/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs @@ -34,7 +34,7 @@ namespace PerformanceCalculator.Simulate private static Dictionary generateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countGood) { - var totalResultCount = beatmap.GetMaxCombo(); + int totalResultCount = beatmap.GetMaxCombo(); int countGreat; @@ -45,7 +45,7 @@ namespace PerformanceCalculator.Simulate else { // Let Great=2, Good=1, Miss=0. The total should be this. - var targetTotal = (int)Math.Round(accuracy * totalResultCount * 2); + int targetTotal = (int)Math.Round(accuracy * totalResultCount * 2); countGreat = targetTotal - (totalResultCount - countMiss); countGood = totalResultCount - countGreat - countMiss; @@ -62,10 +62,10 @@ namespace PerformanceCalculator.Simulate protected override double GetAccuracy(IBeatmap beatmap, Dictionary statistics) { - var countGreat = statistics[HitResult.Great]; - var countGood = statistics[HitResult.Ok]; - var countMiss = statistics[HitResult.Miss]; - var total = countGreat + countGood + countMiss; + int countGreat = statistics[HitResult.Great]; + int countGood = statistics[HitResult.Ok]; + int countMiss = statistics[HitResult.Miss]; + int total = countGreat + countGood + countMiss; return (double)((2 * countGreat) + countGood) / (2 * total); } diff --git a/PerformanceCalculatorGUI/Components/ExtendedOsuSpriteText.cs b/PerformanceCalculatorGUI/Components/ExtendedOsuSpriteText.cs index d9ad4de..325cfb2 100644 --- a/PerformanceCalculatorGUI/Components/ExtendedOsuSpriteText.cs +++ b/PerformanceCalculatorGUI/Components/ExtendedOsuSpriteText.cs @@ -60,9 +60,9 @@ namespace PerformanceCalculatorGUI.Components currentData = data; - var split = data.Split('\n'); + string[] split = data.Split('\n'); - foreach (var line in split) + foreach (string line in split) textContainer.Add(new OsuSpriteText { Text = line }); } diff --git a/PerformanceCalculatorGUI/Components/StrainVisualizer.cs b/PerformanceCalculatorGUI/Components/StrainVisualizer.cs index 4b47fa8..76c6f33 100644 --- a/PerformanceCalculatorGUI/Components/StrainVisualizer.cs +++ b/PerformanceCalculatorGUI/Components/StrainVisualizer.cs @@ -76,7 +76,7 @@ namespace PerformanceCalculatorGUI.Components { // this is ugly, but it works var graphToggleBindable = new Bindable(); - var graphNum = i; + int graphNum = i; graphToggleBindable.BindValueChanged(state => { if (state.NewValue) @@ -186,7 +186,7 @@ namespace PerformanceCalculatorGUI.Components private void addStrainBars(Skill[] skills, List strainLists) { - var strainMaxValue = strainLists.Max(list => list.Max()); + float strainMaxValue = strainLists.Max(list => list.Max()); for (int i = 0; i < skills.Length; i++) { @@ -223,7 +223,7 @@ namespace PerformanceCalculatorGUI.Components for (int i = 0; i < nBars; i++) { var strainTime = TimeSpan.FromMilliseconds(TimeUntilFirstStrain.Value + lastStrainTime * i / nBars); - var tooltipText = $"~{strainTime:mm\\:ss\\.ff}"; + string tooltipText = $"~{strainTime:mm\\:ss\\.ff}"; tooltipList.Add(tooltipText); } @@ -248,13 +248,13 @@ namespace PerformanceCalculatorGUI.Components foreach (var skill in skills) { - var strains = ((StrainSkill)skill).GetCurrentStrainPeaks().ToArray(); + double[] strains = ((StrainSkill)skill).GetCurrentStrainPeaks().ToArray(); var skillStrainList = new List(); for (int i = 0; i < strains.Length; i++) { - var strain = strains[i]; + double strain = strains[i]; skillStrainList.Add(((float)strain)); } @@ -281,7 +281,7 @@ namespace PerformanceCalculatorGUI.Components { Clear(); - foreach (var val in value) + foreach (float val in value) { float length = MaxValue ?? value.Max(); if (length != 0) @@ -324,7 +324,7 @@ namespace PerformanceCalculatorGUI.Components { Clear(); - foreach (var tooltip in value) + foreach (string tooltip in value) { float size = value.Count(); if (size != 0) diff --git a/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs b/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs index f6fbbad..2e33541 100644 --- a/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs +++ b/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledFractionalNumberBox.cs @@ -17,7 +17,7 @@ namespace PerformanceCalculatorGUI.Components.TextBoxes { base.OnUserTextAdded(added); - var textToParse = Text; + string textToParse = Text; if (string.IsNullOrEmpty(Text)) { @@ -39,7 +39,7 @@ namespace PerformanceCalculatorGUI.Components.TextBoxes protected override void OnUserTextRemoved(string removed) { - var textToParse = Text; + string textToParse = Text; if (string.IsNullOrEmpty(Text)) { diff --git a/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledNumberBox.cs b/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledNumberBox.cs index f083804..62e4633 100644 --- a/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledNumberBox.cs +++ b/PerformanceCalculatorGUI/Components/TextBoxes/LimitedLabelledNumberBox.cs @@ -15,7 +15,7 @@ namespace PerformanceCalculatorGUI.Components.TextBoxes { base.OnUserTextAdded(added); - var textToParse = Text; + string textToParse = Text; if (string.IsNullOrEmpty(Text)) { @@ -37,7 +37,7 @@ namespace PerformanceCalculatorGUI.Components.TextBoxes protected override void OnUserTextRemoved(string removed) { - var textToParse = Text; + string textToParse = Text; if (string.IsNullOrEmpty(Text)) { diff --git a/PerformanceCalculatorGUI/ProcessorWorkingBeatmap.cs b/PerformanceCalculatorGUI/ProcessorWorkingBeatmap.cs index a8845d3..f4fe1f7 100644 --- a/PerformanceCalculatorGUI/ProcessorWorkingBeatmap.cs +++ b/PerformanceCalculatorGUI/ProcessorWorkingBeatmap.cs @@ -66,7 +66,7 @@ namespace PerformanceCalculatorGUI return new ProcessorWorkingBeatmap(fileOrId, null, audioManager); } - if (!int.TryParse(fileOrId, out var beatmapId)) + if (!int.TryParse(fileOrId, out int beatmapId)) throw new ArgumentException("Could not parse provided beatmap ID."); cachePath = Path.Combine(cachePath, $"{beatmapId}.osu"); diff --git a/PerformanceCalculatorGUI/RulesetHelper.cs b/PerformanceCalculatorGUI/RulesetHelper.cs index 00d85da..0160785 100644 --- a/PerformanceCalculatorGUI/RulesetHelper.cs +++ b/PerformanceCalculatorGUI/RulesetHelper.cs @@ -81,7 +81,7 @@ namespace PerformanceCalculatorGUI { int countGreat; - var totalResultCount = beatmap.HitObjects.Count; + int totalResultCount = beatmap.HitObjects.Count; if (countMeh != null || countGood != null) { @@ -172,7 +172,7 @@ namespace PerformanceCalculatorGUI private static Dictionary generateTaikoHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countGood) { - var totalResultCount = beatmap.HitObjects.OfType().Count(); + int totalResultCount = beatmap.HitObjects.OfType().Count(); int countGreat; @@ -183,7 +183,7 @@ namespace PerformanceCalculatorGUI else { // Let Great=2, Good=1, Miss=0. The total should be this. - var targetTotal = (int)Math.Round(accuracy * totalResultCount * 2); + int targetTotal = (int)Math.Round(accuracy * totalResultCount * 2); countGreat = targetTotal - (totalResultCount - countMiss); countGood = totalResultCount - countGreat - countMiss; @@ -200,7 +200,7 @@ namespace PerformanceCalculatorGUI private static Dictionary generateCatchHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood) { - var maxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)); + int maxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)); int maxTinyDroplets = beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.OfType().Count()); int maxDroplets = beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.OfType().Count()) - maxTinyDroplets; @@ -231,14 +231,14 @@ namespace PerformanceCalculatorGUI private static Dictionary generateManiaHitResults(double accuracy, IBeatmap beatmap, int countMiss) { - var totalResultCount = beatmap.HitObjects.Count; + int totalResultCount = beatmap.HitObjects.Count; // Let Great=6, Good=2, Meh=1, Miss=0. The total should be this. - var targetTotal = (int)Math.Round(accuracy * totalResultCount * 6); + int targetTotal = (int)Math.Round(accuracy * totalResultCount * 6); // Start by assuming every non miss is a meh // This is how much increase is needed by greats and goods - var delta = targetTotal - (totalResultCount - countMiss); + int delta = targetTotal - (totalResultCount - countMiss); // Each great increases total by 5 (great-meh=5) int countGreat = delta / 5; @@ -272,17 +272,17 @@ namespace PerformanceCalculatorGUI private static double getOsuAccuracy(IBeatmap beatmap, Dictionary statistics) { - var countGreat = statistics[HitResult.Great]; - var countGood = statistics[HitResult.Ok]; - var countMeh = statistics[HitResult.Meh]; - var countMiss = statistics[HitResult.Miss]; + int countGreat = statistics[HitResult.Great]; + int countGood = statistics[HitResult.Ok]; + int countMeh = statistics[HitResult.Meh]; + int countMiss = statistics[HitResult.Miss]; double total = 6 * countGreat + 2 * countGood + countMeh; double max = 6 * (countGreat + countGood + countMeh + countMiss); if (statistics.TryGetValue(HitResult.SliderTailHit, out int countSliderTailHit)) { - var countSliders = beatmap.HitObjects.Count(x => x is Slider); + int countSliders = beatmap.HitObjects.Count(x => x is Slider); total += 3 * countSliderTailHit; max += 3 * countSliders; @@ -290,8 +290,8 @@ namespace PerformanceCalculatorGUI if (statistics.TryGetValue(HitResult.LargeTickMiss, out int countLargeTicksMiss)) { - var countLargeTicks = beatmap.HitObjects.Sum(obj => obj.NestedHitObjects.Count(x => x is SliderTick or SliderRepeat)); - var countLargeTickHit = countLargeTicks - countLargeTicksMiss; + int countLargeTicks = beatmap.HitObjects.Sum(obj => obj.NestedHitObjects.Count(x => x is SliderTick or SliderRepeat)); + int countLargeTickHit = countLargeTicks - countLargeTicksMiss; total += 0.6 * countLargeTickHit; max += 0.6 * countLargeTicks; @@ -302,10 +302,10 @@ namespace PerformanceCalculatorGUI private static double getTaikoAccuracy(Dictionary statistics) { - var countGreat = statistics[HitResult.Great]; - var countGood = statistics[HitResult.Ok]; - var countMiss = statistics[HitResult.Miss]; - var total = countGreat + countGood + countMiss; + int countGreat = statistics[HitResult.Great]; + int countGood = statistics[HitResult.Ok]; + int countMiss = statistics[HitResult.Miss]; + int total = countGreat + countGood + countMiss; return (double)((2 * countGreat) + countGood) / (2 * total); } @@ -320,13 +320,13 @@ namespace PerformanceCalculatorGUI private static double getManiaAccuracy(Dictionary statistics) { - var countPerfect = statistics[HitResult.Perfect]; - var countGreat = statistics[HitResult.Great]; - var countGood = statistics[HitResult.Good]; - var countOk = statistics[HitResult.Ok]; - var countMeh = statistics[HitResult.Meh]; - var countMiss = statistics[HitResult.Miss]; - var total = countPerfect + countGreat + countGood + countOk + countMeh + countMiss; + int countPerfect = statistics[HitResult.Perfect]; + int countGreat = statistics[HitResult.Great]; + int countGood = statistics[HitResult.Good]; + int countOk = statistics[HitResult.Ok]; + int countMeh = statistics[HitResult.Meh]; + int countMiss = statistics[HitResult.Miss]; + int total = countPerfect + countGreat + countGood + countOk + countMeh + countMiss; return (double) ((6 * (countPerfect + countGreat)) + (4 * countGood) + (2 * countOk) + countMeh) / diff --git a/PerformanceCalculatorGUI/Screens/LeaderboardScreen.cs b/PerformanceCalculatorGUI/Screens/LeaderboardScreen.cs index bedfe84..c152705 100644 --- a/PerformanceCalculatorGUI/Screens/LeaderboardScreen.cs +++ b/PerformanceCalculatorGUI/Screens/LeaderboardScreen.cs @@ -323,7 +323,7 @@ namespace PerformanceCalculatorGUI.Screens var difficultyAttributes = difficultyCalculator.Calculate(mods); var performanceCalculator = rulesetInstance.CreatePerformanceCalculator(); - var livePp = score.PP ?? 0.0; + double livePp = score.PP ?? 0.0; var perfAttributes = performanceCalculator?.Calculate(parsedScore.ScoreInfo, difficultyAttributes); score.PP = perfAttributes?.Total ?? 0.0; @@ -356,7 +356,7 @@ namespace PerformanceCalculatorGUI.Screens decimal nonBonusLivePP = (decimal)liveOrdered.Select(x => x.LivePP).Sum(play => Math.Pow(0.95, index++) * play); //todo: implement properly. this is pretty damn wrong. - var playcountBonusPP = (totalLivePP - nonBonusLivePP); + decimal playcountBonusPP = (totalLivePP - nonBonusLivePP); totalLocalPP += playcountBonusPP; return new UserLeaderboardData diff --git a/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs b/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs index 1cf9452..5c8d761 100644 --- a/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs +++ b/PerformanceCalculatorGUI/Screens/ObjectInspection/ObjectDifficultyValuesContainer.cs @@ -121,7 +121,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection private void drawOsuValues(OsuDifficultyHitObject hitObject) { - var hidden = appliedMods.Value.Any(x => x is ModHidden); + bool hidden = appliedMods.Value.Any(x => x is ModHidden); flowContainer.AddRange(new[] { new ObjectInspectorDifficultyValue("Position", (hitObject.BaseObject as OsuHitObject)!.StackedPosition), diff --git a/PerformanceCalculatorGUI/Screens/ObjectInspection/OsuObjectInspectorRuleset.cs b/PerformanceCalculatorGUI/Screens/ObjectInspection/OsuObjectInspectorRuleset.cs index a058eef..657d892 100644 --- a/PerformanceCalculatorGUI/Screens/ObjectInspection/OsuObjectInspectorRuleset.cs +++ b/PerformanceCalculatorGUI/Screens/ObjectInspection/OsuObjectInspectorRuleset.cs @@ -90,7 +90,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection using (hitObject.BeginAbsoluteSequence(hitObject.StartTimeBindable.Value)) { - var hitObjectDuration = hitObject.HitObject.GetEndTime() - hitObject.StartTimeBindable.Value; + double hitObjectDuration = hitObject.HitObject.GetEndTime() - hitObject.StartTimeBindable.Value; hitObject.Delay(hitObjectDuration) .FadeTo(0.25f, 200f, Easing.Out) diff --git a/PerformanceCalculatorGUI/Screens/ProfileScreen.cs b/PerformanceCalculatorGUI/Screens/ProfileScreen.cs index 885e25e..b5b4bc1 100644 --- a/PerformanceCalculatorGUI/Screens/ProfileScreen.cs +++ b/PerformanceCalculatorGUI/Screens/ProfileScreen.cs @@ -331,17 +331,17 @@ namespace PerformanceCalculatorGUI.Screens }); decimal totalLocalPP = 0; - for (var i = 0; i < localOrdered.Count; i++) + for (int i = 0; i < localOrdered.Count; i++) totalLocalPP += (decimal)(Math.Pow(0.95, i) * (localOrdered[i].SoloScore.PP ?? 0)); decimal totalLivePP = player.Statistics.PP ?? (decimal)0.0; decimal nonBonusLivePP = 0; - for (var i = 0; i < liveOrdered.Count; i++) + for (int i = 0; i < liveOrdered.Count; i++) nonBonusLivePP += (decimal)(Math.Pow(0.95, i) * liveOrdered[i].LivePP ?? 0); //todo: implement properly. this is pretty damn wrong. - var playcountBonusPP = (totalLivePP - nonBonusLivePP); + decimal playcountBonusPP = (totalLivePP - nonBonusLivePP); totalLocalPP += playcountBonusPP; Schedule(() =>