Use invariant culture for ToUpper/ToLower

Turkish is quite the language; let's try to prevent any errors down the road for internal/game string case changes.
This commit is contained in:
Kurt 2021-06-24 09:16:36 -07:00
parent 742ade78f6
commit 49488bb503
8 changed files with 11 additions and 11 deletions

View file

@ -46,7 +46,7 @@ namespace PKHeX.Core
return false;
}
var msg = message.ToLower();
var msg = message.ToLowerInvariant();
// Check dictionary
lock (dictLock)
{

View file

@ -62,7 +62,7 @@ namespace PKHeX.Core
_ => null
};
public string Extension => GetType().Name.ToLower();
public string Extension => GetType().Name.ToLowerInvariant();
public string FileName => $"{CardHeader}.{Extension}";
public abstract int Generation { get; }

View file

@ -13,7 +13,7 @@ namespace PKHeX.Core
public static readonly string[] Extensions = PKX.GetPKMExtensions();
public abstract int SIZE_PARTY { get; }
public abstract int SIZE_STORED { get; }
public string Extension => GetType().Name.ToLower();
public string Extension => GetType().Name.ToLowerInvariant();
public abstract PersonalInfo PersonalInfo { get; }
public virtual IReadOnlyList<ushort> ExtraBytes => Array.Empty<ushort>();

View file

@ -107,7 +107,7 @@ namespace PKHeX.Core
// All names are uppercase.
var sb = new System.Text.StringBuilder(nick);
for (int i = 0; i < sb.Length; i++)
sb[i] = char.ToUpper(sb[i]);
sb[i] = char.ToUpperInvariant(sb[i]);
if (language == (int)LanguageID.French)
StringConverter4.StripDiacriticsFR4(sb); // strips accents on E and I
@ -134,7 +134,7 @@ namespace PKHeX.Core
return nick;
// Gen2: All Caps
return nick.ToUpper();
return nick.ToUpperInvariant();
}
/// <summary>

View file

@ -172,7 +172,7 @@ namespace PKHeX.Core
return LoadTemplateInternal(sav);
var di = new DirectoryInfo(templatePath);
string path = Path.Combine(templatePath, $"{di.Name}.{sav.PKMType.Name.ToLower()}");
string path = Path.Combine(templatePath, $"{di.Name}.{sav.PKMType.Name.ToLowerInvariant()}");
if (!File.Exists(path) || !PKX.IsPKM(new FileInfo(path).Length))
return LoadTemplateInternal(sav);

View file

@ -23,7 +23,7 @@ namespace PKHeX.Drawing
public static Image? GetRibbonSprite(string name)
{
var resource = name.Replace("CountG3", "G3").ToLower();
var resource = name.Replace("CountG3", "G3").ToLowerInvariant();
return (Bitmap?)Resources.ResourceManager.GetObject(resource);
}
@ -37,14 +37,14 @@ namespace PKHeX.Drawing
{
if (max != 4) // Memory
{
var sprite = name.ToLower();
var sprite = name.ToLowerInvariant();
if (max == value)
return sprite + "2";
return sprite;
}
// Count ribbons
string n = name.Replace("Count", string.Empty).ToLower();
string n = name.Replace("Count", string.Empty).ToLowerInvariant();
return value switch
{
2 => n + "super",

View file

@ -27,7 +27,7 @@ namespace PKHeX.WinForms
CB_Format.Items.Clear();
CB_Format.Items.Add(MsgAny);
foreach (Type t in BatchEditing.Types)
CB_Format.Items.Add(t.Name.ToLower());
CB_Format.Items.Add(t.Name.ToLowerInvariant());
CB_Format.Items.Add(MsgAll);
CB_Format.SelectedIndex = CB_Require.SelectedIndex = 0;

View file

@ -375,7 +375,7 @@ namespace PKHeX.WinForms
private static void ExportSAV(SaveFile sav, string path)
{
var ext = Path.GetExtension(path).ToLower();
var ext = Path.GetExtension(path).ToLowerInvariant();
var flags = sav.Metadata.GetSuggestedFlags(ext);
try