Added abstract GtsRecordBase.Validate(is_exchanged)

This commit is contained in:
Greg Edwards
2018-11-06 03:01:22 -05:00
parent 1a95dacbd0
commit b0eee74334
5 changed files with 9 additions and 7 deletions

View File

@@ -226,7 +226,7 @@ namespace PkmnFoundations.GTS
byte[] recordBinary = new byte[292];
Array.Copy(data, 0, recordBinary, 0, 292);
GtsRecord4 record = new GtsRecord4(pokedex, recordBinary);
if (!record.Validate())
if (!record.Validate(false))
{
// hack check failed
SessionManager.Remove(session);
@@ -357,7 +357,7 @@ namespace PkmnFoundations.GTS
}
// enforce request requirements server side
if (!upload.Validate() || !upload.CanTrade(result))
if (!upload.Validate(true) || !upload.CanTrade(result))
{
// todo: find the correct codes for these
SessionManager.Remove(session);

View File

@@ -222,7 +222,7 @@ namespace PkmnFoundations.GTS
// appears to be 4 bytes of 00, 128 bytes of stuff, 4 bytes of 80 00 00 00
// probably a pkvldtprod signature
if (!record.Validate())
if (!record.Validate(false))
{
// hack check failed
// todo: test that 0c 00 is the correct code for GenV
@@ -356,7 +356,7 @@ namespace PkmnFoundations.GTS
}
// enforce request requirements server side
if (!upload.Validate() || !upload.CanTrade(result))
if (!upload.Validate(true) || !upload.CanTrade(result))
{
// todo: find the correct codes for these
SessionManager.Remove(session);

View File

@@ -191,7 +191,7 @@ namespace PkmnFoundations.Structures
return new GtsRecord4(m_pokedex, Save());
}
public bool Validate()
public override bool Validate(bool is_exchanged)
{
// todo: a. legitimacy check, and b. check that pkm data matches metadata
return true;

View File

@@ -198,7 +198,7 @@ namespace PkmnFoundations.Structures
return new GtsRecord5(m_pokedex, Save());
}
public bool Validate()
public override bool Validate(bool is_exchanged)
{
// todo: a. legitimacy check, and b. check that pkm data matches metadata
return true;

View File

@@ -69,7 +69,7 @@ namespace PkmnFoundations.Structures
public byte TrainerRegion;
public byte TrainerClass;
public abstract String TrainerName
public abstract string TrainerName
{
get;
set;
@@ -80,6 +80,8 @@ namespace PkmnFoundations.Structures
public byte TrainerVersion;
public byte TrainerLanguage;
public abstract bool Validate(bool is_exchanged);
public static bool CheckLevels(byte min, byte max, byte other)
{
if (max == 0) max = 255;