mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 20:43:07 +00:00
Update database to load formats correctly
This commit is contained in:
parent
44fd5ca07c
commit
6ddaa036d4
2 changed files with 8 additions and 8 deletions
|
@ -52,19 +52,19 @@ namespace PKHeX
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
internal static PKM getPKMfromBytes(byte[] data)
|
||||
internal static PKM getPKMfromBytes(byte[] data, string ident = null)
|
||||
{
|
||||
checkEncrypted(ref data);
|
||||
switch (getPKMDataFormat(data))
|
||||
{
|
||||
case 3:
|
||||
return new PK3(data);
|
||||
return new PK3(data, ident);
|
||||
case 4:
|
||||
return new PK4(data);
|
||||
return new PK4(data, ident);
|
||||
case 5:
|
||||
return new PK5(data);
|
||||
return new PK5(data, ident);
|
||||
case 6:
|
||||
return new PK6(data);
|
||||
return new PK6(data, ident);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -90,13 +90,13 @@ namespace PKHeX
|
|||
{
|
||||
FileInfo fi = new FileInfo(file);
|
||||
if (fi.Extension.Contains(".pk") && PKX.getIsPKM(fi.Length))
|
||||
Database[0].Slot.Add(new PK6(File.ReadAllBytes(file), file));
|
||||
Database[0].Slot.Add(PKMConverter.getPKMfromBytes(File.ReadAllBytes(file), file));
|
||||
else
|
||||
loadDatabase(File.ReadAllBytes(file));
|
||||
}
|
||||
// Fetch from save file
|
||||
foreach (var pk6 in Main.SAV.BoxData.Where(pk => pk.Species != 0))
|
||||
Database[0].Slot.Add(pk6);
|
||||
foreach (var pkm in Main.SAV.BoxData.Where(pk => pk.Species != 0))
|
||||
Database[0].Slot.Add(pkm);
|
||||
|
||||
// Prepare Database
|
||||
prepareDBForSearch();
|
||||
|
|
Loading…
Reference in a new issue