mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
parent
fabb64705b
commit
1a5d4efdfe
5 changed files with 98 additions and 40 deletions
|
@ -727,6 +727,18 @@ namespace PKHeX.WinForms.Controls
|
|||
}
|
||||
|
||||
// File I/O
|
||||
public bool GetBulkImportSettings(out bool clearAll, out bool? noSetb)
|
||||
{
|
||||
clearAll = false; noSetb = false;
|
||||
DialogResult dr = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Clear subsequent boxes when importing data?",
|
||||
"If you only want to overwrite for new data, press no.");
|
||||
if (dr == DialogResult.Cancel)
|
||||
return false;
|
||||
|
||||
clearAll = dr == DialogResult.Yes;
|
||||
noSetb = GetPKMSetOverride();
|
||||
return true;
|
||||
}
|
||||
private bool? GetPKMSetOverride()
|
||||
{
|
||||
var yn = ModifyPKM ? "Yes" : "No";
|
||||
|
@ -871,13 +883,9 @@ namespace PKHeX.WinForms.Controls
|
|||
if (!Directory.Exists(path))
|
||||
return false;
|
||||
|
||||
DialogResult dr = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Clear subsequent boxes when importing data?", "If you only want to overwrite for new data, press no.");
|
||||
if (dr == DialogResult.Cancel)
|
||||
if (!GetBulkImportSettings(out bool clearAll, out bool? noSetb))
|
||||
return false;
|
||||
|
||||
bool clearAll = dr == DialogResult.Yes;
|
||||
bool? noSetb = GetPKMSetOverride();
|
||||
|
||||
SAV.LoadBoxes(path, out result, Box.CurrentBox, clearAll, noSetb);
|
||||
SetPKMBoxes();
|
||||
UpdateBoxViewers();
|
||||
|
|
61
PKHeX.WinForms/Subforms/SAV_Database.Designer.cs
generated
61
PKHeX.WinForms/Subforms/SAV_Database.Designer.cs
generated
|
@ -99,10 +99,12 @@
|
|||
this.Menu_SearchDatabase = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_SearchLegal = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_SearchIllegal = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_SearchClones = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_SearchAdvanced = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_OpenDB = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_Report = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_Export = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_DeleteClones = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.P_Results = new System.Windows.Forms.Panel();
|
||||
this.PAN_Box = new System.Windows.Forms.Panel();
|
||||
this.bpkx66 = new System.Windows.Forms.PictureBox();
|
||||
|
@ -156,8 +158,7 @@
|
|||
this.L_Format = new System.Windows.Forms.Label();
|
||||
this.FLP_Level = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.RTB_Instructions = new System.Windows.Forms.RichTextBox();
|
||||
this.Menu_SearchClones = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_DeleteClones = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_Import = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx30)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx29)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx28)).BeginInit();
|
||||
|
@ -926,7 +927,7 @@
|
|||
//
|
||||
// Menu_Exit
|
||||
//
|
||||
this.Menu_Exit.Image = Properties.Resources.exit;
|
||||
this.Menu_Exit.Image = global::PKHeX.WinForms.Properties.Resources.exit;
|
||||
this.Menu_Exit.Name = "Menu_Exit";
|
||||
this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
|
||||
this.Menu_Exit.ShowShortcutKeys = false;
|
||||
|
@ -941,6 +942,7 @@
|
|||
this.Menu_OpenDB,
|
||||
this.Menu_Report,
|
||||
this.Menu_Export,
|
||||
this.Menu_Import,
|
||||
this.Menu_DeleteClones});
|
||||
this.Menu_Tools.Name = "Menu_Tools";
|
||||
this.Menu_Tools.Size = new System.Drawing.Size(47, 20);
|
||||
|
@ -955,9 +957,9 @@
|
|||
this.Menu_SearchIllegal,
|
||||
this.Menu_SearchClones,
|
||||
this.Menu_SearchAdvanced});
|
||||
this.Menu_SearchSettings.Image = Properties.Resources.settings;
|
||||
this.Menu_SearchSettings.Image = global::PKHeX.WinForms.Properties.Resources.settings;
|
||||
this.Menu_SearchSettings.Name = "Menu_SearchSettings";
|
||||
this.Menu_SearchSettings.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_SearchSettings.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_SearchSettings.Text = "Search Settings";
|
||||
//
|
||||
// Menu_SearchBoxes
|
||||
|
@ -996,6 +998,13 @@
|
|||
this.Menu_SearchIllegal.Size = new System.Drawing.Size(207, 22);
|
||||
this.Menu_SearchIllegal.Text = "Show Illegal";
|
||||
//
|
||||
// Menu_SearchClones
|
||||
//
|
||||
this.Menu_SearchClones.CheckOnClick = true;
|
||||
this.Menu_SearchClones.Name = "Menu_SearchClones";
|
||||
this.Menu_SearchClones.Size = new System.Drawing.Size(207, 22);
|
||||
this.Menu_SearchClones.Text = "Clones Only";
|
||||
//
|
||||
// Menu_SearchAdvanced
|
||||
//
|
||||
this.Menu_SearchAdvanced.CheckOnClick = true;
|
||||
|
@ -1007,28 +1016,36 @@
|
|||
//
|
||||
// Menu_OpenDB
|
||||
//
|
||||
this.Menu_OpenDB.Image = Properties.Resources.folder;
|
||||
this.Menu_OpenDB.Image = global::PKHeX.WinForms.Properties.Resources.folder;
|
||||
this.Menu_OpenDB.Name = "Menu_OpenDB";
|
||||
this.Menu_OpenDB.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_OpenDB.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_OpenDB.Text = "Open Database Folder";
|
||||
this.Menu_OpenDB.Click += new System.EventHandler(this.OpenDB);
|
||||
//
|
||||
// Menu_Report
|
||||
//
|
||||
this.Menu_Report.Image = Properties.Resources.report;
|
||||
this.Menu_Report.Image = global::PKHeX.WinForms.Properties.Resources.report;
|
||||
this.Menu_Report.Name = "Menu_Report";
|
||||
this.Menu_Report.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_Report.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_Report.Text = "Create Data Report";
|
||||
this.Menu_Report.Click += new System.EventHandler(this.GenerateDBReport);
|
||||
//
|
||||
// Menu_Export
|
||||
//
|
||||
this.Menu_Export.Image = Properties.Resources.export;
|
||||
this.Menu_Export.Image = global::PKHeX.WinForms.Properties.Resources.export;
|
||||
this.Menu_Export.Name = "Menu_Export";
|
||||
this.Menu_Export.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_Export.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_Export.Text = "Export Results to Folder";
|
||||
this.Menu_Export.Click += new System.EventHandler(this.Menu_Export_Click);
|
||||
//
|
||||
// Menu_DeleteClones
|
||||
//
|
||||
this.Menu_DeleteClones.Image = global::PKHeX.WinForms.Properties.Resources.nocheck;
|
||||
this.Menu_DeleteClones.Name = "Menu_DeleteClones";
|
||||
this.Menu_DeleteClones.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_DeleteClones.Text = "Delete Clones";
|
||||
this.Menu_DeleteClones.Click += new System.EventHandler(this.Menu_DeleteClones_Click);
|
||||
//
|
||||
// P_Results
|
||||
//
|
||||
this.P_Results.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
|
@ -1042,7 +1059,7 @@
|
|||
//
|
||||
// PAN_Box
|
||||
//
|
||||
this.PAN_Box.BackgroundImage = Properties.Resources.box_wp16xy;
|
||||
this.PAN_Box.BackgroundImage = global::PKHeX.WinForms.Properties.Resources.box_wp16xy;
|
||||
this.PAN_Box.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.PAN_Box.Controls.Add(this.bpkx66);
|
||||
this.PAN_Box.Controls.Add(this.bpkx65);
|
||||
|
@ -1818,20 +1835,13 @@
|
|||
this.RTB_Instructions.TabIndex = 119;
|
||||
this.RTB_Instructions.Text = "";
|
||||
//
|
||||
// Menu_SearchClones
|
||||
// Menu_Import
|
||||
//
|
||||
this.Menu_SearchClones.CheckOnClick = true;
|
||||
this.Menu_SearchClones.Name = "Menu_SearchClones";
|
||||
this.Menu_SearchClones.Size = new System.Drawing.Size(207, 22);
|
||||
this.Menu_SearchClones.Text = "Clones Only";
|
||||
//
|
||||
// Menu_DeleteClones
|
||||
//
|
||||
this.Menu_DeleteClones.Image = Properties.Resources.nocheck;
|
||||
this.Menu_DeleteClones.Name = "Menu_DeleteClones";
|
||||
this.Menu_DeleteClones.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_DeleteClones.Text = "Delete Clones";
|
||||
this.Menu_DeleteClones.Click += new System.EventHandler(this.Menu_DeleteClones_Click);
|
||||
this.Menu_Import.Image = global::PKHeX.WinForms.Properties.Resources.savePKM;
|
||||
this.Menu_Import.Name = "Menu_Import";
|
||||
this.Menu_Import.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_Import.Text = "Import Results to SaveFile";
|
||||
this.Menu_Import.Click += new System.EventHandler(this.Menu_Import_Click);
|
||||
//
|
||||
// SAV_Database
|
||||
//
|
||||
|
@ -2068,5 +2078,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem Menu_SearchAdvanced;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_SearchClones;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_DeleteClones;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_Import;
|
||||
}
|
||||
}
|
|
@ -402,6 +402,19 @@ namespace PKHeX.WinForms
|
|||
foreach (PKM pkm in Results)
|
||||
File.WriteAllBytes(Path.Combine(path, Util.CleanFileName(pkm.FileName)), pkm.DecryptedBoxData);
|
||||
}
|
||||
private void Menu_Import_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!BoxView.GetBulkImportSettings(out var clearAll, out var noSetb))
|
||||
return;
|
||||
|
||||
int box = BoxView.Box.CurrentBox;
|
||||
if (!SAV.LoadBoxes(Results, out var result, box, clearAll, noSetb))
|
||||
return;
|
||||
|
||||
BoxView.SetPKMBoxes();
|
||||
BoxView.UpdateBoxViewers();
|
||||
WinFormsUtil.Alert(result);
|
||||
}
|
||||
|
||||
// View Updates
|
||||
private IEnumerable<PKM> SearchDatabase()
|
||||
|
|
|
@ -132,6 +132,7 @@
|
|||
this.L_Format = new System.Windows.Forms.Label();
|
||||
this.FLP_Level = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.RTB_Instructions = new System.Windows.Forms.RichTextBox();
|
||||
this.Menu_Import = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx30)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx29)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bpkx28)).BeginInit();
|
||||
|
@ -899,7 +900,7 @@
|
|||
//
|
||||
// Menu_Exit
|
||||
//
|
||||
this.Menu_Exit.Image = Properties.Resources.exit;
|
||||
this.Menu_Exit.Image = global::PKHeX.WinForms.Properties.Resources.exit;
|
||||
this.Menu_Exit.Name = "Menu_Exit";
|
||||
this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
|
||||
this.Menu_Exit.ShowShortcutKeys = false;
|
||||
|
@ -912,7 +913,8 @@
|
|||
this.Menu_Tools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.Menu_SearchSettings,
|
||||
this.Menu_OpenDB,
|
||||
this.Menu_Export});
|
||||
this.Menu_Export,
|
||||
this.Menu_Import});
|
||||
this.Menu_Tools.Name = "Menu_Tools";
|
||||
this.Menu_Tools.Size = new System.Drawing.Size(47, 20);
|
||||
this.Menu_Tools.Text = "Tools";
|
||||
|
@ -921,9 +923,9 @@
|
|||
//
|
||||
this.Menu_SearchSettings.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.Menu_SearchAdvanced});
|
||||
this.Menu_SearchSettings.Image = Properties.Resources.settings;
|
||||
this.Menu_SearchSettings.Image = global::PKHeX.WinForms.Properties.Resources.settings;
|
||||
this.Menu_SearchSettings.Name = "Menu_SearchSettings";
|
||||
this.Menu_SearchSettings.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_SearchSettings.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_SearchSettings.Text = "Search Settings";
|
||||
//
|
||||
// Menu_SearchAdvanced
|
||||
|
@ -937,17 +939,17 @@
|
|||
//
|
||||
// Menu_OpenDB
|
||||
//
|
||||
this.Menu_OpenDB.Image = Properties.Resources.folder;
|
||||
this.Menu_OpenDB.Image = global::PKHeX.WinForms.Properties.Resources.folder;
|
||||
this.Menu_OpenDB.Name = "Menu_OpenDB";
|
||||
this.Menu_OpenDB.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_OpenDB.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_OpenDB.Text = "Open Database Folder";
|
||||
this.Menu_OpenDB.Click += new System.EventHandler(this.OpenDB);
|
||||
//
|
||||
// Menu_Export
|
||||
//
|
||||
this.Menu_Export.Image = Properties.Resources.export;
|
||||
this.Menu_Export.Image = global::PKHeX.WinForms.Properties.Resources.export;
|
||||
this.Menu_Export.Name = "Menu_Export";
|
||||
this.Menu_Export.Size = new System.Drawing.Size(197, 22);
|
||||
this.Menu_Export.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_Export.Text = "Export Results to Folder";
|
||||
this.Menu_Export.Click += new System.EventHandler(this.Menu_Export_Click);
|
||||
//
|
||||
|
@ -964,7 +966,7 @@
|
|||
//
|
||||
// PAN_Box
|
||||
//
|
||||
this.PAN_Box.BackgroundImage = Properties.Resources.box_wp16xy;
|
||||
this.PAN_Box.BackgroundImage = global::PKHeX.WinForms.Properties.Resources.box_wp16xy;
|
||||
this.PAN_Box.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.PAN_Box.Controls.Add(this.bpkx66);
|
||||
this.PAN_Box.Controls.Add(this.bpkx65);
|
||||
|
@ -1460,6 +1462,14 @@
|
|||
this.RTB_Instructions.TabIndex = 119;
|
||||
this.RTB_Instructions.Text = "";
|
||||
//
|
||||
// Menu_Import
|
||||
//
|
||||
this.Menu_Import.Image = global::PKHeX.WinForms.Properties.Resources.savePKM;
|
||||
this.Menu_Import.Name = "Menu_Import";
|
||||
this.Menu_Import.Size = new System.Drawing.Size(209, 22);
|
||||
this.Menu_Import.Text = "Import Results to SaveFile";
|
||||
this.Menu_Import.Click += new System.EventHandler(this.Menu_Import_Click);
|
||||
//
|
||||
// SAV_MysteryGiftDB
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -1667,5 +1677,6 @@
|
|||
private System.Windows.Forms.ComboBox CB_Format;
|
||||
private System.Windows.Forms.RichTextBox RTB_Instructions;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_SearchAdvanced;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_Import;
|
||||
}
|
||||
}
|
|
@ -15,9 +15,11 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
private readonly PKMEditor PKME_Tabs;
|
||||
private readonly SaveFile SAV;
|
||||
private readonly SAVEditor BoxView;
|
||||
public SAV_MysteryGiftDB(PKMEditor tabs, SAVEditor sav)
|
||||
{
|
||||
SAV = sav.SAV;
|
||||
BoxView = sav;
|
||||
PKME_Tabs = tabs;
|
||||
InitializeComponent();
|
||||
|
||||
|
@ -365,6 +367,19 @@ namespace PKHeX.WinForms
|
|||
{ Size = MinimumSize; RTB_Instructions.Clear(); }
|
||||
else Size = MaximumSize;
|
||||
}
|
||||
private void Menu_Import_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!BoxView.GetBulkImportSettings(out var clearAll, out var noSetb))
|
||||
return;
|
||||
|
||||
int box = BoxView.Box.CurrentBox;
|
||||
if (!SAV.LoadBoxes(Results, out var result, box, clearAll, noSetb))
|
||||
return;
|
||||
|
||||
BoxView.SetPKMBoxes();
|
||||
BoxView.UpdateBoxViewers();
|
||||
WinFormsUtil.Alert(result);
|
||||
}
|
||||
|
||||
private void Menu_Exit_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue