2022-01-03 05:35:59 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
2019-09-23 23:56:47 +00:00
|
|
|
|
{
|
2020-09-09 19:47:24 +00:00
|
|
|
|
public sealed class BoxLayout8 : SaveBlock, IBoxDetailName
|
2019-09-23 23:56:47 +00:00
|
|
|
|
{
|
2019-11-16 01:34:18 +00:00
|
|
|
|
public const int BoxCount = 32;
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
2021-05-29 22:31:47 +00:00
|
|
|
|
private const int StringMaxLength = 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
|
|
|
|
|
2020-01-21 06:04:52 +00:00
|
|
|
|
private static int GetBoxNameOffset(int box) => SAV6.LongStringLength * box;
|
2022-01-03 05:35:59 +00:00
|
|
|
|
private Span<byte> GetBoxNameSpan(int box) => Data.AsSpan(GetBoxNameOffset(box), SAV6.LongStringLength);
|
|
|
|
|
public string GetBoxName(int box) => SAV.GetString(GetBoxNameSpan(box));
|
|
|
|
|
public void SetBoxName(int box, string value) => SAV.SetString(GetBoxNameSpan(box), value.AsSpan(), StringMaxLength, StringConverterOption.ClearZero);
|
2019-09-23 23:56:47 +00:00
|
|
|
|
|
|
|
|
|
public string this[int i]
|
|
|
|
|
{
|
|
|
|
|
get => GetBoxName(i);
|
|
|
|
|
set => SetBoxName(i, value);
|
|
|
|
|
}
|
2020-03-11 06:18:51 +00:00
|
|
|
|
|
|
|
|
|
public int CurrentBox
|
|
|
|
|
{
|
2020-03-11 23:31:53 +00:00
|
|
|
|
get => ((SAV8SWSH)SAV).GetValue<byte>(SaveBlockAccessor8SWSH.KCurrentBox);
|
2020-03-11 06:18:51 +00:00
|
|
|
|
set => ((SAV8SWSH)SAV).SetValue(SaveBlockAccessor8SWSH.KCurrentBox, (byte)value);
|
|
|
|
|
}
|
2019-09-23 23:56:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|