From 30d077d6d8fca3f5f533e734adc6b33e2b404079 Mon Sep 17 00:00:00 2001 From: cooolbros Date: Fri, 15 Nov 2024 12:34:32 +1100 Subject: [PATCH] =?UTF-8?q?Fix=20ToLower()=20in=20Turkish=20converting=20c?= =?UTF-8?q?apital=20I=20to=20=C4=B1,=20causing=20unexpected=20Set=C4=B1npu?= =?UTF-8?q?tenabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HUDAnimationsSerializerTests.cs | 20 +++++++++++++++++-- src/HUDAnimations/HUDAnimationsSerializer.cs | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/HUDAnimations.Tests/HUDAnimationsSerializerTests.cs b/src/HUDAnimations.Tests/HUDAnimationsSerializerTests.cs index 3b7f6df..b6cf99b 100644 --- a/src/HUDAnimations.Tests/HUDAnimationsSerializerTests.cs +++ b/src/HUDAnimations.Tests/HUDAnimationsSerializerTests.cs @@ -14,7 +14,20 @@ public void DeserializeTest() { foreach (string path in Directory.EnumerateFiles("HUDAnimationsSerializerTests/scripts")) { - HUDAnimationsSerializer.Deserialize(File.ReadAllText(path)); + string text = File.ReadAllText(path); + + HUDAnimationsSerializer.Deserialize(text); + + CultureInfo currentCulture = CultureInfo.CurrentCulture; + + foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures)) + { + CultureInfo.CurrentCulture = culture; + + HUDAnimationsSerializer.Deserialize(text); + } + + CultureInfo.CurrentCulture = currentCulture; } } @@ -29,7 +42,10 @@ public void SerializeTest() foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures)) { CultureInfo.CurrentCulture = culture; - Assert.AreEqual(text, HUDAnimationsSerializer.Serialize(animations)); + + string result = HUDAnimationsSerializer.Serialize(animations); + Assert.AreEqual(text, result, CultureInfo.CurrentCulture.Name); + HUDAnimationsSerializer.Deserialize(result); } CultureInfo.CurrentCulture = currentCulture; diff --git a/src/HUDAnimations/HUDAnimationsSerializer.cs b/src/HUDAnimations/HUDAnimationsSerializer.cs index f153e7b..83d0a33 100644 --- a/src/HUDAnimations/HUDAnimationsSerializer.cs +++ b/src/HUDAnimations/HUDAnimationsSerializer.cs @@ -181,7 +181,7 @@ bool ReadBool() : null; } - return command.ToLower() switch + return command.ToLowerInvariant() switch { "animate" => new Animate {