mirror of
https://github.com/kwsch/PKHeX
synced 2024-09-20 22:32:00 +00:00
Skip format check on pk* init
also remove ck3/xk3 no-op call (no encryption for those formats, like bk4).
This commit is contained in:
parent
27e917551f
commit
6cff642ff1
8 changed files with 9 additions and 15 deletions
|
@ -21,10 +21,7 @@ namespace PKHeX.Core
|
|||
public CK3(byte[] decryptedData = null, string ident = null)
|
||||
{
|
||||
Data = decryptedData ?? new byte[SIZE_PARTY];
|
||||
PKMConverter.CheckEncrypted(ref Data);
|
||||
Identifier = ident;
|
||||
if (Data.Length != SIZE_PARTY)
|
||||
Array.Resize(ref Data, SIZE_PARTY);
|
||||
}
|
||||
public CK3() => Data = new byte[SIZE_PARTY];
|
||||
public override PKM Clone() => new CK3((byte[])Data.Clone(), Identifier);
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace PKHeX.Core
|
|||
public PK3(byte[] decryptedData = null, string ident = null)
|
||||
{
|
||||
Data = decryptedData ?? new byte[SIZE_PARTY];
|
||||
PKMConverter.CheckEncrypted(ref Data);
|
||||
PKMConverter.CheckEncrypted(ref Data, Format);
|
||||
Identifier = ident;
|
||||
if (Data.Length != SIZE_PARTY)
|
||||
Array.Resize(ref Data, SIZE_PARTY);
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace PKHeX.Core
|
|||
public PK4(byte[] decryptedData = null, string ident = null)
|
||||
{
|
||||
Data = decryptedData ?? new byte[SIZE_PARTY];
|
||||
PKMConverter.CheckEncrypted(ref Data);
|
||||
PKMConverter.CheckEncrypted(ref Data, Format);
|
||||
Identifier = ident;
|
||||
if (Data.Length != SIZE_PARTY)
|
||||
Array.Resize(ref Data, SIZE_PARTY);
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace PKHeX.Core
|
|||
public PK5(byte[] decryptedData = null, string ident = null)
|
||||
{
|
||||
Data = decryptedData ?? new byte[SIZE_PARTY];
|
||||
PKMConverter.CheckEncrypted(ref Data);
|
||||
PKMConverter.CheckEncrypted(ref Data, Format);
|
||||
Identifier = ident;
|
||||
if (Data.Length != SIZE_PARTY)
|
||||
Array.Resize(ref Data, SIZE_PARTY);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace PKHeX.Core
|
|||
public PK6(byte[] decryptedData = null, string ident = null)
|
||||
{
|
||||
Data = decryptedData ?? new byte[SIZE_PARTY];
|
||||
PKMConverter.CheckEncrypted(ref Data);
|
||||
PKMConverter.CheckEncrypted(ref Data, Format);
|
||||
Identifier = ident;
|
||||
if (Data.Length != SIZE_PARTY)
|
||||
Array.Resize(ref Data, SIZE_PARTY);
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace PKHeX.Core
|
|||
public PK7(byte[] decryptedData = null, string ident = null)
|
||||
{
|
||||
Data = decryptedData ?? new byte[SIZE_PARTY];
|
||||
PKMConverter.CheckEncrypted(ref Data);
|
||||
PKMConverter.CheckEncrypted(ref Data, Format);
|
||||
Identifier = ident;
|
||||
if (Data.Length != SIZE_PARTY)
|
||||
Array.Resize(ref Data, SIZE_PARTY);
|
||||
|
|
|
@ -85,8 +85,8 @@ namespace PKHeX.Core
|
|||
/// <returns>An instance of <see cref="PKM"/> created from the given <paramref name="data"/>, or null if <paramref name="data"/> is invalid.</returns>
|
||||
public static PKM GetPKMfromBytes(byte[] data, string ident = null, int prefer = 7)
|
||||
{
|
||||
CheckEncrypted(ref data);
|
||||
switch (GetPKMDataFormat(data))
|
||||
int format = GetPKMDataFormat(data);
|
||||
switch (format)
|
||||
{
|
||||
case 1:
|
||||
var PL1 = new PokemonList1(data, PokemonList1.CapacityType.Single, data.Length == PKX.SIZE_1JLIST);
|
||||
|
@ -361,9 +361,9 @@ namespace PKHeX.Core
|
|||
/// </summary>
|
||||
/// <remarks>The input PKM object is decrypted; no new object is returned.</remarks>
|
||||
/// <param name="pkm">PKM to check encryption for (and decrypt if appropriate).</param>
|
||||
public static void CheckEncrypted(ref byte[] pkm)
|
||||
/// <param name="format">Format specific check selection</param>
|
||||
public static void CheckEncrypted(ref byte[] pkm, int format)
|
||||
{
|
||||
int format = GetPKMDataFormat(pkm);
|
||||
switch (format)
|
||||
{
|
||||
case 1:
|
||||
|
|
|
@ -19,10 +19,7 @@ namespace PKHeX.Core
|
|||
public XK3(byte[] decryptedData = null, string ident = null)
|
||||
{
|
||||
Data = decryptedData ?? new byte[SIZE_PARTY];
|
||||
PKMConverter.CheckEncrypted(ref Data);
|
||||
Identifier = ident;
|
||||
if (Data.Length != SIZE_PARTY)
|
||||
Array.Resize(ref Data, SIZE_PARTY);
|
||||
}
|
||||
public XK3() => Data = new byte[SIZE_PARTY];
|
||||
public override PKM Clone() => new XK3((byte[])Data.Clone(), Identifier) {Purification = Purification};
|
||||
|
|
Loading…
Reference in a new issue