diff --git a/Directory.Build.props b/Directory.Build.props index e0616d5e6..e64c2a02e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 24.05.05 + 24.06.03 12 enable en diff --git a/PKHeX.Core/Resources/legality/mgdb/wc7full.pkl b/PKHeX.Core/Resources/legality/mgdb/wc7full.pkl index 248b650e6..3b5af2616 100644 Binary files a/PKHeX.Core/Resources/legality/mgdb/wc7full.pkl and b/PKHeX.Core/Resources/legality/mgdb/wc7full.pkl differ diff --git a/PKHeX.Core/Resources/legality/mgdb/wc9.pkl b/PKHeX.Core/Resources/legality/mgdb/wc9.pkl index 2bf6f306b..652ecaf8f 100644 Binary files a/PKHeX.Core/Resources/legality/mgdb/wc9.pkl and b/PKHeX.Core/Resources/legality/mgdb/wc9.pkl differ diff --git a/PKHeX.Core/Resources/legality/wild/encounter_go_home.pkl b/PKHeX.Core/Resources/legality/wild/encounter_go_home.pkl index 4929de105..54ada6006 100644 Binary files a/PKHeX.Core/Resources/legality/wild/encounter_go_home.pkl and b/PKHeX.Core/Resources/legality/wild/encounter_go_home.pkl differ diff --git a/PKHeX.Core/Resources/legality/wild/encounter_go_lgpe.pkl b/PKHeX.Core/Resources/legality/wild/encounter_go_lgpe.pkl index 9af64a6ac..f0b0010fa 100644 Binary files a/PKHeX.Core/Resources/legality/wild/encounter_go_lgpe.pkl and b/PKHeX.Core/Resources/legality/wild/encounter_go_lgpe.pkl differ diff --git a/PKHeX.Core/Util/ResourceUtil.cs b/PKHeX.Core/Util/ResourceUtil.cs index 7043ef83f..329190908 100644 --- a/PKHeX.Core/Util/ResourceUtil.cs +++ b/PKHeX.Core/Util/ResourceUtil.cs @@ -155,6 +155,8 @@ public static string[] GetStringList(string fileName) if (IsStringListCached(fileName, out var result)) return result; var txt = GetStringResource(fileName); // Fetch File, \n to list. + if (txt is null) + return []; return LoadStringList(fileName, txt); } @@ -168,10 +170,8 @@ public static bool IsStringListCached(string fileName, [NotNullWhen(true)] out s /// Loads a text into the program with a value of . /// /// Caches the result array for future fetches. - public static string[] LoadStringList(string file, string? txt) + private static string[] LoadStringList(string file, string txt) { - if (txt == null) - return []; string[] raw = FastSplit(txt); // Make sure only one thread can write to the cache diff --git a/PKHeX.WinForms/Resources/text/changelog.txt b/PKHeX.WinForms/Resources/text/changelog.txt index 75ca63d29..4bbf4452e 100644 --- a/PKHeX.WinForms/Resources/text/changelog.txt +++ b/PKHeX.WinForms/Resources/text/changelog.txt @@ -1,7 +1,24 @@ PKHeX - By Kaphotics http://projectpokemon.org/pkhex/ -24/05/05 - New Update: +24/06/03 - New Update: + - Legality: Added automatic (basic) Trash Byte checks for Switch-era (Gen7b+) files. Further refinement & expansion in the future. + - - Fixed: Mystery gifts distributed with nicknames no longer flag IsNicknamed as invalid. + - Added: Entity editor move dropdown now displays the move's type on the left side. + - Added: Entire boxes can be dragged & dropped. Must enable via setting as it is not intuitive. Drag from the Box tab rectangle. + - Added: Report grid can now specify extra properties to show, as well as properties to hide. Change via settings. + - Added: Gen1-3 save file language/version detection updated for more edge cases. + - Added: Gen2-5 localization text files added for less popular languages. Thanks @abcboy101 ! + - Added: Gen3 GBA<->GC string conversion logic to handle special text entry. Thanks @abcboy101 ! + - Added: Gen4 Seal/Accessory/Backdrop editors. Thanks @abcboy101 ! + - Added: Gen5 Geonet/Unity Tower can now edit country/region data. Thanks @abcboy101 ! + - Fixed: Gen6/7 entities now save the volatile status effect rather than wiping it (see previous release notes). + - Fixed: Gen3-7 Nidoran/Farfetch'd text char quirks updated to better align with GameFreak's mess. + - Fixed: Gen1/2 quirks with box data have been rewritten and resolved. + - Changed: Gen1-3 emulator save formats that store RTC data are now detected more reliably. + - Changed: More performance improvements as always! Additionally, translations can now handle Enum localization. + +24/05/05 - New Update: (101440) [8778313] - Legality: Added Regulation G. - Added: Entity editor can now modify battle-Status effects (Burn, Paralyze, etc). Click the bottom right corner of the window for the GUI. - Added: Gen5 trainer records can now be edited via Misc editor. Not documented well, but exposes the values for editing. diff --git a/PKHeX.WinForms/Util/WinFormsTranslator.cs b/PKHeX.WinForms/Util/WinFormsTranslator.cs index da5291f4b..c8f6d4b7a 100644 --- a/PKHeX.WinForms/Util/WinFormsTranslator.cs +++ b/PKHeX.WinForms/Util/WinFormsTranslator.cs @@ -108,21 +108,19 @@ private static void TranslateControl(object c, TranslationContext context, ReadO } } - private static ReadOnlySpan GetTranslationFile(ReadOnlySpan lang) + private static ReadOnlySpan GetTranslationFile(ReadOnlySpan lang) { var file = GetTranslationFileNameInternal(lang); // Check to see if the desired translation file exists in the same folder as the executable string externalLangPath = GetTranslationFileNameExternal(file); if (File.Exists(externalLangPath)) { - try { return File.ReadAllLines(externalLangPath); } + try { return File.ReadAllText(externalLangPath); } catch { /* In use? Just return the internal resource. */ } } - if (Util.IsStringListCached(file, out var result)) - return result; var txt = (string?)Properties.Resources.ResourceManager.GetObject(file); - return Util.LoadStringList(file, txt); + return txt ?? ""; } private static IEnumerable GetTranslatableControls(Control f) @@ -320,9 +318,10 @@ public sealed class TranslationContext public void Clear() => Translation.Clear(); - public TranslationContext(ReadOnlySpan content, char separator = Separator) + public TranslationContext(ReadOnlySpan content, char separator = Separator) { - foreach (var line in content) + var iterator = content.EnumerateLines(); + foreach (var line in iterator) LoadLine(line, separator); } @@ -352,18 +351,19 @@ public IEnumerable Write(char separator = Separator) return Translation.Select(z => $"{z.Key}{separator}{z.Value}").OrderBy(z => z.Contains('.')).ThenBy(z => z); } - public void UpdateFrom(ReadOnlySpan lines) + public void UpdateFrom(ReadOnlySpan text) { + var lines = text.EnumerateLines(); foreach (var line in lines) { var split = line.IndexOf(Separator); if (split < 0) continue; - var key = line[..split]; + var key = line[..split].ToString(); ref var exist = ref CollectionsMarshal.GetValueRefOrNullRef(Translation, key); if (!Unsafe.IsNullRef(ref exist)) - exist = line[(split + 1)..]; + exist = line[(split + 1)..].ToString(); } }