PKHeX/PKHeX.Core/Saves/Substructures/Gen7/SaveBlock.cs

39 lines
821 B
C#
Raw Normal View History

using System.ComponentModel;
2022-04-09 18:12:57 -07:00
namespace PKHeX.Core;
/// <summary>
/// Base class for a savegame data reader.
/// </summary>
public abstract class SaveBlock
{
2022-04-09 18:12:57 -07:00
[Browsable(false)]
public int Offset { get; protected init; }
public readonly byte[] Data;
protected readonly SaveFile SAV;
protected SaveBlock(SaveFile sav) => Data = (SAV = sav).Data;
protected SaveBlock(SaveFile sav, byte[] data)
{
2022-04-09 18:12:57 -07:00
SAV = sav;
Data = data;
}
}
2022-04-09 18:12:57 -07:00
public abstract class SaveBlock<T> where T : SaveFile
{
[Browsable(false)]
public int Offset { get; protected init; }
public readonly byte[] Data;
protected readonly T SAV;
protected SaveBlock(T sav) => Data = (SAV = sav).Data;
2019-11-15 17:34:18 -08:00
2022-04-09 18:12:57 -07:00
protected SaveBlock(T sav, byte[] data)
{
SAV = sav;
Data = data;
}
2022-04-09 18:12:57 -07:00
}