2022-06-18 18:04:24 +00:00
namespace PKHeX.Core ;
2021-02-13 09:53:38 +00:00
#if ! ( EXCLUDE_EMULATOR_FORMATS & & EXCLUDE_HACKS )
2022-06-18 18:04:24 +00:00
/// <summary>
/// Provides handling for recognizing atypical save file formats.
/// </summary>
public interface ISaveHandler
{
2021-01-06 23:46:43 +00:00
/// <summary>
2022-06-18 18:04:24 +00:00
/// Checks if the requested file size is one that can be recognized by this handler.
2021-01-06 23:46:43 +00:00
/// </summary>
2022-06-18 18:04:24 +00:00
/// <param name="size">File size</param>
/// <returns>True if recognized, false if not recognized.</returns>
bool IsRecognized ( int size ) ;
2021-01-06 23:46:43 +00:00
2022-06-18 18:04:24 +00:00
/// <summary>
/// Tries splitting up the <see cref="input"/> into header/footer/data components. Returns null if not a valid save file for this handler.
/// </summary>
/// <param name="input">Combined data</param>
/// <returns>Null if not a valid save file for this handler's format. Returns an object containing header, footer, and inner data references.</returns>
SaveHandlerSplitResult ? TrySplit ( byte [ ] input ) ;
}
2021-02-13 09:53:38 +00:00
#endif
#if ! EXCLUDE_HACKS
2022-06-18 18:04:24 +00:00
/// <summary>
/// Provides handling for recognizing atypical save file formats.
/// </summary>
public interface ISaveReader : ISaveHandler
{
2021-02-13 09:53:38 +00:00
/// <summary>
2022-06-18 18:04:24 +00:00
/// Reads a save file from the <see cref="data"/>
2021-02-13 09:53:38 +00:00
/// </summary>
2022-06-18 18:04:24 +00:00
/// <param name="data">Raw input data</param>
/// <param name="path">Optional file path.</param>
/// <returns>Save File object, or null if invalid. Check <see cref="ISaveHandler"/> if it is compatible first.</returns>
SaveFile ? ReadSaveFile ( byte [ ] data , string? path = null ) ;
2021-01-06 23:46:43 +00:00
}
2022-06-18 18:04:24 +00:00
#endif