Add drop mysterygift into box slot

Converts to pkm (pgt/pcd -> pk4, etc), then is attempted to convert to
the format of the save file.
This commit is contained in:
Kaphotics 2016-07-31 20:31:43 -07:00
parent b4a622e784
commit ea83159370

View file

@ -3326,11 +3326,13 @@ namespace PKHeX
if (files.Length <= 0)
return;
string file = files[0];
if (!PKX.getIsPKM(new FileInfo(file).Length))
FileInfo fi = new FileInfo(file);
if (!PKX.getIsPKM(fi.Length))
{ openQuick(file); return; }
byte[] data = File.ReadAllBytes(file);
PKM temp = PKMConverter.getPKMfromBytes(data);
MysteryGift mg = MysteryGift.getMysteryGift(data, fi.Extension);
PKM temp = mg != null ? mg.convertToPKM(SAV) : PKMConverter.getPKMfromBytes(data);
string c;
PKM pk = PKMConverter.convertToFormat(temp, SAV.Generation, out c);