mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 14:30:56 +00:00
Fix gamesync ID
Not to be confused with NexUniqueID
This commit is contained in:
parent
42da2707ba
commit
637c971725
1 changed files with 24 additions and 2 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue