Use start index for writing box binary

Closes #2390 ty @PKMWM1 !
This commit is contained in:
Kurt 2019-09-23 15:12:03 -07:00
parent a60a73e9d5
commit 78b7409e77

View file

@ -911,10 +911,10 @@ namespace PKHeX.Core
return false; return false;
int expectLength = BoxSlotCount * BlankPKM.EncryptedBoxData.Length; int expectLength = BoxSlotCount * BlankPKM.EncryptedBoxData.Length;
return SetConcatenatedBinary(data, expectLength); return SetConcatenatedBinary(data, expectLength, start);
} }
private bool SetConcatenatedBinary(byte[] data, int expectLength) private bool SetConcatenatedBinary(byte[] data, int expectLength, int start = 0)
{ {
if (data.Length != expectLength) if (data.Length != expectLength)
return false; return false;
@ -922,7 +922,7 @@ namespace PKHeX.Core
var BD = BoxData; var BD = BoxData;
var entryLength = BlankPKM.EncryptedBoxData.Length; var entryLength = BlankPKM.EncryptedBoxData.Length;
var pkdata = ArrayUtil.EnumerateSplit(data, entryLength); var pkdata = ArrayUtil.EnumerateSplit(data, entryLength);
pkdata.Select(GetPKM).CopyTo(BD, IsSlotOverwriteProtected); pkdata.Select(GetPKM).CopyTo(BD, IsSlotOverwriteProtected, start);
BoxData = BD; BoxData = BD;
return true; return true;
} }