Add Full Size WC6 importing

This commit is contained in:
Kaphotics 2016-03-13 10:54:33 -07:00
parent ce87cf675f
commit 2e0a06034c
3 changed files with 10 additions and 2 deletions

View file

@ -7,6 +7,7 @@ namespace PKHeX
public class WC6
{
internal const int Size = 0x108;
internal const int SizeFull = 0x310;
public byte[] Data;
public WC6(byte[] data = null)

View file

@ -631,7 +631,10 @@ namespace PKHeX
}
#endregion
#region Wondercard
else if (input.Length == WC6.Size && ext == ".wc6")
else if ((input.Length == WC6.Size && ext == ".wc6") || (input.Length == WC6.SizeFull && ext == ".wcfull6"))
{
if (input.Length == WC6.SizeFull) // Take bytes at end = WC6 size.
input = input.Skip(WC6.SizeFull - WC6.Size).ToArray();
if (ModifierKeys == Keys.Control)
new SAV_Wondercard(input).Show();
else
@ -645,6 +648,7 @@ namespace PKHeX
}
populateFields(pk);
}
}
else if (input.Length == PGF.Size && ext == ".pgf")
{
PK5 pk = new PGF(input).convertToPK5(SAV);

View file

@ -122,12 +122,15 @@ namespace PKHeX
if (importwc6.ShowDialog() != DialogResult.OK) return;
string path = importwc6.FileName;
if (new FileInfo(path).Length != WC6.Size)
long len = new FileInfo(path).Length;
if (len != WC6.Size || len != WC6.SizeFull)
{
Util.Error("File is not a Wonder Card:", path);
return;
}
byte[] newwc6 = File.ReadAllBytes(path);
if (newwc6.Length == WC6.SizeFull)
newwc6 = newwc6.Skip(WC6.SizeFull - WC6.Size).ToArray();
Array.Copy(newwc6, wondercard_data, newwc6.Length);
loadwcdata();
}