Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit a045f88

Browse files
committed
[Fix] Parse to Enum case-insensitive
1 parent a4f5368 commit a045f88

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

StoreCommands.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ public async Task PackagesAsync(CommandContext cct, [Description("Specify a prod
308308
await cct.RespondAsync("Please supply all required arguments. Example: advancedpackages 9wzdncrfj3tj Int US-EN");
309309
return;
310310
}
311-
bool marketresult = Enum.TryParse(localestring.Split('-')[0], out Market market);
312-
bool langresult = Enum.TryParse(localestring.Split('-')[1].ToLower(), out Lang lang);
311+
bool marketresult = Enum.TryParse(localestring.Split('-')[0], true, out Market market);
312+
bool langresult = Enum.TryParse(localestring.Split('-')[1].ToLower(), true, out Lang lang);
313313
if (!marketresult || !langresult)
314314
{
315315
await cct.RespondAsync($"Invalid Market or Lang specified. Example: US-EN for United States English, you provided Market {localestring.Split('-')[0]} and Language {localestring.Split('-')[1]}");
316316
return;
317317
}
318-
bool environmentresult = Enum.TryParse(environment, out DCatEndpoint env);
318+
bool environmentresult = Enum.TryParse(environment, true, out DCatEndpoint env);
319319
if (!environmentresult)
320320
{
321321
await cct.RespondAsync($"Invalid Environment specified. Example: Production for Production, Int for Instance. You provided {environment}");
@@ -520,14 +520,14 @@ public async Task PackagesAsync(CommandContext cct, [Description("Specify a prod
520520
await cct.RespondAsync("Please supply all required arguments. Example: advancedquery 9wzdncrfj3tj Int US-EN");
521521
return;
522522
}
523-
bool marketresult = Enum.TryParse(localestring.Split('-')[0], out Market market);
524-
bool langresult = Enum.TryParse(localestring.Split('-')[1].ToLower(), out Lang lang);
523+
bool marketresult = Enum.TryParse(localestring.Split('-')[0], true, out Market market);
524+
bool langresult = Enum.TryParse(localestring.Split('-')[1].ToLower(), true, out Lang lang);
525525
if (!marketresult || !langresult)
526526
{
527527
await cct.RespondAsync($"Invalid Market or Lang specified. Example: US-EN for United States English, you provided Market {localestring.Split('-')[0]} and Language {localestring.Split('-')[1]}");
528528
return;
529529
}
530-
bool environmentresult = Enum.TryParse(environment, out DCatEndpoint env);
530+
bool environmentresult = Enum.TryParse(environment, true, out DCatEndpoint env);
531531
if (!environmentresult)
532532
{
533533
await cct.RespondAsync($"Invalid Environment specified. Example: Production for Production, Int for Instance. You provided {environment}");
@@ -609,7 +609,7 @@ public async Task SearchAsync(CommandContext cct, [Description("Query string")]
609609
return;
610610
}
611611

612-
if (!Enum.TryParse(deviceFamily, out DeviceFamily deviceFamilyEnum))
612+
if (!Enum.TryParse(deviceFamily, true, out DeviceFamily deviceFamilyEnum))
613613
{
614614
await cct.RespondAsync($"Invalid DeviceFamily. Valid choices: [{string.Join(",", Enum.GetNames(typeof(DeviceFamily)))}] ... you provided DeviceFamily: {deviceFamily}.");
615615
return;

0 commit comments

Comments
 (0)