2014-01-03 18:16:05 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2014-01-11 15:02:17 +08:00
|
|
|
|
using System.Linq;
|
2014-01-03 23:52:36 +08:00
|
|
|
|
using System.Threading;
|
2015-01-16 23:42:12 +08:00
|
|
|
|
using Wox.Core.Exception;
|
2015-01-05 22:41:17 +08:00
|
|
|
|
using Wox.Core.UserSettings;
|
2014-09-19 16:57:48 +08:00
|
|
|
|
using Wox.Infrastructure.Logger;
|
2014-01-29 18:33:24 +08:00
|
|
|
|
using Wox.Plugin;
|
2014-01-03 18:16:05 +08:00
|
|
|
|
|
2014-12-26 22:51:04 +08:00
|
|
|
|
namespace Wox.Core.Plugin.QueryDispatcher
|
2014-01-03 18:16:05 +08:00
|
|
|
|
{
|
2015-02-04 23:16:41 +08:00
|
|
|
|
public class UserPluginQueryDispatcher : BaseQueryDispatcher
|
2014-01-03 18:16:05 +08:00
|
|
|
|
{
|
2015-02-04 23:16:41 +08:00
|
|
|
|
protected override List<PluginPair> GetPlugins(Query query)
|
2014-01-03 23:52:36 +08:00
|
|
|
|
{
|
2015-02-04 23:16:41 +08:00
|
|
|
|
List<PluginPair> plugins = new List<PluginPair>();
|
|
|
|
|
//only first plugin that matches action keyword will get executed
|
2015-01-26 17:46:55 +08:00
|
|
|
|
PluginPair userPlugin = PluginManager.AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.GetActionKeyword());
|
2015-02-04 23:16:41 +08:00
|
|
|
|
if (userPlugin != null)
|
2014-01-03 18:16:05 +08:00
|
|
|
|
{
|
2015-02-04 23:16:41 +08:00
|
|
|
|
var customizedPluginConfig = UserSettingStorage.Instance.
|
|
|
|
|
CustomizedPluginConfigs.FirstOrDefault(o => o.ID == userPlugin.Metadata.ID);
|
2014-07-01 22:19:46 +08:00
|
|
|
|
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
|
|
|
|
|
{
|
2014-07-05 23:10:34 +08:00
|
|
|
|
//need to stop the loading animation
|
2014-12-26 22:51:04 +08:00
|
|
|
|
PluginManager.API.StopLoadingBar();
|
2014-07-01 22:19:46 +08:00
|
|
|
|
}
|
2015-02-04 23:16:41 +08:00
|
|
|
|
else
|
2014-01-11 15:02:17 +08:00
|
|
|
|
{
|
2015-02-04 23:16:41 +08:00
|
|
|
|
plugins.Add(userPlugin);
|
|
|
|
|
}
|
2014-01-11 15:02:17 +08:00
|
|
|
|
}
|
2015-02-04 23:16:41 +08:00
|
|
|
|
|
|
|
|
|
return plugins;
|
2014-01-11 15:02:17 +08:00
|
|
|
|
}
|
2014-01-03 18:16:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|