Fix gamesync ID

Not to be confused with NexUniqueID
This commit is contained in:
Kurt 2016-12-12 22:29:50 -08:00
parent 42da2707ba
commit 637c971725

View file

@ -316,12 +316,12 @@ namespace PKHeX
get { return Data[TrainerCard + 5]; } get { return Data[TrainerCard + 5]; }
set { Data[TrainerCard + 5] = (byte)value; } set { Data[TrainerCard + 5] = (byte)value; }
} }
public override int GameSyncIDSize => 32; // 128 bits public override int GameSyncIDSize => 16; // 64 bits
public override string GameSyncID public override string GameSyncID
{ {
get get
{ {
var data = Data.Skip(TrainerCard + 0x18).Take(GameSyncIDSize/2).Reverse().ToArray(); var data = Data.Skip(TrainerCard + 0x10).Take(GameSyncIDSize/2).Reverse().ToArray();
return BitConverter.ToString(data).Replace("-", ""); return BitConverter.ToString(data).Replace("-", "");
} }
set set
@ -331,6 +331,28 @@ namespace PKHeX
if (value.Length > GameSyncIDSize) if (value.Length > GameSyncIDSize)
return; return;
Enumerable.Range(0, value.Length)
.Where(x => x % 2 == 0)
.Reverse()
.Select(x => Convert.ToByte(value.Substring(x, 2), 16))
.ToArray().CopyTo(Data, TrainerCard + 0x10);
}
}
public int NexUniqueIDSize => 32; // 128 bits
public string NexUniqueID
{
get
{
var data = Data.Skip(TrainerCard + 0x18).Take(NexUniqueIDSize/2).Reverse().ToArray();
return BitConverter.ToString(data).Replace("-", "");
}
set
{
if (value == null)
return;
if (value.Length > NexUniqueIDSize)
return;
Enumerable.Range(0, value.Length) Enumerable.Range(0, value.Length)
.Where(x => x % 2 == 0) .Where(x => x % 2 == 0)
.Reverse() .Reverse()