// Warning: paths returned by FileBrowser dialogs do not contain a trailing '\' character
    // Warning: FileBrowser can only show 1 dialog at a time

    public void OpenDialog()
    {
        // Set filters (optional)
        // It is sufficient to set the filters just once (instead of each time before showing the file browser dialog),
        // if all the dialogs will be using the same filters
        FileBrowser.SetFilters(true, new FileBrowser.Filter("RFP File", ".rfp"));

        // Set default filter that is selected when the dialog is shown (optional)
        // Returns true if the default filter is set successfully
        // In this case, set Images filter as the default filter
        FileBrowser.SetDefaultFilter(".rfp");

        // Set excluded file extensions (optional) (by default, .lnk and .tmp extensions are excluded)
        // Note that when you use this function, .lnk and .tmp extensions will no longer be
        // excluded unless you explicitly add them as parameters to the function
        FileBrowser.SetExcludedExtensions(".lnk", ".tmp", ".zip", ".rar", ".exe");

        // Add a new quick link to the browser (optional) (returns true if quick link is added successfully)
        // It is sufficient to add a quick link just once
        // Name: Users
        // Path: C:\Users
        // Icon: default (folder icon)
        FileBrowser.AddQuickLink("Users", "C:\\Users", null);

        // Show a save file dialog
        // onSuccess event: not registered (which means this dialog is pretty useless)
        // onCancel event: not registered
        // Save file/folder: file, Allow multiple selection: false
        // Initial path: "C:\", Initial filename: "Screenshot.png"
        // Title: "Save As", Submit button text: "Save"
        // FileBrowser.ShowSaveDialog( null, null, FileBrowser.PickMode.Files, false, "C:\\", "Screenshot.png", "Save As", "Save" );

        // Show a select folder dialog
        // onSuccess event: print the selected folder's path
        // onCancel event: print "Canceled"
        // Load file/folder: folder, Allow multiple selection: false
        // Initial path: default (Documents), Initial filename: empty
        // Title: "Select Folder", Submit button text: "Select"
        string initialPath = null;
        string initialFile = null;

        if (FileBrowserHelpers.FileExists(fileInput.text))
        {
            initialPath = FileBrowserHelpers.GetDirectoryName(fileInput.text);
            initialFile = FileBrowserHelpers.GetFilename(fileInput.text);
        }
        if (FileBrowserHelpers.DirectoryExists(fileInput.text))
        {
            initialPath = fileInput.text;
        }
        FileBrowser.ShowLoadDialog((paths) => { Debug.Log("Selected: " + paths[0]); fileInput.text = paths[0]; },
                                   () => { Debug.Log("Canceled file open"); },
                                   FileBrowser.PickMode.Files, false, initialPath, initialFile);

        // Coroutine example
        //StartCoroutine(ShowLoadDialogCoroutine());
    }
Ejemplo n.º 2
0
 public void ExportClicked()
 {
     SimpleFileBrowser.FileBrowser.ShowLoadDialog((paths) =>
     {
         string sourcePath           = Path.Combine(Application.persistentDataPath, "StorageDatabase.FILE");
         string destinationDirectory = FileBrowserHelpers.GetDirectoryName(FileBrowser.Result[FileBrowser.Result.Length - 1]);
         string destinationPath      = Path.Combine(destinationDirectory, "StorageDatabase.FILE");
         FileBrowserHelpers.CopyFile(sourcePath, destinationPath);
     }, null, SimpleFileBrowser.FileBrowser.PickMode.Folders);
 }
Ejemplo n.º 3
0
    IEnumerator ShowEnvLoadDialogCoroutine()
    {
        yield return(FileBrowser.WaitForLoadDialog(FileBrowser.PickMode.FilesAndFolders, false, Application.dataPath + "/MatsJson/", null, "Load environment", "Load"));

        if (FileBrowser.Success)
        {
            string destinationPath = FileBrowser.Result[0];
            DeserializeField(FileBrowserHelpers.GetDirectoryName(FileBrowser.Result[0]), FileBrowserHelpers.GetFilename(FileBrowser.Result[0]));
        }
    }
Ejemplo n.º 4
0
    IEnumerator _MobileFileBrowserSetHome()
    {
        yield return(SimpleFileBrowser.FileBrowser.WaitForLoadDialog(FileBrowser.PickMode.Folders, true, getPalettePathFolder(), null, "Set Home Path Folder", "Load"));

        androidSaveLoadBackground.SetActive(false);
        if (SimpleFileBrowser.FileBrowser.Success)
        {
            //Because F%^$ing Android refuses to keep file IO simple, with their F!@# stupid SAF system
            string realpath = FileBrowserHelpers.GetDirectoryName(SimpleFileBrowser.FileBrowser.Result[0] + SLASH + "idontexist.csv");
            setHomePath(realpath);
        }
    }
Ejemplo n.º 5
0
    IEnumerator MobileFileBrowserLoadCoroutinePalette(PEERbotPalette palette)
    {
        SimpleFileBrowser.FileBrowser.SetDefaultFilter(".csv");
        yield return(SimpleFileBrowser.FileBrowser.WaitForLoadDialog(FileBrowser.PickMode.Files, false, getPalettePathFolder(), null, "Load CSV Palette File", "Load"));

        androidSaveLoadBackground.SetActive(false);
        if (FileBrowser.Success)  //Try to load if successful
        //Because F%^$ing Android refuses to keep file IO simple, with their F!@# stupid SAF system
        {
            string filepath = FileBrowserHelpers.GetDirectoryName(FileBrowser.Result[0]);
            string filename = FileBrowserHelpers.GetFilename(FileBrowser.Result[0]);
            string realpath = Path.Combine(filepath, filename);
            Debug.Log("Realpath: " + realpath);
            LoadCSVPalette(palette, realpath);
        }
        else
        {
            pc.deletePalette(palette);
        }
    }