2022-01-03 05:35:59 +00:00
|
|
|
using System;
|
|
|
|
|
2018-07-08 04:31:41 +00:00
|
|
|
namespace PKHeX.Core
|
|
|
|
{
|
2019-10-04 02:09:02 +00:00
|
|
|
public sealed class PokeBlock3Case
|
2018-07-08 04:31:41 +00:00
|
|
|
{
|
|
|
|
private const int Count = 40;
|
|
|
|
public readonly PokeBlock3[] Blocks;
|
|
|
|
|
2022-01-03 05:35:59 +00:00
|
|
|
public PokeBlock3Case(ReadOnlySpan<byte> data, int offset)
|
2018-07-08 04:31:41 +00:00
|
|
|
{
|
|
|
|
Blocks = new PokeBlock3[Count];
|
|
|
|
for (int i = 0; i < Blocks.Length; i++)
|
|
|
|
Blocks[i] = PokeBlock3.GetBlock(data, offset + (i * PokeBlock3.SIZE));
|
|
|
|
}
|
|
|
|
|
|
|
|
public byte[] Write()
|
|
|
|
{
|
|
|
|
byte[] result = new byte[Count*PokeBlock3.SIZE];
|
|
|
|
for (int i = 0; i < Blocks.Length; i++)
|
|
|
|
Blocks[i].SetBlock(result, i * PokeBlock3.SIZE);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DeleteAll()
|
|
|
|
{
|
|
|
|
foreach (var b in Blocks)
|
|
|
|
b.Delete();
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
2018-07-08 04:31:41 +00:00
|
|
|
public void MaximizeAll(bool createMissing = false)
|
|
|
|
{
|
|
|
|
foreach (var b in Blocks)
|
|
|
|
b.Maximize(createMissing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|