2020-08-25 22:06:51 +00:00
|
|
|
|
using Flow.Launcher.Plugin.Explorer.Search;
|
2021-01-26 09:48:06 +00:00
|
|
|
|
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
2021-06-02 01:10:24 +00:00
|
|
|
|
using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption;
|
|
|
|
|
|
using System;
|
2020-05-11 13:15:15 +00:00
|
|
|
|
using System.Collections.Generic;
|
2021-06-02 01:10:24 +00:00
|
|
|
|
using System.IO;
|
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;
|
|
|
|
|
|
|
2021-01-26 09:35:02 +00:00
|
|
|
|
public List<AccessLink> QuickAccessLinks { get; set; } = new List<AccessLink>();
|
2020-06-02 10:12:14 +00:00
|
|
|
|
|
2021-01-26 10:09:35 +00:00
|
|
|
|
// 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>();
|
|
|
|
|
|
|
2020-06-02 10:12:14 +00:00
|
|
|
|
public bool UseWindowsIndexForDirectorySearch { get; set; } = true;
|
|
|
|
|
|
|
2021-01-26 09:31:55 +00:00
|
|
|
|
public List<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new List<AccessLink>();
|
2020-07-14 19:50:48 +00:00
|
|
|
|
|
|
|
|
|
|
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
2021-06-02 01:10:24 +00:00
|
|
|
|
public bool EnableSearchActionKeyword { 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
|
|
|
|
|
|
|
|
|
|
public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
2021-05-29 10:08:34 +00:00
|
|
|
|
|
2021-05-30 09:28:18 +00:00
|
|
|
|
public bool EnabledPathSearchKeyword { get; set; }
|
|
|
|
|
|
|
2021-06-05 04:07:13 +00:00
|
|
|
|
public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
|
2021-05-30 09:28:18 +00:00
|
|
|
|
|
|
|
|
|
|
public bool EnabledIndexOnlySearchKeyword { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
internal enum ActionKeyword
|
|
|
|
|
|
{
|
|
|
|
|
|
SearchActionKeyword,
|
|
|
|
|
|
PathSearchActionKeyword,
|
|
|
|
|
|
FileContentSearchActionKeyword,
|
2021-06-05 04:07:13 +00:00
|
|
|
|
IndexSearchActionKeyword
|
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-06-05 04:07:13 +00:00
|
|
|
|
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword
|
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-06-02 01:10:24 +00:00
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property")
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
internal bool? GetActionKeywordEnable(ActionKeyword actionKeyword) => actionKeyword switch
|
|
|
|
|
|
{
|
|
|
|
|
|
ActionKeyword.SearchActionKeyword => EnableSearchActionKeyword,
|
|
|
|
|
|
ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword,
|
2021-06-05 04:07:13 +00:00
|
|
|
|
ActionKeyword.IndexSearchActionKeyword => EnabledIndexOnlySearchKeyword,
|
2021-06-02 01:10:24 +00:00
|
|
|
|
_ => null
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
internal void SetActionKeywordEnable(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch
|
|
|
|
|
|
{
|
|
|
|
|
|
ActionKeyword.SearchActionKeyword => EnableSearchActionKeyword = enable,
|
|
|
|
|
|
ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword = enable,
|
2021-06-05 04:07:13 +00:00
|
|
|
|
ActionKeyword.IndexSearchActionKeyword => EnabledIndexOnlySearchKeyword = enable,
|
2021-06-02 01:10:24 +00:00
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property")
|
|
|
|
|
|
};
|
2020-05-11 13:15:15 +00:00
|
|
|
|
}
|
2020-06-06 12:13:22 +00:00
|
|
|
|
}
|