Skip to content

Commit

Permalink
Don't assume acronym length
Browse files Browse the repository at this point in the history
E.g. mania mod: 10K
  • Loading branch information
smoogipoo committed Oct 23, 2024
1 parent 509791b commit 87fc84f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions PerformanceCalculator/ProcessorCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,13 @@ public static Mod[] ParseMods(Ruleset ruleset, string[] acronyms, string[] optio
{
APIMod mod = new APIMod { Acronym = acronym };

foreach (string modOption in options.Where(x => x.StartsWith($"{acronym}_", StringComparison.CurrentCultureIgnoreCase)))
foreach (string optionString in options.Where(x => x.StartsWith($"{acronym}_", StringComparison.CurrentCultureIgnoreCase)))
{
string[] split = modOption[3..].Split('=');
string optionTuple = optionString[(acronym.Length + 1)..];

string[] split = optionTuple.Split('=');
if (split.Length != 2)
throw new ArgumentException($"Invalid mod-option format (key=value): {modOption[3..]}");
throw new ArgumentException($"Invalid mod-option format (key=value): {optionTuple}");

mod.Settings[split[0]] = split[1];
}
Expand Down

0 comments on commit 87fc84f

Please sign in to comment.