2016-05-04 04:18:26 +08:00
|
|
|
|
using System.IO;
|
2016-06-21 07:14:32 +08:00
|
|
|
|
using System.Windows.Media;
|
2016-05-04 04:18:26 +08:00
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Newtonsoft.Json;
|
2016-06-21 07:14:32 +08:00
|
|
|
|
using Wox.Infrastructure.Image;
|
2015-01-05 22:41:17 +08:00
|
|
|
|
|
2015-01-26 22:50:38 +08:00
|
|
|
|
namespace Wox.Plugin.WebSearch
|
2014-01-29 22:44:57 +08:00
|
|
|
|
{
|
2016-06-21 07:14:32 +08:00
|
|
|
|
public class SearchSource : BaseModel
|
2014-01-29 22:44:57 +08:00
|
|
|
|
{
|
2016-05-04 04:18:26 +08:00
|
|
|
|
public const string DefaultIcon = "web_search.png";
|
2014-01-29 22:44:57 +08:00
|
|
|
|
public string Title { get; set; }
|
2015-11-05 06:49:40 +08:00
|
|
|
|
public string ActionKeyword { get; set; }
|
2016-05-04 04:18:26 +08:00
|
|
|
|
|
|
|
|
|
[NotNull]
|
2016-07-30 08:22:25 +08:00
|
|
|
|
public string Icon { get; set; } = DefaultIcon;
|
2016-05-05 23:21:35 +08:00
|
|
|
|
|
2016-05-04 04:18:26 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// All icon should be put under Images directory
|
|
|
|
|
/// </summary>
|
|
|
|
|
[NotNull]
|
|
|
|
|
[JsonIgnore]
|
2016-06-21 07:14:32 +08:00
|
|
|
|
internal string IconPath => Path.Combine(Main.ImagesDirectory, Icon);
|
2016-06-21 07:18:35 +08:00
|
|
|
|
|
2016-06-21 07:14:32 +08:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public ImageSource Image => ImageLoader.Load(IconPath);
|
2016-05-04 04:18:26 +08:00
|
|
|
|
|
2014-01-29 22:44:57 +08:00
|
|
|
|
public string Url { get; set; }
|
|
|
|
|
public bool Enabled { get; set; }
|
2016-06-21 07:14:32 +08:00
|
|
|
|
|
|
|
|
|
public SearchSource DeepCopy()
|
|
|
|
|
{
|
|
|
|
|
var webSearch = new SearchSource
|
|
|
|
|
{
|
|
|
|
|
Title = string.Copy(Title),
|
|
|
|
|
ActionKeyword = string.Copy(ActionKeyword),
|
|
|
|
|
Url = string.Copy(Url),
|
|
|
|
|
Icon = string.Copy(Icon),
|
|
|
|
|
Enabled = Enabled
|
|
|
|
|
};
|
|
|
|
|
return webSearch;
|
|
|
|
|
}
|
2014-01-29 22:44:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|