/// <summary> /// Retrieve the settings from the session persistence store (e.g. registry). /// </summary> public void Update() { CurrentWorkspace = _persistenceManager.ReadString( Constants.KEY_CURRENT_WORKSPACE, Directory.GetCurrentDirectory()); BackupDirectory = _persistenceManager.ReadString( Constants.KEY_BACKUP_DIRECTORY, String.Empty); VisitedFoldersList = _persistenceManager.ReadStrings( Constants.KEY_VISITED_FOLDERS_LIST); VisitedFoldersLimit = _persistenceManager.ReadInt( Constants.KEY_VISITED_FOLDERS_LIMIT, 10); ShowSourceOnly = _persistenceManager.ReadBoolean( Constants.KEY_SHOW_SOURCE_ONLY, false); ShowHiddenFiles = _persistenceManager.ReadBoolean( Constants.KEY_SHOW_HIDDEN_FILES, false); ShowSystemFiles = _persistenceManager.ReadBoolean( Constants.KEY_SHOW_SYSTEM_FILES, false); ShowFullPath = _persistenceManager.ReadBoolean( Constants.KEY_SHOW_FULL_PATH, false); // Trim the list if too big. while (VisitedFoldersList.Count > VisitedFoldersLimit) { VisitedFoldersList.RemoveAt(0); } }
/// <summary> /// Remove a folder from the recently visited folders list. /// </summary> /// <param name="path">The path of the folder.</param> public void RemoveFolderFromVisitedList(string path) { if (VisitedFoldersLimit > 0 && VisitedFoldersList.Contains(path)) { VisitedFoldersList.Remove(path); } }
/// <summary> /// Retrieve the settings from the session persistence store (e.g. registry). /// </summary> public void Update() { RootFolder = _persistenceManager.ReadString( Constants.KEY_ROOT_FOLDER, Directory.GetCurrentDirectory()); bool defaultFiltersApplied = _persistenceManager.ReadBoolean( Constants.KEY_DEFAULT_FILTERS_APPLIED, false); List <string> filterList = _persistenceManager.ReadStrings( Constants.KEY_FILE_FILTERS); SelectedFilter = _persistenceManager.ReadString( Constants.KEY_SELECTED_FILE_FILTER, String.Empty); if (filterList.Count == 0 && !defaultFiltersApplied) { filterList.Add("55F01123-747C-423B-BDAB-3ED92B6A466D|Hide All Files|"); filterList.Add("692BB91D-FA37-4826-9483-E4CD53AF9DAB|Web Files|(?i:\\.html$) (?i:\\.css$) (?i:\\.js$)"); SelectedFilter = String.Empty; _persistenceManager.WriteBoolean( Constants.KEY_DEFAULT_FILTERS_APPLIED, true); } FileFilters = FileFilter.GetFileFilters(filterList); ApplyFilter = _persistenceManager.ReadBoolean( Constants.KEY_APPLY_FILE_FILTER, false); if (SelectedFilter == String.Empty) { ApplyFilter = false; } VisitedFoldersList = _persistenceManager.ReadStrings( Constants.KEY_VISITED_FOLDERS_LIST); VisitedFoldersLimit = _persistenceManager.ReadInt( Constants.KEY_VISITED_FOLDERS_LIMIT, 10); // Trim the list if too big. while (VisitedFoldersList.Count > VisitedFoldersLimit) { VisitedFoldersList.RemoveAt(0); } BackupDirectory = _persistenceManager.ReadString( Constants.KEY_BACKUP_DIRECTORY, String.Empty); ShowHiddenFiles = _persistenceManager.ReadBoolean( Constants.KEY_SHOW_HIDDEN_FILES, false); ShowSystemFiles = _persistenceManager.ReadBoolean( Constants.KEY_SHOW_SYSTEM_FILES, false); ShowFullPath = _persistenceManager.ReadBoolean( Constants.KEY_SHOW_FULL_PATH, false); }
/// <summary> /// Add a folder to the recently visited folders list. /// </summary> /// <param name="path">The path of the folder.</param> public void AddFolderToVisitedList(string path) { if (VisitedFoldersList.Contains(path)) { VisitedFoldersList.Remove(path); } VisitedFoldersList.Add(path); if (VisitedFoldersList.Count > VisitedFoldersLimit) { VisitedFoldersList.RemoveAt(0); } }