From f904b3da9728ee51c76e95915b78623a7638de26 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 2 Jul 2017 18:17:20 -0400 Subject: add unified player_add command which adds any item type (#302) --- src/TrainerMod/Framework/Commands/ArgumentParser.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/TrainerMod/Framework/Commands/ArgumentParser.cs') diff --git a/src/TrainerMod/Framework/Commands/ArgumentParser.cs b/src/TrainerMod/Framework/Commands/ArgumentParser.cs index bce068f1..6bcd3ff8 100644 --- a/src/TrainerMod/Framework/Commands/ArgumentParser.cs +++ b/src/TrainerMod/Framework/Commands/ArgumentParser.cs @@ -1,4 +1,5 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using StardewModdingAPI; @@ -58,7 +59,7 @@ namespace TrainerMod.Framework.Commands /// The argument name for error messages. /// The parsed value. /// Whether to show an error if the argument is missing. - /// Require that the argument match one of the given values. + /// Require that the argument match one of the given values (case-insensitive). public bool TryGet(int index, string name, out string value, bool required = true, string[] oneOf = null) { value = null; @@ -70,7 +71,7 @@ namespace TrainerMod.Framework.Commands this.LogError($"Argument {index} ({name}) is required."); return false; } - if (oneOf?.Any() == true && !oneOf.Contains(this.Args[index])) + if (oneOf?.Any() == true && !oneOf.Contains(this.Args[index], StringComparer.InvariantCultureIgnoreCase)) { this.LogError($"Argument {index} ({name}) must be one of {string.Join(", ", oneOf)}."); return false; -- cgit