Enable auto-bak loading for db

previously was only for debug builds; loads in like 2 seconds on my
computer for >70k pkm from >250 backups

if enough people complain I can add it as a setting instead
This commit is contained in:
Kurt 2017-09-04 22:27:55 -07:00
parent dcf2b5fd9c
commit 97f0f418d6

View file

@ -1,4 +1,5 @@
using System; #define LOADALL
using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -157,7 +158,7 @@ namespace PKHeX.WinForms
var pk = Results[index]; var pk = Results[index];
string path = pk.Identifier; string path = pk.Identifier;
#if DEBUG #if LOADALL
if (path.StartsWith(EXTERNAL_SAV)) if (path.StartsWith(EXTERNAL_SAV))
{ {
WinFormsUtil.Alert("Can't delete from a backup save."); WinFormsUtil.Alert("Can't delete from a backup save.");
@ -338,7 +339,7 @@ namespace PKHeX.WinForms
dbTemp.Add(pk); dbTemp.Add(pk);
}); });
#if DEBUG #if LOADALL
if (SaveUtil.GetSavesFromFolder(Main.BackupPath, false, out IEnumerable<string> result)) if (SaveUtil.GetSavesFromFolder(Main.BackupPath, false, out IEnumerable<string> result))
{ {
Parallel.ForEach(result, file => Parallel.ForEach(result, file =>
@ -405,7 +406,7 @@ namespace PKHeX.WinForms
if (!Menu_SearchDatabase.Checked) if (!Menu_SearchDatabase.Checked)
{ {
res = res.Where(pk => !pk.Identifier.StartsWith(DatabasePath + Path.DirectorySeparatorChar, StringComparison.Ordinal)); res = res.Where(pk => !pk.Identifier.StartsWith(DatabasePath + Path.DirectorySeparatorChar, StringComparison.Ordinal));
#if DEBUG #if LOADALL
res = res.Where(pk => !pk.Identifier.StartsWith(EXTERNAL_SAV, StringComparison.Ordinal)); res = res.Where(pk => !pk.Identifier.StartsWith(EXTERNAL_SAV, StringComparison.Ordinal));
#endif #endif
} }