mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-16 04:29:16 +08:00
6ac33b0568
1. manually check updates 2. refactoring get http request to use async 3. remove some generic exception catch 4. remove unused code
34 lines
865 B
C#
34 lines
865 B
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Wox.Plugin.WebSearch.SuggestionSources
|
|
{
|
|
public abstract class SuggestionSource
|
|
{
|
|
public virtual string Domain { get; set; }
|
|
public IHttpProxy Proxy { get; set; }
|
|
|
|
public SuggestionSource(IHttpProxy httpProxy)
|
|
{
|
|
Proxy = httpProxy;
|
|
}
|
|
|
|
public abstract Task<List<string>> GetSuggestions(string query);
|
|
|
|
public static SuggestionSource GetSuggestionSource(string name, PluginInitContext context)
|
|
{
|
|
switch (name.ToLower())
|
|
{
|
|
case "google":
|
|
return new Google(context.Proxy);
|
|
|
|
case "baidu":
|
|
return new Baidu(context.Proxy);
|
|
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|