mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
Refactoring
This commit is contained in:
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.Plugin;
|
||||
//using Wox.Plugin.SystemPlugins;
|
||||
|
||||
namespace Wox.Core.Plugin
|
||||
{
|
||||
@@ -35,12 +34,6 @@ namespace Wox.Core.Plugin
|
||||
Metadata = metadata
|
||||
};
|
||||
|
||||
//var sys = pair.Plugin as BaseSystemPlugin;
|
||||
//if (sys != null)
|
||||
//{
|
||||
// sys.PluginDirectory = metadata.PluginDirectory;
|
||||
//}
|
||||
|
||||
plugins.Add(pair);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using Wox.Core.Exception;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Http;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.Plugin;
|
||||
@@ -92,12 +93,19 @@ namespace Wox.Core.Plugin
|
||||
foreach (PluginPair pluginPair in plugins)
|
||||
{
|
||||
PluginPair pair = pluginPair;
|
||||
ThreadPool.QueueUserWorkItem(o => pair.Plugin.Init(new PluginInitContext()
|
||||
ThreadPool.QueueUserWorkItem(o =>
|
||||
{
|
||||
CurrentPluginMetadata = pair.Metadata,
|
||||
Proxy = HttpProxy.Instance,
|
||||
API = API
|
||||
}));
|
||||
using (new Timeit("Init Plugin: " + pair.Metadata.Name))
|
||||
{
|
||||
pair.Plugin.Init(new PluginInitContext()
|
||||
{
|
||||
CurrentPluginMetadata = pair.Metadata,
|
||||
Proxy = HttpProxy.Instance,
|
||||
API = API
|
||||
});
|
||||
}
|
||||
})
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +134,11 @@ namespace Wox.Core.Plugin
|
||||
return plugins.Any(o => o.Metadata.PluginType == PluginType.User && o.Metadata.ActionKeyword == query.ActionName);
|
||||
}
|
||||
|
||||
public static bool IsSystemPlugin(PluginMetadata metadata)
|
||||
{
|
||||
return metadata.ActionKeyword == "*";
|
||||
}
|
||||
|
||||
public static void ActivatePluginDebugger(string path)
|
||||
{
|
||||
DebuggerMode = path;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
||||
{
|
||||
public class SystemPluginQueryDispatcher : IQueryDispatcher
|
||||
{
|
||||
private IEnumerable<PluginPair> allSytemPlugins = PluginManager.AllPlugins.Where(o => o.Metadata.ActionKeyword == "*");
|
||||
private IEnumerable<PluginPair> allSytemPlugins = PluginManager.AllPlugins.Where(o => PluginManager.IsSystemPlugin(o.Metadata));
|
||||
|
||||
public void Dispatch(Query query)
|
||||
{
|
||||
@@ -36,4 +36,4 @@ namespace Wox.Core.Plugin.QueryDispatcher
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user