namespace Crosstales.FB.Wrapper
{
/// Interface for all file browsers.
public interface IFileBrowser
{
#region Properties
/// Indicates if this wrapper can open a file.
/// Wrapper can open a file.
bool canOpenFile { get; }
/// Indicates if this wrapper can open a folder.
/// Wrapper can open a folder.
bool canOpenFolder { get; }
/// Indicates if this wrapper can save a file.
/// Wrapper can save a file.
bool canSaveFile { get; }
/// Indicates if this wrapper can open multiple files.
/// Wrapper can open multiple files.
bool canOpenMultipleFiles { get; }
/// Indicates if this wrapper can open multiple folders.
/// Wrapper can open multiple folders.
bool canOpenMultipleFolders { get; }
/// Indicates if this wrapper is supporting the current platform.
/// True if this wrapper supports current platform.
bool isPlatformSupported { get; }
/// Indicates if this wrapper is working directly inside the Unity Editor (without 'Play'-mode).
/// True if this wrapper is working directly inside the Unity Editor.
bool isWorkingInEditor { get; }
/// Returns the file from the last "OpenSingleFile"-action.
/// File from the last "OpenSingleFile"-action.
string CurrentOpenSingleFile { get; set; }
/// Returns the array of files from the last "OpenFiles"-action.
/// Array of files from the last "OpenFiles"-action.
string[] CurrentOpenFiles { get; set; }
/// Returns the folder from the last "OpenSingleFolder"-action.
/// Folder from the last "OpenSingleFolder"-action.
string CurrentOpenSingleFolder { get; set; }
/// Returns the array of folders from the last "OpenFolders"-action.
/// Array of folders from the last "OpenFolders"-action.
string[] CurrentOpenFolders { get; set; }
/// Returns the file from the last "SaveFile"-action.
/// File from the last "SaveFile"-action.
string CurrentSaveFile { get; set; }
/// Returns the data of the file from the last "OpenSingleFile"-action.
/// Data of the file from the last "OpenSingleFile"-action.
byte[] CurrentOpenSingleFileData { get; }
/// The data for the "SaveFile"-action.
byte[] CurrentSaveFileData { get; set; }
#endregion
#region Methods
/// Open native file browser for a single file.
/// Dialog title
/// Root directory
/// Default file name (currently only supported under Windows standalone)
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Returns a string of the chosen file. Null when cancelled
string OpenSingleFile(string title, string directory, string defaultName, params ExtensionFilter[] extensions);
/// Open native file browser for multiple files.
/// Dialog title
/// Root directory
/// Default file name (currently only supported under Windows standalone)
/// Allow multiple file selection
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Returns array of chosen files. Null when cancelled
string[] OpenFiles(string title, string directory, string defaultName, bool multiselect, params ExtensionFilter[] extensions);
/// Open native folder browser for a single folder.
/// Dialog title
/// Root directory
/// Returns a string of the chosen folder. Null when cancelled
string OpenSingleFolder(string title, string directory);
/// Open native folder browser for multiple folders.
/// Dialog title
/// Root directory
/// Allow multiple folder selection
/// Returns array of chosen folders. Null when cancelled
string[] OpenFolders(string title, string directory, bool multiselect);
/// Open native save file browser.
/// Dialog title
/// Root directory
/// Default file name
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Returns chosen file. Null when cancelled
string SaveFile(string title, string directory, string defaultName, params ExtensionFilter[] extensions);
/// Asynchronously opens native file browser for multiple files.
/// Dialog title
/// Root directory
/// Default file name (currently only supported under Windows standalone)
/// Allow multiple file selection
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Callback for the async operation.
/// Returns array of chosen files. Null when cancelled
void OpenFilesAsync(string title, string directory, string defaultName, bool multiselect, ExtensionFilter[] extensions, System.Action cb);
/// Asynchronously opens native folder browser for multiple folders.
/// Dialog title
/// Root directory
/// Allow multiple folder selection
/// Callback for the async operation.
/// Returns array of chosen folders. Null when cancelled
void OpenFoldersAsync(string title, string directory, bool multiselect, System.Action cb);
/// Asynchronously opens native save file browser.
/// Dialog title
/// Root directory
/// Default file name
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Callback for the async operation.
/// Returns chosen file. Null when cancelled
void SaveFileAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, System.Action cb);
//TODO add NEW methods
/*
/// Open native file browser for a single file and reads the data.
/// Dialog title
/// Root directory
/// Default file name (currently only supported under Windows standalone)
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Returns a string of the chosen file. Empty string when cancelled
string OpenAndReadSingleFile(string title, string directory, string defaultName, params ExtensionFilter[] extensions);
/// Open native file browser for multiple files and reads the data.
/// Dialog title
/// Root directory
/// Default file name (currently only supported under Windows standalone)
/// Allow multiple file selection
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Returns array of chosen files. Zero length array when cancelled
string[] OpenAndReadFiles(string title, string directory, string defaultName, bool multiselect, params ExtensionFilter[] extensions);
/// Open native save file browser and writes the data.
/// Dialog title
/// Root directory
/// Default file name
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Returns chosen file. Empty string when cancelled
string SaveAndWriteFile(string title, string directory, string defaultName, params ExtensionFilter[] extensions);
/// Asynchronously opens native file browser for multiple files and reads the data.
/// Dialog title
/// Root directory
/// Default file name (currently only supported under Windows standalone)
/// Allow multiple file selection
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Callback for the async operation.
/// Returns array of chosen files. Zero length array when cancelled
void OpenAndReadFilesAsync(string title, string directory, string defaultName, bool multiselect, ExtensionFilter[] extensions, System.Action cb);
/// Asynchronously opens native save file browser and writes the data.
/// Dialog title
/// Root directory
/// Default file name
/// List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")
/// Callback for the async operation.
/// Returns chosen file. Empty string when cancelled
void SaveAndWriteFileAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, System.Action cb);
*/
#endregion
}
}
// © 2018-2023 crosstales LLC (https://www.crosstales.com)