using System; namespace NHSE.Core; /// /// Abstraction for reading and writing save files from different storage backends (folder, ZIP archive, etc.). /// public interface ISaveFileProvider { /// /// Reads all bytes from the specified file path relative to the root. /// /// Relative path to the file (e.g., "main.dat" or "Villager0/personal.dat"). /// Byte array containing the file contents. byte[] ReadFile(string relativePath); /// /// Writes all bytes to the specified file path relative to the root. /// /// Relative path to the file. /// Byte data to write. void WriteFile(string relativePath, ReadOnlySpan data); /// /// Checks if a file exists at the specified relative path. /// /// Relative path to the file. /// True if the file exists; otherwise false. bool FileExists(string relativePath); /// /// Gets all subdirectory names matching the specified pattern relative to the root. /// /// Search pattern (e.g., "Villager*"). /// Array of matching directory names (not full paths). string[] GetDirectories(string searchPattern); /// /// Creates a child provider scoped to the specified subdirectory. /// /// Subdirectory name to scope to. /// A new provider rooted at the subdirectory. ISaveFileProvider GetSubdirectoryProvider(string subdirectory); /// /// Flushes any pending writes to the underlying storage. /// For folder providers, this may be a no-op. For ZIP providers, this rebuilds and saves the archive. /// void Flush(); }