diff --git a/PKHeX.Core/PKM/PKX.cs b/PKHeX.Core/PKM/PKX.cs index 7c4cd269b..c39035e63 100644 --- a/PKHeX.Core/PKM/PKX.cs +++ b/PKHeX.Core/PKM/PKX.cs @@ -41,24 +41,23 @@ public static class PKX internal const int SIZE_6STORED = 0xE8; internal const int SIZE_6BLOCK = 56; + private static readonly HashSet Sizes = new HashSet + { + SIZE_1JLIST, SIZE_1ULIST, + SIZE_2ULIST, SIZE_2JLIST, + SIZE_3STORED, SIZE_3PARTY, + SIZE_3CSTORED, SIZE_3XSTORED, + SIZE_4STORED, SIZE_4PARTY, + SIZE_5PARTY, + SIZE_6STORED, SIZE_6PARTY + }; + /// /// Determines if the given length is valid for a . /// /// Data length of the file/array. /// A indicating whether or not the length is valid for a . - public static bool IsPKM(long len) - { - return new[] - { - SIZE_1JLIST, SIZE_1ULIST, - SIZE_2ULIST, SIZE_2JLIST, - SIZE_3STORED, SIZE_3PARTY, - SIZE_3CSTORED, SIZE_3XSTORED, - SIZE_4STORED, SIZE_4PARTY, - SIZE_5PARTY, - SIZE_6STORED, SIZE_6PARTY - }.Contains((int)len); - } + public static bool IsPKM(long len) => Sizes.Contains((int)len); public static uint LCRNG(uint seed) => RNG.LCRNG.Next(seed); public static uint LCRNG(ref uint seed) => seed = RNG.LCRNG.Next(seed); diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs index ed7d1ff58..a3f6e7b2a 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Misc4.cs @@ -217,9 +217,9 @@ private void ReadPoketch() private void SavePoketch() { byte count = 0; - for (int i = 0; i < CLB_Poketch.Items.Count; i++) + for (int i = 1; i < CLB_Poketch.Items.Count; i++) { - if (CLB_Poketch.GetItemChecked(i)) + if (CLB_Poketch.GetItemChecked(i-1)) { count++; if (!oldPoketchVal[i])