using System; namespace HavenSoft.Gen3Hex.Model { public interface IFileSystem { string CopyText { get; set; } /// /// Have the filesystem ask the user for a new name for a file. /// If no extensionOptions are provided, the user may specify any extension. /// Otherwise, the returned name will end with one of the extensionOptions. /// /// /// The current name of the file, which may be either relative or absolute, including extension. /// This parameter may be empty, but not null. /// /// /// A set of extensions, such as 'txt', 'gba', or 'png'. Should not start with a dot. /// The set may be empty, but not null. /// /// /// The new name if provided, or null if the operation was canceled by the user. /// string RequestNewName(string currentName, params string[] extensionOptions); /// /// Have the filesystem ask the user for an existing file. /// If no extensionOptions are provided, the user may specify any existing file. /// /// /// A set of extensions, such as 'txt', 'gba', or 'png'. Should not start with a dot. /// The set may be empty, but not null. /// /// /// If the user chooses a file, that file is loaded and returned. /// If the user cancels or selects an unreadable file, returns null. /// LoadedFile OpenFile(params string[] extensionOptions); /// /// Have the filesystem open a specific file. /// /// /// If the file exists, it is loaded and returned. /// If it doesn't exist, returns null. /// LoadedFile LoadFile(string fileName); /// /// When a file changes, the filesystem will call all listeners for that file. /// void AddListenerToFile(string fileName, Action listener); void RemoveAllListenersForFile(string fileName); /// /// Saves the file without prompting the user for permission. /// /// /// true if it was possible to save, false if there was an error. /// In the case of false, the file system would have already dealt with the error. /// The return value is just so the program can know if it was written or not. /// bool Save(LoadedFile file); /// /// should prompt the user if they want to save and then save /// /// /// true if the user wanted to save the file and it was written successfully /// false if the user decided not to save the file /// null if there was any error or if the operation was canceled by the user. /// the FileSystem object will handle the error and potentially notify the user, /// the result is only so the program can know if it was written or not. /// bool? TrySavePrompt(LoadedFile file); } }