PKHeX/PKHeX.Core/Saves/Substructures/Gen8/BoxLayout8.cs

31 lines
870 B
C#
Raw Normal View History

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