diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index 0700cb641..c721d11ab 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -164,7 +164,7 @@ public static void RefreshMGDB(string localDbPath) var g7 = GetWC7DB(Util.GetBinaryResource("wc7.pkl"), Util.GetBinaryResource("wc7full.pkl")); if (Directory.Exists(localDbPath)) - foreach (var file in Directory.GetFiles(localDbPath, "*", SearchOption.AllDirectories)) + foreach (var file in Directory.EnumerateFiles(localDbPath, "*", SearchOption.AllDirectories)) { var fi = new FileInfo(file); if (!MysteryGift.IsMysteryGift(fi.Length)) diff --git a/PKHeX.Core/Saves/SaveUtil.cs b/PKHeX.Core/Saves/SaveUtil.cs index 994a34a28..a0cca1a8e 100644 --- a/PKHeX.Core/Saves/SaveUtil.cs +++ b/PKHeX.Core/Saves/SaveUtil.cs @@ -581,7 +581,7 @@ public static bool GetSavesFromFolder(string folderPath, bool deep, out IEnumera try { var searchOption = deep ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; - var files = Directory.GetFiles(folderPath, "*", searchOption); + var files = Directory.EnumerateFiles(folderPath, "*", searchOption); result = files.Where(f => IsSizeValid((int)new FileInfo(f).Length)); return true; } @@ -1015,7 +1015,7 @@ public static ushort[] AdvanceGCKeys(ushort[] oldKeys) /// Encrypted byte array of savedata to decrypt. /// Array of possible paths to check for xorpad compatibility. /// Returns a if decryption was successful, else null. - public static SaveFile GetSAVfromXORpads(byte[] input, string[] XORpads) + public static SaveFile GetSAVfromXORpads(byte[] input, IEnumerable XORpads) { byte[] savID = new byte[0x10]; Array.Copy(input, 0x10, savID, 0, 0x10); diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 7b3e72136..e9dbfbdea 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -651,13 +651,13 @@ private bool OpenXOR(byte[] input, string path) { // try to get a save file via xorpad in same folder var folder = new DirectoryInfo(path).Parent.FullName; - string[] pads = Directory.GetFiles(folder); + var pads = Directory.EnumerateFiles(folder); var s = SaveUtil.GetSAVfromXORpads(input, pads); if (s == null) // failed to find xorpad in path folder { // try again - pads = Directory.GetFiles(WorkingDirectory); + pads = Directory.EnumerateFiles(WorkingDirectory); s = SaveUtil.GetSAVfromXORpads(input, pads); } diff --git a/PKHeX.WinForms/Subforms/SAV_Database.cs b/PKHeX.WinForms/Subforms/SAV_Database.cs index 793560f55..d4d36694f 100644 --- a/PKHeX.WinForms/Subforms/SAV_Database.cs +++ b/PKHeX.WinForms/Subforms/SAV_Database.cs @@ -329,7 +329,7 @@ private void GenerateDBReport(object sender, EventArgs e) private void LoadDatabase() { var dbTemp = new ConcurrentBag(); - var files = Directory.GetFiles(DatabasePath, "*", SearchOption.AllDirectories); + var files = Directory.EnumerateFiles(DatabasePath, "*", SearchOption.AllDirectories); Parallel.ForEach(files, file => { FileInfo fi = new FileInfo(file); diff --git a/PKHeX.WinForms/Util/SAVUtil.cs b/PKHeX.WinForms/Util/SAVUtil.cs index 88cded897..9568bf05b 100644 --- a/PKHeX.WinForms/Util/SAVUtil.cs +++ b/PKHeX.WinForms/Util/SAVUtil.cs @@ -102,7 +102,7 @@ public static bool LoadBoxes(this SaveFile SAV, string path, out string result, int maxCount = SAV.BoxCount*SAV.BoxSlotCount; int ctr = startCount; int pastctr = 0; - string[] filepaths = Directory.GetFiles(path, "*.*", SearchOption.TopDirectoryOnly); + var filepaths = Directory.EnumerateFiles(path, "*.*", SearchOption.TopDirectoryOnly); foreach (var file in filepaths) {