mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-01 17:58:08 -05:00
When dumping all boxes to a folder, prompt user if he wants to create a folder for each box instead of dumping all pk6 files at the same folder.
This commit is contained in:
@@ -3277,6 +3277,8 @@ private void mainMenuBoxDumpLoad(object sender, EventArgs e)
|
||||
if (dr == DialogResult.Cancel) return;
|
||||
string exepath = Application.StartupPath;
|
||||
string path = "";
|
||||
bool dumptoboxes = false;
|
||||
string boxfolder = "";
|
||||
{
|
||||
int offset = SaveGame.Box;
|
||||
const int size = 232;
|
||||
@@ -3318,10 +3320,15 @@ private void mainMenuBoxDumpLoad(object sender, EventArgs e)
|
||||
}
|
||||
else if (ld == DialogResult.No)
|
||||
{
|
||||
// open folder dialog
|
||||
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
||||
if (fbd.ShowDialog() == DialogResult.OK)
|
||||
path = fbd.SelectedPath;
|
||||
DialogResult sd = Util.Prompt(MessageBoxButtons.YesNo, "Save each box separately?");
|
||||
if (sd == DialogResult.Yes)
|
||||
{
|
||||
dumptoboxes = true;
|
||||
}
|
||||
// open folder dialog
|
||||
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
||||
if (fbd.ShowDialog() == DialogResult.OK)
|
||||
path = fbd.SelectedPath;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
@@ -3358,8 +3365,12 @@ private void mainMenuBoxDumpLoad(object sender, EventArgs e)
|
||||
+ chk.ToString("X4") + EC.ToString("X8")
|
||||
+ ".pk6";
|
||||
Array.Resize(ref pkxdata, 232);
|
||||
if (!File.Exists(Path.Combine(path, savedname)))
|
||||
File.WriteAllBytes(Path.Combine(path, Util.CleanFileName(savedname)), pkxdata);
|
||||
if (dumptoboxes){
|
||||
boxfolder = "Box"+(((i/size)/30)+1).ToString()+"\\";
|
||||
Directory.CreateDirectory(Path.Combine(path, boxfolder));
|
||||
}
|
||||
if (!File.Exists(Path.Combine(Path.Combine(path, boxfolder), savedname)))
|
||||
File.WriteAllBytes(Path.Combine(Path.Combine(path, boxfolder), Util.CleanFileName(savedname)), pkxdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user