예제 #1
0
        private static void OpenDialog(string defaultPath, string filter, bool textEntry, uFileBrowser.FileBrowserCallback callback)
        {
            if (!FileManagerSecure.DirectoryExists(defaultPath))
            {
                FileManagerSecure.CreateDirectory(defaultPath);
            }

            Controller.mediaFileBrowserUI.fileRemovePrefix            = null;
            Controller.mediaFileBrowserUI.hideExtension               = false;
            Controller.mediaFileBrowserUI.keepOpen                    = false;
            Controller.mediaFileBrowserUI.showDirs                    = true;
            Controller.mediaFileBrowserUI.shortCuts                   = null;
            Controller.mediaFileBrowserUI.browseVarFilesAsDirectories = true;

            Controller.mediaFileBrowserUI.fileFormat  = filter;
            Controller.mediaFileBrowserUI.defaultPath = defaultPath;
            Controller.mediaFileBrowserUI.SetTextEntry(textEntry);
            Controller.mediaFileBrowserUI.Show(callback);
        }
예제 #2
0
        public static void SaveConfig(string path, IConfigProvider provider)
        {
            if (!CheckPath(ref path))
            {
                return;
            }

            var directory = FileManagerSecure.GetDirectoryName(path);

            if (!FileManagerSecure.DirectoryExists(directory))
            {
                FileManagerSecure.CreateDirectory(directory);
            }

            var config = new JSONClass();

            provider.StoreConfig(config);
            Controller.SaveJSON(config, path, () => SuperController.LogMessage($"Saved config! \"{path}\""), null, null);
        }
예제 #3
0
        public static void LoadConfig(string path, IConfigProvider provider)
        {
            if (!CheckPath(ref path))
            {
                return;
            }

            var directory = FileManagerSecure.GetDirectoryName(path);

            if (!FileManagerSecure.DirectoryExists(directory))
            {
                return;
            }

            var config = Controller.LoadJSON(path);

            provider.RestoreConfig(config);

            SuperController.LogMessage($"Loaded config! \"{path}\"");
        }
    public void OpenExportDialog()
    {
        FileManagerSecure.CreateDirectory(_saveFolder);
        var fileBrowserUI = SuperController.singleton.fileBrowserUI;

        fileBrowserUI.SetTitle("Save keybindings");
        fileBrowserUI.fileRemovePrefix            = null;
        fileBrowserUI.hideExtension               = false;
        fileBrowserUI.keepOpen                    = false;
        fileBrowserUI.fileFormat                  = _saveExt;
        fileBrowserUI.defaultPath                 = _saveFolder;
        fileBrowserUI.showDirs                    = true;
        fileBrowserUI.shortCuts                   = null;
        fileBrowserUI.browseVarFilesAsDirectories = false;
        var shortCuts = new List <ShortCut>
        {
            new ShortCut {
                path = @"Saves\keybindings", displayName = "Custom keybindings"
            },
        };
        const string devKeybindingsPath = @"Custom\Scripts\Dev\vam-keybindings\keybindings";

        if (FileManagerSecure.DirectoryExists(devKeybindingsPath))
        {
            shortCuts.Add(new ShortCut {
                path = devKeybindingsPath, displayName = "Dev keybindings"
            });
        }
        fileBrowserUI.shortCuts = shortCuts;
        fileBrowserUI.SetTextEntry(true);
        fileBrowserUI.Show(path =>
        {
            fileBrowserUI.fileFormat = "json";
            Export(path);
        });
        fileBrowserUI.ActivateFileNameField();
    }