2015-10-31 07:17:34 +08:00
|
|
|
|
using System.Collections.Generic;
|
2015-01-26 22:50:38 +08:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Wox.Infrastructure.Storage;
|
|
|
|
|
|
|
|
|
|
namespace Wox.Plugin.WebSearch
|
|
|
|
|
{
|
|
|
|
|
public class WebSearchStorage :JsonStrorage<WebSearchStorage>
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public List<WebSearch> WebSearches { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public bool EnableWebSearchSuggestion { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty]
|
|
|
|
|
public string WebSearchSuggestionSource { get; set; }
|
|
|
|
|
|
|
|
|
|
protected override string ConfigFolder
|
|
|
|
|
{
|
|
|
|
|
get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string ConfigName
|
|
|
|
|
{
|
|
|
|
|
get { return "setting"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override WebSearchStorage LoadDefault()
|
|
|
|
|
{
|
|
|
|
|
WebSearches = LoadDefaultWebSearches();
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<WebSearch> LoadDefaultWebSearches()
|
|
|
|
|
{
|
|
|
|
|
List<WebSearch> webSearches = new List<WebSearch>();
|
|
|
|
|
|
|
|
|
|
WebSearch googleWebSearch = new WebSearch()
|
|
|
|
|
{
|
|
|
|
|
Title = "Google",
|
2015-11-05 06:49:40 +08:00
|
|
|
|
ActionKeyword = "g",
|
2015-01-26 22:50:38 +08:00
|
|
|
|
IconPath = @"Images\websearch\google.png",
|
|
|
|
|
Url = "https://www.google.com/search?q={q}",
|
|
|
|
|
Enabled = true
|
|
|
|
|
};
|
|
|
|
|
webSearches.Add(googleWebSearch);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WebSearch wikiWebSearch = new WebSearch()
|
|
|
|
|
{
|
|
|
|
|
Title = "Wikipedia",
|
2015-11-05 06:49:40 +08:00
|
|
|
|
ActionKeyword = "wiki",
|
2015-01-26 22:50:38 +08:00
|
|
|
|
IconPath = @"Images\websearch\wiki.png",
|
|
|
|
|
Url = "http://en.wikipedia.org/wiki/{q}",
|
|
|
|
|
Enabled = true
|
|
|
|
|
};
|
|
|
|
|
webSearches.Add(wikiWebSearch);
|
|
|
|
|
|
|
|
|
|
WebSearch findIcon = new WebSearch()
|
|
|
|
|
{
|
|
|
|
|
Title = "FindIcon",
|
2015-11-05 06:49:40 +08:00
|
|
|
|
ActionKeyword = "findicon",
|
2015-01-26 22:50:38 +08:00
|
|
|
|
IconPath = @"Images\websearch\pictures.png",
|
|
|
|
|
Url = "http://findicons.com/search/{q}",
|
|
|
|
|
Enabled = true
|
|
|
|
|
};
|
|
|
|
|
webSearches.Add(findIcon);
|
|
|
|
|
|
|
|
|
|
return webSearches;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|