/// <summary> /// Native open file dialog /// </summary> /// <param name="title">Dialog title</param> /// <param name="directory">Root directory</param> /// <param name="extension">Allowed extension</param> /// <param name="multiselect">Allow multiple file selection</param> /// <returns>Returns array of chosen paths. Zero length array when cancelled</returns> public static string[] OpenFilePanel(string title, string directory, string extension, bool multiselect) { #if !UNITY_STANDALONE_WIN return(new string[] { tinyfd.TinyFileDialogs.OpenFileDialog(title, directory, new string[] { "*." + extension }, null, multiselect) }); #else #endif return(_platformWrapper.OpenFilePanel(title, directory, new ExtensionFilter[] { new ExtensionFilter(null, new string[] { extension }) }, multiselect)); /*var extensions = string.IsNullOrEmpty(extension) ? null : new [] { new ExtensionFilter("", extension) }; * return OpenFilePanel(title, directory, extensions, multiselect);*/ }
/// <summary> /// Native open file dialog /// </summary> /// <param name="title">Dialog title</param> /// <param name="directory">Root directory</param> /// <param name="extensions">List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png").</param> /// <param name="multiselect">Allow selection of multiple files.</param> /// <returns>Returns array of chosen paths or zero length array when cancelled.</returns> public static string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) { if (m_PlatformWrapper == null) { Initalize(); } return(m_PlatformWrapper.OpenFilePanel(title, directory, extensions, multiselect)); }
/// <summary> /// Native open file dialog /// </summary> /// <param name="title">Dialog title</param> /// <param name="directory">Root directory</param> /// <param name="extensions">List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")</param> /// <param name="multiselect">Allow multiple file selection</param> /// <returns>Returns array of chosen paths. Zero length array when cancelled</returns> public static string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) { return(_platformWrapper.OpenFilePanel(title, directory, extensions, multiselect)); }
/// <summary> /// Native open file dialog /// </summary> /// <param name="title">Dialog title</param> /// <param name="directory">Root directory</param> /// <param name="extensions">List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")</param> /// <param name="multiSelect">Allow multiple file selection</param> /// <returns>Returns array of chosen paths. Zero length array when cancelled</returns> public static string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiSelect) => PlatformWrapper.OpenFilePanel(title, directory, extensions, multiSelect);
/// <summary> /// Native open file dialog /// </summary> /// <param name="_title">Dialog title</param> /// <param name="_directory">Root directory</param> /// <param name="_extensions">List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")</param> /// <param name="_isMultiselect">Allow multiple file selection</param> /// <returns>Returns array of chosen paths. Zero length array when cancelled</returns> public static string[] OpenFilePanel(string _title, string _directory, ExtensionFilter[] _extensions, bool _isMultiselect) { return(_platformWrapper.OpenFilePanel(_title, _directory, _extensions, _isMultiselect)); }
/// <summary> /// Native open file dialog /// </summary> /// <param name="title">Dialog title</param> /// <param name="directory">Root directory</param> /// <param name="extensions">List of extension filters. Filter Example: new ExtensionFilter("Image Files", "jpg", "png")</param> /// <param name="multiselect">Allow multiple file selection</param> /// <returns>Returns array of chosen items. Zero length array when cancelled</returns> public static IEnumerable <IItemWithStream> OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect) { return(_platformWrapper.OpenFilePanel(title, directory, extensions, multiselect)); }