using System; namespace PKHeX.Core; #if !(EXCLUDE_EMULATOR_FORMATS && EXCLUDE_HACKS) /// /// Provides handling for recognizing atypical save file formats. /// public interface ISaveHandler { /// /// Checks if the requested file size is one that can be recognized by this handler. /// /// File size /// True if recognized, false if not recognized. bool IsRecognized(long size); /// /// Tries splitting up the into header/footer/data components. Returns null if not a valid save file for this handler. /// /// Combined data /// Null if not a valid save file for this handler's format. Returns an object containing header, footer, and inner data references. SaveHandlerSplitResult? TrySplit(ReadOnlySpan input); /// /// When exporting a save file, the handler might want to update the header/footer. /// /// Combined data void Finalize(Span input); } #endif #if !EXCLUDE_HACKS /// /// Provides handling for recognizing atypical save file formats. /// public interface ISaveReader : ISaveHandler { /// /// Reads a save file from the /// /// Raw input data /// Optional file path. /// Save File object, or null if invalid. Check if it is compatible first. SaveFile? ReadSaveFile(byte[] data, string? path = null); } #endif