Rename variables

This commit is contained in:
Kevin Zhang 2021-07-03 12:45:00 +08:00
parent 428efb1cd0
commit 0df9f373ce
3 changed files with 14 additions and 14 deletions

View file

@ -28,7 +28,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
Action = c => Action = c =>
{ {
if (c.SpecialKeyState.CtrlPressed || (!Settings.EnabledPathSearchKeyword && !Settings.EnabledSearchActionKeyword)) if (c.SpecialKeyState.CtrlPressed || (!Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled))
{ {
try try
{ {
@ -42,7 +42,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
} }
} }
// one of it is enabled // one of it is enabled
var keyword = Settings.EnabledSearchActionKeyword ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword; var keyword = Settings.SearchActionKeywordEnabled ? Settings.SearchActionKeyword : Settings.PathSearchActionKeyword;
keyword = keyword == Query.GlobalPluginWildcardSign ? string.Empty : keyword + " "; keyword = keyword == Query.GlobalPluginWildcardSign ? string.Empty : keyword + " ";

View file

@ -71,13 +71,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search
return allowedActionKeyword switch return allowedActionKeyword switch
{ {
Settings.ActionKeyword.SearchActionKeyword => settings.EnabledSearchActionKeyword && Settings.ActionKeyword.SearchActionKeyword => settings.SearchActionKeywordEnabled &&
keyword == settings.SearchActionKeyword, keyword == settings.SearchActionKeyword,
Settings.ActionKeyword.PathSearchActionKeyword => settings.EnabledPathSearchKeyword && Settings.ActionKeyword.PathSearchActionKeyword => settings.PathSearchKeywordEnabled &&
keyword == settings.PathSearchActionKeyword, keyword == settings.PathSearchActionKeyword,
Settings.ActionKeyword.FileContentSearchActionKeyword => keyword == Settings.ActionKeyword.FileContentSearchActionKeyword => keyword ==
settings.FileContentSearchActionKeyword, settings.FileContentSearchActionKeyword,
Settings.ActionKeyword.IndexSearchActionKeyword => settings.EnabledIndexOnlySearchKeyword && Settings.ActionKeyword.IndexSearchActionKeyword => settings.IndexOnlySearchKeywordEnabled &&
keyword == settings.IndexSearchActionKeyword keyword == settings.IndexSearchActionKeyword
}; };
} }

View file

@ -21,17 +21,17 @@ namespace Flow.Launcher.Plugin.Explorer
public List<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new List<AccessLink>(); public List<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new List<AccessLink>();
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool EnabledSearchActionKeyword { get; set; } = true; public bool SearchActionKeywordEnabled { get; set; } = true;
public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword; public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword;
public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool EnabledPathSearchKeyword { get; set; } public bool PathSearchKeywordEnabled { get; set; }
public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool EnabledIndexOnlySearchKeyword { get; set; } public bool IndexOnlySearchKeywordEnabled { get; set; }
internal enum ActionKeyword internal enum ActionKeyword
{ {
@ -60,17 +60,17 @@ namespace Flow.Launcher.Plugin.Explorer
internal bool? GetActionKeywordEnable(ActionKeyword actionKeyword) => actionKeyword switch internal bool? GetActionKeywordEnable(ActionKeyword actionKeyword) => actionKeyword switch
{ {
ActionKeyword.SearchActionKeyword => EnabledSearchActionKeyword, ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled,
ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled,
ActionKeyword.IndexSearchActionKeyword => EnabledIndexOnlySearchKeyword, ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled,
_ => null _ => null
}; };
internal void SetActionKeywordEnable(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch internal void SetActionKeywordEnable(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch
{ {
ActionKeyword.SearchActionKeyword => EnabledSearchActionKeyword = enable, ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable,
ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword = enable, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable,
ActionKeyword.IndexSearchActionKeyword => EnabledIndexOnlySearchKeyword = enable, ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled = enable,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property")
}; };
} }