2022-08-08 04:31:38 +00:00
|
|
|
|
using System.IO;
|
2016-05-03 20:18:26 +00:00
|
|
|
|
using JetBrains.Annotations;
|
2020-12-30 05:40:42 +00:00
|
|
|
|
using System.Text.Json.Serialization;
|
2015-01-05 14:41:17 +00:00
|
|
|
|
|
2020-04-21 09:12:17 +00:00
|
|
|
|
namespace Flow.Launcher.Plugin.WebSearch
|
2014-01-29 14:44:57 +00:00
|
|
|
|
{
|
2016-06-20 23:14:32 +00:00
|
|
|
|
public class SearchSource : BaseModel
|
2014-01-29 14:44:57 +00:00
|
|
|
|
{
|
|
|
|
|
|
public string Title { get; set; }
|
2025-08-09 14:21:10 +00:00
|
|
|
|
|
2015-11-04 22:49:40 +00:00
|
|
|
|
public string ActionKeyword { get; set; }
|
2016-05-03 20:18:26 +00:00
|
|
|
|
|
|
|
|
|
|
[NotNull]
|
2020-07-21 22:17:18 +00:00
|
|
|
|
public string Icon { get; set; } = "web_search.png";
|
|
|
|
|
|
|
2020-08-11 21:08:24 +00:00
|
|
|
|
public bool CustomIcon { get; set; } = false;
|
2016-05-05 15:21:35 +00:00
|
|
|
|
|
2016-05-03 20:18:26 +00:00
|
|
|
|
/// <summary>
|
2020-07-21 04:40:44 +00:00
|
|
|
|
/// Default icons are placed in Images directory in the app location.
|
|
|
|
|
|
/// Custom icons are placed in the user data directory
|
2016-05-03 20:18:26 +00:00
|
|
|
|
/// </summary>
|
2020-08-11 21:08:24 +00:00
|
|
|
|
[JsonIgnore]
|
2025-08-09 14:21:10 +00:00
|
|
|
|
public string IconPath => CustomIcon
|
|
|
|
|
|
? Path.Combine(Main.CustomImagesDirectory, Icon)
|
|
|
|
|
|
: Path.Combine(Main.DefaultImagesDirectory, Icon);
|
2020-07-21 04:40:44 +00:00
|
|
|
|
|
2014-01-29 14:44:57 +00:00
|
|
|
|
public string Url { get; set; }
|
2023-03-04 20:17:22 +00:00
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool Status => Enabled;
|
2025-08-09 14:21:10 +00:00
|
|
|
|
|
|
|
|
|
|
public bool IsPrivateMode { get; set; }
|
|
|
|
|
|
|
2014-01-29 14:44:57 +00:00
|
|
|
|
public bool Enabled { get; set; }
|
2016-06-20 23:14:32 +00:00
|
|
|
|
|
|
|
|
|
|
public SearchSource DeepCopy()
|
|
|
|
|
|
{
|
|
|
|
|
|
var webSearch = new SearchSource
|
|
|
|
|
|
{
|
2022-08-08 04:31:38 +00:00
|
|
|
|
Title = Title,
|
|
|
|
|
|
ActionKeyword = ActionKeyword,
|
|
|
|
|
|
Url = Url,
|
|
|
|
|
|
Icon = Icon,
|
2020-08-11 21:08:24 +00:00
|
|
|
|
CustomIcon = CustomIcon,
|
2025-08-09 14:21:10 +00:00
|
|
|
|
IsPrivateMode = IsPrivateMode,
|
2016-06-20 23:14:32 +00:00
|
|
|
|
Enabled = Enabled
|
|
|
|
|
|
};
|
2025-08-09 14:21:10 +00:00
|
|
|
|
|
2016-06-20 23:14:32 +00:00
|
|
|
|
return webSearch;
|
|
|
|
|
|
}
|
2014-01-29 14:44:57 +00:00
|
|
|
|
}
|
2022-08-08 04:31:38 +00:00
|
|
|
|
}
|