mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 19:49:15 +08:00
96b6832dff
Much faster. ApplyPluginLanguages is 10 times faster now. 7ms vs 100ms.
28 lines
850 B
C#
28 lines
850 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Wox.Core.Plugin;
|
|
using Wox.Plugin;
|
|
|
|
namespace Wox.Core
|
|
{
|
|
internal class AssemblyHelper
|
|
{
|
|
public static List<KeyValuePair<PluginPair, T>> LoadPluginInterfaces<T>() where T : class
|
|
{
|
|
List<KeyValuePair<PluginPair, T>> results = new List<KeyValuePair<PluginPair, T>>();
|
|
foreach (PluginPair pluginPair in PluginManager.AllPlugins)
|
|
{
|
|
//need to load types from AllPlugins
|
|
//PluginInitContext is only available in this instance
|
|
T type = pluginPair.Plugin as T;
|
|
if (type != null)
|
|
{
|
|
results.Add(new KeyValuePair<PluginPair, T>(pluginPair,type));
|
|
}
|
|
}
|
|
return results;
|
|
}
|
|
}
|
|
}
|