diff --git a/PKHeX.Core/Saves/Util/BoxUtil.cs b/PKHeX.Core/Saves/Util/BoxUtil.cs
index 182c16ba7..3f496b7e8 100644
--- a/PKHeX.Core/Saves/Util/BoxUtil.cs
+++ b/PKHeX.Core/Saves/Util/BoxUtil.cs
@@ -82,11 +82,11 @@ public static int DumpBox(this SaveFile SAV, string path, int currentBox)
/// Overwrite existing full slots. If true, will only overwrite empty slots.
/// Bypass option to not modify properties when setting to Save File.
/// Enumerate all files even in sub-folders.
- /// True if any files are imported.
- public static bool LoadBoxes(this SaveFile SAV, string path, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, bool? noSetb = null, bool all = false)
+ /// Count of files imported.
+ public static int LoadBoxes(this SaveFile SAV, string path, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, bool? noSetb = null, bool all = false)
{
if (string.IsNullOrWhiteSpace(path) || !Directory.Exists(path))
- { result = MsgSaveBoxExportPathInvalid; return false; }
+ { result = MsgSaveBoxExportPathInvalid; return -1; }
var opt = all ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
var filepaths = Directory.EnumerateFiles(path, "*.*", opt);
@@ -103,8 +103,8 @@ public static bool LoadBoxes(this SaveFile SAV, string path, out string result,
/// Instruction to clear boxes after the starting box.
/// Overwrite existing full slots. If true, will only overwrite empty slots.
/// Bypass option to not modify properties when setting to Save File.
- /// True if any files are imported.
- public static bool LoadBoxes(this SaveFile SAV, IEnumerable filepaths, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, bool? noSetb = null)
+ /// Count of files imported.
+ public static int LoadBoxes(this SaveFile SAV, IEnumerable filepaths, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, bool? noSetb = null)
{
var pks = GetPossiblePKMsFromPaths(SAV, filepaths);
return SAV.LoadBoxes(pks, out result, boxStart, boxClear, overwrite, noSetb);
@@ -114,16 +114,16 @@ public static bool LoadBoxes(this SaveFile SAV, IEnumerable filepaths, o
/// Loads a folder of files to the .
///
/// to load folder to.
- /// Gifts to load files from.
+ /// Encounters to create files from.
/// Result message from the method.
/// First box to start loading to. All prior boxes are not modified.
/// Instruction to clear boxes after the starting box.
/// Overwrite existing full slots. If true, will only overwrite empty slots.
/// Bypass option to not modify properties when setting to Save File.
- /// True if any files are imported.
- public static bool LoadBoxes(this SaveFile SAV, IEnumerable gifts, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, bool? noSetb = null)
+ /// Count of files imported.
+ public static int LoadBoxes(this SaveFile SAV, IEnumerable encounters, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, bool? noSetb = null)
{
- var pks = gifts.Select(z => z.ConvertToPKM(SAV));
+ var pks = encounters.Select(z => z.ConvertToPKM(SAV));
return SAV.LoadBoxes(pks, out result, boxStart, boxClear, overwrite, noSetb);
}
@@ -138,10 +138,10 @@ public static bool LoadBoxes(this SaveFile SAV, IEnumerable gifts,
/// Overwrite existing full slots. If true, will only overwrite empty slots.
/// Bypass option to not modify properties when setting to Save File.
/// True if any files are imported.
- public static bool LoadBoxes(this SaveFile SAV, IEnumerable pks, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, bool? noSetb = null)
+ public static int LoadBoxes(this SaveFile SAV, IEnumerable pks, out string result, int boxStart = 0, bool boxClear = false, bool overwrite = false, bool? noSetb = null)
{
if (!SAV.HasBox)
- { result = MsgSaveBoxFailNone; return false; }
+ { result = MsgSaveBoxFailNone; return -1; }
var compat = SAV.GetCompatible(pks);
if (boxClear)
@@ -151,11 +151,11 @@ public static bool LoadBoxes(this SaveFile SAV, IEnumerable pks, out string
if (ctr <= 0)
{
result = MsgSaveBoxImportNoFiles;
- return false;
+ return -1;
}
result = string.Format(MsgSaveBoxImportSuccess, ctr);
- return true;
+ return ctr;
}
public static IEnumerable GetPKMsFromPaths(IEnumerable filepaths, int generation)
diff --git a/PKHeX.WinForms/Subforms/SAV_Database.cs b/PKHeX.WinForms/Subforms/SAV_Database.cs
index 594138c45..d7099cdb4 100644
--- a/PKHeX.WinForms/Subforms/SAV_Database.cs
+++ b/PKHeX.WinForms/Subforms/SAV_Database.cs
@@ -416,7 +416,8 @@ private void Menu_Import_Click(object sender, EventArgs e)
return;
int box = BoxView.Box.CurrentBox;
- if (!SAV.LoadBoxes(Results, out var result, box, clearAll, overwrite, noSetb))
+ int ctr = SAV.LoadBoxes(Results, out var result, box, clearAll, overwrite, noSetb);
+ if (ctr <= 0)
return;
BoxView.SetPKMBoxes();
diff --git a/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs b/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs
index fa910fb41..67fceff6f 100644
--- a/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs
+++ b/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs
@@ -361,7 +361,8 @@ private void Menu_Import_Click(object sender, EventArgs e)
return;
int box = BoxView.Box.CurrentBox;
- if (!SAV.LoadBoxes(Results, out var result, box, clearAll, overwrite, noSetb))
+ int ctr = SAV.LoadBoxes(Results, out var result, box, clearAll, overwrite, noSetb);
+ if (ctr <= 0)
return;
BoxView.SetPKMBoxes();