2019-09-23 23:56:47 +00:00
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
|
|
|
|
public sealed class BoxLayout8 : SaveBlock
|
|
|
|
|
{
|
2019-11-16 01:34:18 +00:00
|
|
|
|
public const int BoxCount = 32;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
2019-10-17 02:08:13 +00:00
|
|
|
|
private const int strlen = SAV6.LongStringLength / 2;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
2019-11-16 01:34:18 +00:00
|
|
|
|
public BoxLayout8(SAV8SWSH sav, SCBlock block) : base(sav, block.Data) { }
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
2019-11-16 01:34:18 +00:00
|
|
|
|
private int GetBoxNameOffset(int box) => SAV6.LongStringLength * box;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
|
|
|
|
public string GetBoxName(int box)
|
|
|
|
|
{
|
2019-10-17 02:08:13 +00:00
|
|
|
|
return SAV.GetString(Data, GetBoxNameOffset(box), SAV6.LongStringLength);
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetBoxName(int box, string value)
|
|
|
|
|
{
|
|
|
|
|
var data = SAV.SetString(value, strlen, strlen, 0);
|
2019-10-17 02:08:13 +00:00
|
|
|
|
var offset = GetBoxNameOffset(box) + (SAV6.LongStringLength * box);
|
2019-11-16 01:34:18 +00:00
|
|
|
|
SAV.SetData(Data, data, offset);
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string this[int i]
|
|
|
|
|
{
|
|
|
|
|
get => GetBoxName(i);
|
|
|
|
|
set => SetBoxName(i, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|