2025-12-14 10:18:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2022-07-01 04:56:15 +00:00
|
|
|
|
using System.Collections.ObjectModel;
|
2022-07-04 00:50:02 +00:00
|
|
|
|
using System.ComponentModel;
|
2022-03-28 20:28:18 +00:00
|
|
|
|
using System.Text.Json.Serialization;
|
2025-12-14 10:18:21 +00:00
|
|
|
|
using Flow.Launcher.Plugin.Explorer.Search;
|
|
|
|
|
|
using Flow.Launcher.Plugin.Explorer.Search.Everything;
|
2022-09-10 15:45:41 +00:00
|
|
|
|
using Flow.Launcher.Plugin.Explorer.Search.IProvider;
|
2025-12-14 10:18:21 +00:00
|
|
|
|
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
|
|
|
|
|
using Flow.Launcher.Plugin.Explorer.Search.WindowsIndex;
|
2020-05-11 13:15:15 +00:00
|
|
|
|
|
|
|
|
|
|
namespace Flow.Launcher.Plugin.Explorer
|
|
|
|
|
|
{
|
|
|
|
|
|
public class Settings
|
|
|
|
|
|
{
|
2020-05-24 22:14:21 +00:00
|
|
|
|
public int MaxResult { get; set; } = 100;
|
|
|
|
|
|
|
2025-09-21 03:50:51 +00:00
|
|
|
|
public ObservableCollection<AccessLink> QuickAccessLinks { get; set; } = [];
|
2020-06-02 10:12:14 +00:00
|
|
|
|
|
2025-09-21 03:50:51 +00:00
|
|
|
|
public ObservableCollection<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = [];
|
2022-07-04 00:50:02 +00:00
|
|
|
|
|
|
|
|
|
|
public string EditorPath { get; set; } = "";
|
|
|
|
|
|
|
2022-12-19 20:07:07 +00:00
|
|
|
|
public string FolderEditorPath { get; set; } = "";
|
|
|
|
|
|
|
2022-08-17 00:52:53 +00:00
|
|
|
|
public string ShellPath { get; set; } = "cmd";
|
2022-10-02 04:42:39 +00:00
|
|
|
|
|
2024-07-16 22:44:18 +00:00
|
|
|
|
public string ExcludedFileTypes { get; set; } = "";
|
|
|
|
|
|
|
2022-07-04 00:50:02 +00:00
|
|
|
|
public bool UseLocationAsWorkingDir { get; set; } = false;
|
|
|
|
|
|
|
2024-06-08 04:16:33 +00:00
|
|
|
|
public bool ShowInlinedWindowsContextMenu { get; set; } = false;
|
2021-01-26 10:09:35 +00:00
|
|
|
|
|
2024-06-12 12:36:36 +00:00
|
|
|
|
public string WindowsContextMenuIncludedItems { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
public string WindowsContextMenuExcludedItems { get; set; } = string.Empty;
|
2024-06-07 08:30:19 +00:00
|
|
|
|
|
2023-03-29 07:19:55 +00:00
|
|
|
|
public bool DefaultOpenFolderInFileManager { get; set; } = false;
|
2020-07-14 19:50:48 +00:00
|
|
|
|
|
2025-06-04 09:01:15 +00:00
|
|
|
|
public bool DisplayMoreInformationInToolTip { get; set; } = false;
|
|
|
|
|
|
|
2020-07-14 19:50:48 +00:00
|
|
|
|
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
2021-07-30 10:44:29 +00:00
|
|
|
|
|
2021-07-03 04:45:00 +00:00
|
|
|
|
public bool SearchActionKeywordEnabled { get; set; } = true;
|
2020-07-14 19:50:48 +00:00
|
|
|
|
|
2020-08-25 22:06:51 +00:00
|
|
|
|
public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword;
|
2021-05-22 09:23:25 +00:00
|
|
|
|
|
2021-09-01 11:10:52 +00:00
|
|
|
|
public bool FileContentSearchKeywordEnabled { get; set; } = true;
|
|
|
|
|
|
|
2021-05-22 09:23:25 +00:00
|
|
|
|
public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
2021-05-29 10:08:34 +00:00
|
|
|
|
|
2021-07-03 04:45:00 +00:00
|
|
|
|
public bool PathSearchKeywordEnabled { get; set; }
|
2021-05-30 09:28:18 +00:00
|
|
|
|
|
2021-06-05 04:07:13 +00:00
|
|
|
|
public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
2021-05-30 09:28:18 +00:00
|
|
|
|
|
2021-09-01 12:05:19 +00:00
|
|
|
|
public bool IndexSearchKeywordEnabled { get; set; }
|
2021-05-30 09:28:18 +00:00
|
|
|
|
|
2021-07-30 10:44:29 +00:00
|
|
|
|
public string QuickAccessActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
|
|
|
|
|
|
|
|
|
|
|
public bool QuickAccessKeywordEnabled { get; set; }
|
|
|
|
|
|
|
2025-12-14 10:18:21 +00:00
|
|
|
|
|
|
|
|
|
|
public string FolderSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
|
|
|
|
|
|
|
|
|
|
|
public bool FolderSearchKeywordEnabled { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public string FileSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
|
|
|
|
|
|
|
|
|
|
|
public bool FileSearchKeywordEnabled { get; set; }
|
|
|
|
|
|
|
2021-07-25 09:58:21 +00:00
|
|
|
|
public bool WarnWindowsSearchServiceOff { get; set; } = true;
|
|
|
|
|
|
|
2024-05-24 03:51:24 +00:00
|
|
|
|
public bool ShowFileSizeInPreviewPanel { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
|
|
public bool ShowCreatedDateInPreviewPanel { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
|
|
public bool ShowModifiedDateInPreviewPanel { get; set; } = true;
|
2025-05-24 03:12:56 +00:00
|
|
|
|
|
2025-05-24 06:28:51 +00:00
|
|
|
|
public bool ShowFileAgeInPreviewPanel { get; set; } = false;
|
2025-05-24 03:12:56 +00:00
|
|
|
|
|
2024-05-24 03:51:24 +00:00
|
|
|
|
public string PreviewPanelDateFormat { get; set; } = "yyyy-MM-dd";
|
2024-06-07 08:30:19 +00:00
|
|
|
|
|
2024-05-24 03:51:24 +00:00
|
|
|
|
public string PreviewPanelTimeFormat { get; set; } = "HH:mm";
|
|
|
|
|
|
|
2022-07-04 00:50:02 +00:00
|
|
|
|
private EverythingSearchManager _everythingManagerInstance;
|
|
|
|
|
|
private WindowsIndexSearchManager _windowsIndexSearchManager;
|
|
|
|
|
|
|
|
|
|
|
|
#region SearchEngine
|
|
|
|
|
|
|
|
|
|
|
|
private EverythingSearchManager EverythingManagerInstance => _everythingManagerInstance ??= new EverythingSearchManager(this);
|
|
|
|
|
|
private WindowsIndexSearchManager WindowsIndexSearchManager => _windowsIndexSearchManager ??= new WindowsIndexSearchManager(this);
|
|
|
|
|
|
|
2022-10-02 04:42:39 +00:00
|
|
|
|
public IndexSearchEngineOption IndexSearchEngine { get; set; } = IndexSearchEngineOption.WindowsIndex;
|
2025-09-21 03:50:51 +00:00
|
|
|
|
|
2022-03-28 20:28:18 +00:00
|
|
|
|
[JsonIgnore]
|
2022-07-04 00:50:02 +00:00
|
|
|
|
public IIndexProvider IndexProvider => IndexSearchEngine switch
|
|
|
|
|
|
{
|
|
|
|
|
|
IndexSearchEngineOption.Everything => EverythingManagerInstance,
|
|
|
|
|
|
IndexSearchEngineOption.WindowsIndex => WindowsIndexSearchManager,
|
|
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(IndexSearchEngine))
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-10-02 04:42:39 +00:00
|
|
|
|
public PathEnumerationEngineOption PathEnumerationEngine { get; set; } = PathEnumerationEngineOption.WindowsIndex;
|
|
|
|
|
|
|
2022-03-28 20:28:18 +00:00
|
|
|
|
[JsonIgnore]
|
2022-09-10 15:45:41 +00:00
|
|
|
|
public IPathIndexProvider PathEnumerator => PathEnumerationEngine switch
|
2022-07-04 00:50:02 +00:00
|
|
|
|
{
|
|
|
|
|
|
PathEnumerationEngineOption.Everything => EverythingManagerInstance,
|
|
|
|
|
|
PathEnumerationEngineOption.WindowsIndex => WindowsIndexSearchManager,
|
|
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(PathEnumerationEngine))
|
|
|
|
|
|
};
|
2022-03-25 21:19:00 +00:00
|
|
|
|
|
2022-10-02 04:42:39 +00:00
|
|
|
|
public ContentIndexSearchEngineOption ContentSearchEngine { get; set; } = ContentIndexSearchEngineOption.WindowsIndex;
|
2022-03-28 20:28:18 +00:00
|
|
|
|
[JsonIgnore]
|
2022-07-04 00:50:02 +00:00
|
|
|
|
public IContentIndexProvider ContentIndexProvider => ContentSearchEngine switch
|
|
|
|
|
|
{
|
|
|
|
|
|
ContentIndexSearchEngineOption.Everything => EverythingManagerInstance,
|
|
|
|
|
|
ContentIndexSearchEngineOption.WindowsIndex => WindowsIndexSearchManager,
|
|
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(ContentSearchEngine))
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
public enum PathEnumerationEngineOption
|
2022-03-25 21:19:00 +00:00
|
|
|
|
{
|
2022-07-04 00:50:02 +00:00
|
|
|
|
[Description("plugin_explorer_engine_windows_index")]
|
2022-03-25 21:19:00 +00:00
|
|
|
|
WindowsIndex,
|
2022-10-02 04:42:39 +00:00
|
|
|
|
[Description("plugin_explorer_engine_everything")]
|
|
|
|
|
|
Everything,
|
2022-07-04 00:50:02 +00:00
|
|
|
|
[Description("plugin_explorer_path_enumeration_engine_none")]
|
2022-11-28 23:54:06 +00:00
|
|
|
|
DirectEnumeration
|
2022-03-25 21:19:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public enum IndexSearchEngineOption
|
|
|
|
|
|
{
|
2022-10-02 04:42:39 +00:00
|
|
|
|
[Description("plugin_explorer_engine_windows_index")]
|
|
|
|
|
|
WindowsIndex,
|
2022-07-04 00:50:02 +00:00
|
|
|
|
[Description("plugin_explorer_engine_everything")]
|
2022-03-25 21:19:00 +00:00
|
|
|
|
Everything,
|
|
|
|
|
|
}
|
2022-07-04 00:50:02 +00:00
|
|
|
|
|
2022-03-28 20:28:18 +00:00
|
|
|
|
public enum ContentIndexSearchEngineOption
|
|
|
|
|
|
{
|
2022-10-02 04:42:39 +00:00
|
|
|
|
[Description("plugin_explorer_engine_windows_index")]
|
|
|
|
|
|
WindowsIndex,
|
2022-07-04 00:50:02 +00:00
|
|
|
|
[Description("plugin_explorer_engine_everything")]
|
2022-03-28 20:28:18 +00:00
|
|
|
|
Everything,
|
|
|
|
|
|
}
|
2022-07-04 00:50:02 +00:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2022-03-28 20:28:18 +00:00
|
|
|
|
#region Everything Settings
|
2022-07-04 00:50:02 +00:00
|
|
|
|
|
2022-03-25 21:19:00 +00:00
|
|
|
|
public string EverythingInstalledPath { get; set; }
|
|
|
|
|
|
|
2025-07-16 13:28:17 +00:00
|
|
|
|
public EverythingSortOption SortOption { get; set; } = EverythingSortOption.NAME_ASCENDING;
|
2022-07-04 00:50:02 +00:00
|
|
|
|
|
2022-05-15 20:15:56 +00:00
|
|
|
|
public bool EnableEverythingContentSearch { get; set; } = false;
|
2022-03-25 21:19:00 +00:00
|
|
|
|
|
2022-10-02 04:42:39 +00:00
|
|
|
|
public bool EverythingEnabled => IndexSearchEngine == IndexSearchEngineOption.Everything ||
|
2022-08-17 01:32:49 +00:00
|
|
|
|
PathEnumerationEngine == PathEnumerationEngineOption.Everything ||
|
|
|
|
|
|
ContentSearchEngine == ContentIndexSearchEngineOption.Everything;
|
|
|
|
|
|
|
2023-02-20 20:04:50 +00:00
|
|
|
|
public bool EverythingSearchFullPath { get; set; } = false;
|
2024-07-15 06:52:12 +00:00
|
|
|
|
public bool EverythingEnableRunCount { get; set; } = true;
|
2024-05-24 03:51:24 +00:00
|
|
|
|
|
2022-03-25 21:19:00 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2021-05-30 09:28:18 +00:00
|
|
|
|
internal enum ActionKeyword
|
|
|
|
|
|
{
|
|
|
|
|
|
SearchActionKeyword,
|
|
|
|
|
|
PathSearchActionKeyword,
|
|
|
|
|
|
FileContentSearchActionKeyword,
|
2021-07-30 10:44:29 +00:00
|
|
|
|
IndexSearchActionKeyword,
|
2025-12-14 10:18:21 +00:00
|
|
|
|
QuickAccessActionKeyword,
|
|
|
|
|
|
FolderSearchActionKeyword,
|
|
|
|
|
|
FileSearchActionKeyword,
|
2021-05-30 09:28:18 +00:00
|
|
|
|
}
|
2021-06-02 01:10:24 +00:00
|
|
|
|
|
|
|
|
|
|
internal string GetActionKeyword(ActionKeyword actionKeyword) => actionKeyword switch
|
|
|
|
|
|
{
|
|
|
|
|
|
ActionKeyword.SearchActionKeyword => SearchActionKeyword,
|
|
|
|
|
|
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword,
|
|
|
|
|
|
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword,
|
2021-07-30 10:44:29 +00:00
|
|
|
|
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword,
|
2021-09-15 11:15:33 +00:00
|
|
|
|
ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword,
|
2025-12-14 10:18:21 +00:00
|
|
|
|
ActionKeyword.FolderSearchActionKeyword => FolderSearchActionKeyword,
|
|
|
|
|
|
ActionKeyword.FileSearchActionKeyword => FileSearchActionKeyword,
|
2021-09-01 11:10:52 +00:00
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found")
|
2021-06-02 01:10:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch
|
|
|
|
|
|
{
|
|
|
|
|
|
ActionKeyword.SearchActionKeyword => SearchActionKeyword = keyword,
|
|
|
|
|
|
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword,
|
|
|
|
|
|
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword,
|
2021-06-05 04:07:13 +00:00
|
|
|
|
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword,
|
2021-07-30 10:44:29 +00:00
|
|
|
|
ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword = keyword,
|
2025-12-14 10:18:21 +00:00
|
|
|
|
ActionKeyword.FolderSearchActionKeyword => FolderSearchActionKeyword = keyword,
|
|
|
|
|
|
ActionKeyword.FileSearchActionKeyword => FileSearchActionKeyword = keyword,
|
2021-09-01 11:10:52 +00:00
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found")
|
2021-06-02 01:10:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
2021-09-01 11:10:52 +00:00
|
|
|
|
internal bool GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch
|
2021-06-02 01:10:24 +00:00
|
|
|
|
{
|
2021-07-03 04:45:00 +00:00
|
|
|
|
ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled,
|
|
|
|
|
|
ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled,
|
2021-09-01 12:05:19 +00:00
|
|
|
|
ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled,
|
2021-09-01 11:10:52 +00:00
|
|
|
|
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled,
|
2021-07-30 10:44:29 +00:00
|
|
|
|
ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled,
|
2025-12-14 10:18:21 +00:00
|
|
|
|
ActionKeyword.FolderSearchActionKeyword => FolderSearchKeywordEnabled,
|
|
|
|
|
|
ActionKeyword.FileSearchActionKeyword => FileSearchKeywordEnabled,
|
2021-09-01 11:10:52 +00:00
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined")
|
2021-06-02 01:10:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
2021-07-03 06:33:29 +00:00
|
|
|
|
internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch
|
2021-06-02 01:10:24 +00:00
|
|
|
|
{
|
2021-07-03 04:45:00 +00:00
|
|
|
|
ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable,
|
|
|
|
|
|
ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable,
|
2021-09-01 12:05:19 +00:00
|
|
|
|
ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled = enable,
|
2021-09-01 11:10:52 +00:00
|
|
|
|
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled = enable,
|
2021-07-30 10:44:29 +00:00
|
|
|
|
ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled = enable,
|
2025-12-14 10:18:21 +00:00
|
|
|
|
ActionKeyword.FolderSearchActionKeyword => FolderSearchKeywordEnabled = enable,
|
|
|
|
|
|
ActionKeyword.FileSearchActionKeyword => FileSearchKeywordEnabled = enable,
|
2021-09-01 11:10:52 +00:00
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined")
|
2021-06-02 01:10:24 +00:00
|
|
|
|
};
|
2025-12-14 10:18:21 +00:00
|
|
|
|
|
|
|
|
|
|
// Returns a dictionary because some ActionKeywords may use wildcards (*),
|
|
|
|
|
|
// which means multiple ActionKeywords can be considered active at the same time.
|
|
|
|
|
|
// Using a dictionary ensures O(1) lookup time when checking which actions
|
|
|
|
|
|
// are enabled.
|
|
|
|
|
|
internal Dictionary<ActionKeyword, string> GetActiveActionKeywords(string actionKeywordStr)
|
|
|
|
|
|
{
|
|
|
|
|
|
var result = new Dictionary<ActionKeyword, string>();
|
2026-03-10 05:40:25 +00:00
|
|
|
|
if (string.IsNullOrEmpty(actionKeywordStr)) return result;
|
2025-12-14 10:18:21 +00:00
|
|
|
|
foreach (var action in Enum.GetValues<ActionKeyword>())
|
|
|
|
|
|
{
|
|
|
|
|
|
var keywordStr = GetActionKeyword(action);
|
|
|
|
|
|
if (string.IsNullOrEmpty(keywordStr)) continue;
|
|
|
|
|
|
var isEnabled = GetActionKeywordEnabled(action);
|
|
|
|
|
|
if (keywordStr == actionKeywordStr && isEnabled) result.Add(action, keywordStr);
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2020-05-11 13:15:15 +00:00
|
|
|
|
}
|
2022-09-10 15:45:41 +00:00
|
|
|
|
}
|