From 6ddaa036d4b0afc8b8a8039aa4cb6eb1bcfd2b3d Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Mon, 27 Jun 2016 22:20:31 -0700 Subject: [PATCH] Update database to load formats correctly --- PKM/PKMConverter.cs | 10 +++++----- SAV/SAV_Database.cs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/PKM/PKMConverter.cs b/PKM/PKMConverter.cs index 46ac92d85..12115760b 100644 --- a/PKM/PKMConverter.cs +++ b/PKM/PKMConverter.cs @@ -52,19 +52,19 @@ private static int getPKMDataFormat(byte[] data) } 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; } diff --git a/SAV/SAV_Database.cs b/SAV/SAV_Database.cs index 1742bb195..efbd11171 100644 --- a/SAV/SAV_Database.cs +++ b/SAV/SAV_Database.cs @@ -90,13 +90,13 @@ public SAV_Database(Main f1) { 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();