Flow.Launcher/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
Jeremy Wu 6dedb4fc40
Release 1.9.4 (#1287)
* Merge pull request #1205 from Flow-Launcher/fix_cmd_command_with_blank

Fix shell cmd command with quote and space

* Bump NuGet.CommandLine from 5.4.0 to 5.7.2 (#1241)

* Merge pull request #1098 from Flow-Launcher/ScrollToSelectedPlugin

Scroll to selected item when expanded or size changed

* fix RemoveOldQueryResults NullPointerException (#1204)

* Merge pull request #1005 from Flow-Launcher/KillProcess

Use Cancellation Token to avoid potential race tracing issue

* Merge pull request #1187 from Flow-Launcher/update_python_download_mirrors

Update Python download mirrors

* Merge pull request #1108 from Flow-Launcher/CalculatorDecimalSeparator

Respect Decimal Separator for query not just result

* Merge pull request #1087 from Flow-Launcher/turnoff_replace_win_r_shell

Set Shell plugin's default replace Win R hotkey to off

* Merge pull request #1077 from Flow-Launcher/fix_explorer_button_visibility

Fix incorrect button visibility in Explorer's expander control

* Merge pull request #1076 from Flow-Launcher/fix_path_search_with_index

Fix the use of index in path search

* Merge pull request #1071 from medlir/fix-browser-bookmarks-plugin-exception

avoid exception in ChromiumBookmarkLoader.cs

* Merge pull request #1056 from Flow-Launcher/fix_context_menu_typo

Fix typo for plugin title in context menu and WindowsSettings name

* Merge pull request #1119 from onesounds/antialising

Remove All Cleartype Rendering

* Version bump

* Remove Calculator plugin CopyText feature for 1.9.4 release
2022-07-24 11:39:31 +10:00

92 lines
No EOL
4.5 KiB
C#

using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
using System;
using System.Collections.Generic;
namespace Flow.Launcher.Plugin.Explorer
{
public class Settings
{
public int MaxResult { get; set; } = 100;
public List<AccessLink> QuickAccessLinks { get; set; } = new List<AccessLink>();
// as at v1.7.0 this is to maintain backwards compatibility, need to be removed afterwards.
public List<AccessLink> QuickFolderAccessLinks { get; set; } = new List<AccessLink>();
public bool UseWindowsIndexForDirectorySearch { get; set; } = false;
public List<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new List<AccessLink>();
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool SearchActionKeywordEnabled { get; set; } = true;
public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword;
public bool FileContentSearchKeywordEnabled { get; set; } = true;
public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool PathSearchKeywordEnabled { get; set; }
public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool IndexSearchKeywordEnabled { get; set; }
public string QuickAccessActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool QuickAccessKeywordEnabled { get; set; }
public bool WarnWindowsSearchServiceOff { get; set; } = true;
internal enum ActionKeyword
{
SearchActionKeyword,
PathSearchActionKeyword,
FileContentSearchActionKeyword,
IndexSearchActionKeyword,
QuickAccessActionKeyword
}
internal string GetActionKeyword(ActionKeyword actionKeyword) => actionKeyword switch
{
ActionKeyword.SearchActionKeyword => SearchActionKeyword,
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword,
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword,
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword,
ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found")
};
internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch
{
ActionKeyword.SearchActionKeyword => SearchActionKeyword = keyword,
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword,
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword,
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword,
ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword = keyword,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found")
};
internal bool GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch
{
ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled,
ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled,
ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled,
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled,
ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined")
};
internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch
{
ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable,
ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable,
ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled = enable,
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled = enable,
ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled = enable,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined")
};
}
}