mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Misc database tweaks
delete now interacts with the box manager, now clears from any box viewer that is open filtering to just boxes now filters out the external sav pkm filtering sources now is done prior to any field filtering
This commit is contained in:
parent
5117f3a5c9
commit
ffa7529e0f
1 changed files with 14 additions and 12 deletions
|
@ -220,16 +220,13 @@ namespace PKHeX.WinForms
|
|||
int offset = SAV.getBoxOffset(box) + slot*SAV.SIZE_STORED;
|
||||
PKM pkSAV = SAV.getStoredSlot(offset);
|
||||
|
||||
if (pkSAV.Data.SequenceEqual(pk.Data))
|
||||
{
|
||||
SAV.setStoredSlot(SAV.BlankPKM, offset);
|
||||
BoxView.setPKXBoxes();
|
||||
}
|
||||
else
|
||||
if (!pkSAV.Data.SequenceEqual(pk.Data)) // data still exists in SAV, unmodified
|
||||
{
|
||||
WinFormsUtil.Error("Database slot data does not match save data!", "Don't move Pokémon after initializing the Database, please re-open the Database viewer.");
|
||||
return;
|
||||
}
|
||||
var change = new SlotChange {Box = box, Offset = offset, Slot = slot};
|
||||
BoxView.M.SetPKM(BoxView.SAV.BlankPKM, change, true, Properties.Resources.slotDel);
|
||||
}
|
||||
// Remove from database.
|
||||
RawDB.Remove(pk);
|
||||
|
@ -402,6 +399,17 @@ namespace PKHeX.WinForms
|
|||
// Populate Search Query Result
|
||||
IEnumerable<PKM> res = RawDB;
|
||||
|
||||
// Filter for Selected Source
|
||||
if (!Menu_SearchBoxes.Checked)
|
||||
res = res.Where(pk => pk.Identifier.StartsWith(DatabasePath + Path.DirectorySeparatorChar, StringComparison.Ordinal));
|
||||
if (!Menu_SearchDatabase.Checked)
|
||||
{
|
||||
res = res.Where(pk => !pk.Identifier.StartsWith(DatabasePath + Path.DirectorySeparatorChar, StringComparison.Ordinal));
|
||||
#if DEBUG
|
||||
res = res.Where(pk => !pk.Identifier.StartsWith(EXTERNAL_SAV, StringComparison.Ordinal));
|
||||
#endif
|
||||
}
|
||||
|
||||
int format = MAXFORMAT + 1 - CB_Format.SelectedIndex;
|
||||
switch (CB_FormatComparator.SelectedIndex)
|
||||
{
|
||||
|
@ -518,12 +526,6 @@ namespace PKHeX.WinForms
|
|||
break;
|
||||
}
|
||||
|
||||
// Filter for Selected Source
|
||||
if (!Menu_SearchBoxes.Checked)
|
||||
res = res.Where(pk => pk.Identifier.StartsWith(DatabasePath + Path.DirectorySeparatorChar, StringComparison.Ordinal));
|
||||
if (!Menu_SearchDatabase.Checked)
|
||||
res = res.Where(pk => !pk.Identifier.StartsWith(DatabasePath + Path.DirectorySeparatorChar, StringComparison.Ordinal));
|
||||
|
||||
slotSelected = -1; // reset the slot last viewed
|
||||
|
||||
if (Menu_SearchLegal.Checked && !Menu_SearchIllegal.Checked)
|
||||
|
|
Loading…
Add table
Reference in a new issue