Implement global settings for on-set methods

This makes it so that the program can turn off these methods for every
instance unless the implemented method explicitly says otherwise.

Nullable boolzzz
This commit is contained in:
Kurt
2015-10-23 19:58:23 -07:00
parent f348a27d0c
commit d5484d265b

View File

@@ -13,6 +13,9 @@ public class BlockInfo
}
public class SAV6 : PKX
{
// Global Settings
internal static bool SetUpdatePokedex = true;
internal static bool SetUpdatePK6 = true;
// Save Data Attributes
public byte[] Data;
public bool Exportable;
@@ -307,41 +310,47 @@ public PK6 getPK6Stored(int offset)
{
return new PK6(decryptArray(getData(offset, PK6.SIZE_STORED)));
}
public void setPK6Party(PK6 pk6, int offset, bool trade = true)
public void setPK6Party(PK6 pk6, int offset, bool? trade = null)
{
if (trade)
if (SetUpdatePK6 || (trade ?? false))
{
// Apply to this Save File
// pk6.Trade();
// pk6.Write();
}
setPokeDex(pk6);
if (SetUpdatePokedex)
setPokeDex(pk6);
byte[] ek6 = encryptArray(pk6.Data);
setData(ek6, offset);
}
public void setPK6Stored(PK6 pk6, int offset, bool trade = true)
public void setPK6Stored(PK6 pk6, int offset, bool? trade = null)
{
if (trade)
if (SetUpdatePK6 || (trade ?? false))
{
// Apply to this Save File
// pk6.Trade();
// pk6.Write();
}
setPokeDex(pk6);
if (SetUpdatePokedex)
setPokeDex(pk6);
byte[] ek6 = encryptArray(pk6.Data);
Array.Resize(ref ek6, PK6.SIZE_STORED);
setData(ek6, offset);
}
public void setEK6Stored(byte[] ek6, int offset, bool trade = true)
public void setEK6Stored(byte[] ek6, int offset, bool? trade = null)
{
PK6 pk6 = new PK6(decryptArray(ek6));
if (trade)
if (SetUpdatePK6 || (trade ?? false))
{
// Apply to this Save File
// pk6.Trade();
// pk6.Write();
}
setPokeDex(pk6);
if (SetUpdatePokedex)
setPokeDex(pk6);
Array.Resize(ref ek6, PK6.SIZE_STORED);
setData(ek6, offset);
}