예제 #1
0
        public string[] OpenFilePanel(BrowserParameters args)
        {
            var fd = new VistaOpenFileDialog();

            fd.Title = args.Title;
            if (args.Extensions != null)
            {
                fd.Filter      = GetFilterFromFileExtensionList(args.Extensions);
                fd.FilterIndex = (args.FilterIndex > 0) ? args.FilterIndex : 1;
            }
            else
            {
                fd.Filter = string.Empty;
            }
            fd.Multiselect = args.Multiselect;
            if (!string.IsNullOrEmpty(args.Directory))
            {
                fd.FileName = GetDirectoryPath(args.Directory);
            }
            var res       = fd.ShowDialog(new WindowWrapper(GetActiveWindow()));
            var filenames = res == DialogResult.OK ? fd.FileNames : new string[0];

            fd.Dispose();
            return(filenames);
        }
        public string SaveFilePanel(BrowserParameters args)
        {
            var ext  = args.Extensions != null ? args.Extensions[0].Extensions[0] : "";
            var name = string.IsNullOrEmpty(ext) ? args.DefaultName : args.DefaultName + "." + ext;

            return(EditorUtility.SaveFilePanel(args.Title, args.Directory, name, ext));
        }
 public string SaveFilePanel(BrowserParameters args)
 {
     return(Marshal.PtrToStringAnsi(DialogSaveFilePanel(
                                        args.Title,
                                        args.Directory,
                                        args.DefaultName,
                                        GetFilterFromFileExtensionList(args.Extensions))));
 }
        public string[] OpenFolderPanel(BrowserParameters args)
        {
            var paths = Marshal.PtrToStringAnsi(DialogOpenFolderPanel(
                                                    args.Title,
                                                    args.Directory,
                                                    args.Multiselect));

            return(paths.Split((char)28));
        }
 public void OpenFolderPanelAsync(BrowserParameters args, Action <string[]> cb)
 {
     _openFolderCb = cb;
     DialogOpenFolderPanelAsync(
         args.Title,
         args.Directory,
         args.Multiselect,
         (string result) => { _openFolderCb.Invoke(result.Split((char)28)); });
 }
 public void OpenFilePanelAsync(BrowserParameters args, Action <string[]> cb)
 {
     _openFileCb = cb;
     DialogOpenFilePanelAsync(
         args.Title,
         args.Directory,
         GetFilterFromFileExtensionList(args.Extensions),
         args.Multiselect,
         (string result) => { _openFileCb.Invoke(result.Split((char)28)); });
 }
        public string[] OpenFilePanel(BrowserParameters args)
        {
            var paths = Marshal.PtrToStringAnsi(DialogOpenFilePanel(
                                                    args.Title,
                                                    args.Directory,
                                                    GetFilterFromFileExtensionList(args.Extensions),
                                                    args.Multiselect));

            return(paths.Split((char)28));
        }
 public void SaveFilePanelAsync(BrowserParameters args, Action <string> cb)
 {
     _saveFileCb = cb;
     DialogSaveFilePanelAsync(
         args.Title,
         args.Directory,
         args.DefaultName,
         GetFilterFromFileExtensionList(args.Extensions),
         (string result) => { _saveFileCb.Invoke(result); });
 }
        public string[] OpenFilePanel(BrowserParameters args)
        {
            string path = "";

            if (args.Extensions == null)
            {
                path = EditorUtility.OpenFilePanel(args.Title, args.Directory, "");
            }
            else
            {
                path = EditorUtility.OpenFilePanelWithFilters(args.Title, args.Directory, GetFilterFromFileExtensionList(args.Extensions));
            }

            return(string.IsNullOrEmpty(path) ? new string[0] : new[] { path });
        }
예제 #10
0
        public string[] OpenFolderPanel(BrowserParameters args)
        {
            var fd = new VistaFolderBrowserDialog();

            fd.Description = args.Title;
            if (!string.IsNullOrEmpty(args.Directory))
            {
                fd.SelectedPath = GetDirectoryPath(args.Directory);
            }
            var res       = fd.ShowDialog(new WindowWrapper(GetActiveWindow()));
            var filenames = res == DialogResult.OK ? new [] { fd.SelectedPath } : new string[0];

            fd.Dispose();
            return(filenames);
        }
예제 #11
0
        public string SaveFilePanel(BrowserParameters args)
        {
            var fd = new VistaSaveFileDialog();

            fd.Title = args.Title;

            var finalFilename = "";

            if (!string.IsNullOrEmpty(args.Directory))
            {
                finalFilename = GetDirectoryPath(args.Directory);
            }

            if (!string.IsNullOrEmpty(args.DefaultName))
            {
                finalFilename += args.DefaultName;
            }

            fd.FileName = finalFilename;
            if (args.Extensions != null)
            {
                fd.Filter      = GetFilterFromFileExtensionList(args.Extensions);
                fd.FilterIndex = (args.FilterIndex > 0) ? args.FilterIndex : 1;
                if (!string.IsNullOrEmpty(args.DefaultExt))
                {
                    fd.DefaultExt = args.DefaultExt;
                }
                else
                {
                    fd.DefaultExt = args.Extensions[0].Extensions[0];
                }
                fd.AddExtension = args.AddExtension;
            }
            else
            {
                fd.DefaultExt   = string.Empty;
                fd.Filter       = string.Empty;
                fd.AddExtension = false;
            }
            var res      = fd.ShowDialog(new WindowWrapper(GetActiveWindow()));
            var filename = res == DialogResult.OK ? fd.FileName : "";

            fd.Dispose();
            return(filename);
        }
 public void OpenFolderPanelAsync(BrowserParameters args, Action <string[]> cb)
 {
     cb.Invoke(OpenFolderPanel(args.Title, args.Directory, args.Multiselect));
 }
예제 #13
0
 public void OpenFilePanelAsync(BrowserParameters args, Action <string[]> cb)
 {
     cb.Invoke(OpenFilePanel(args));
 }
        public string[] OpenFolderPanel(BrowserParameters args)
        {
            var path = EditorUtility.OpenFolderPanel(args.Title, args.Directory, "");

            return(string.IsNullOrEmpty(path) ? new string[0] : new[] { path });
        }
예제 #15
0
 public void SaveFilePanelAsync(BrowserParameters args, Action <string> cb)
 {
     cb.Invoke(SaveFilePanel(args));
 }
예제 #16
0
 /// <summary>
 /// Native open file dialog async
 /// </summary>
 /// <param name="args">Dialog control arguments</param>
 /// <returns>Returns array of chosen paths. Zero length array when cancelled</returns>
 public static string[] OpenFilePanel(BrowserParameters args)
 {
     return(_platformWrapper.OpenFilePanel(args));
 }
예제 #17
0
 /// <summary>
 /// Native save file dialog async
 /// </summary>
 /// <param name="args">Dialog control arguments</param>
 /// <param name="cb">Callback</param>
 public static void SaveFilePanelAsync(BrowserParameters args, Action <string> cb)
 {
     _platformWrapper.SaveFilePanelAsync(args, cb);
 }