2020-01-24 05:30:39 +00:00
|
|
|
using System.ComponentModel;
|
|
|
|
|
2022-04-10 01:12:57 +00:00
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Base class for a savegame data reader.
|
|
|
|
/// </summary>
|
2022-04-15 18:45:04 +00:00
|
|
|
public abstract class SaveBlock<T> : IDataIndirect where T : SaveFile
|
2018-11-01 22:38:09 +00:00
|
|
|
{
|
2022-04-15 18:45:04 +00:00
|
|
|
protected readonly T SAV;
|
|
|
|
|
|
|
|
[Browsable(false)] public byte[] Data { get; }
|
|
|
|
[Browsable(false)] public int Offset { get; protected init; }
|
2022-04-10 01:12:57 +00:00
|
|
|
|
2022-04-15 18:45:04 +00:00
|
|
|
protected SaveBlock(T sav) : this(sav, sav.Data) { }
|
2022-04-10 01:12:57 +00:00
|
|
|
|
2022-04-15 18:45:04 +00:00
|
|
|
protected SaveBlock(T sav, byte[] data)
|
2018-11-01 22:38:09 +00:00
|
|
|
{
|
2022-04-10 01:12:57 +00:00
|
|
|
SAV = sav;
|
|
|
|
Data = data;
|
|
|
|
}
|
|
|
|
}
|
2020-01-24 05:30:39 +00:00
|
|
|
|
2022-04-15 18:45:04 +00:00
|
|
|
public interface IDataIndirect
|
2022-04-10 01:12:57 +00:00
|
|
|
{
|
2022-04-15 18:45:04 +00:00
|
|
|
int Offset { get; }
|
|
|
|
byte[] Data { get; }
|
2022-04-10 01:12:57 +00:00
|
|
|
}
|