public static List <PluginBase> GetEnabledPluginMetadatas <T>() where T : PluginBase { var dict = PluginManagerCache.GetPluginSortedList(); return(dict.Values.Where( pluginInfo => pluginInfo.Plugin != null && !pluginInfo.IsDisabled && pluginInfo.Plugin is T ).Select(pluginInfo => pluginInfo.Plugin).ToList()); }
public static IMetadata GetMetadata(string pluginId) { var dict = PluginManagerCache.GetPluginSortedList(); if (dict.TryGetValue(pluginId, out PluginInstance pluginInfo)) { return(pluginInfo.Plugin); } return(null); }
public static List <PluginInfo> GetEnabledPluginInfoList <T1, T2>() { var dict = PluginManagerCache.GetPluginSortedList(); return(dict.Values.Where( pluginInfo => pluginInfo.Plugin != null && !pluginInfo.IsDisabled && (pluginInfo.Plugin is T1 || pluginInfo.Plugin is T2) ) .ToList()); }
public static bool IsExists(string pluginId) { if (string.IsNullOrEmpty(pluginId)) { return(false); } var dict = PluginManagerCache.GetPluginSortedList(); return(dict.ContainsKey(pluginId)); }
public static PluginInstance GetPluginInfo(string pluginId) { if (string.IsNullOrEmpty(pluginId)) { return(null); } var dict = PluginManagerCache.GetPluginSortedList(); return(dict.TryGetValue(pluginId, out var pluginInfo) ? pluginInfo : null); }
public static List <T> GetEnabledFeatures <T>() where T : PluginBase { var dict = PluginManagerCache.GetPluginSortedList(); var pluginInfos = dict.Values.Where( pluginInfo => pluginInfo.Plugin != null && !pluginInfo.IsDisabled && pluginInfo.Plugin is T ) .ToList(); return(pluginInfos.Select(pluginInfo => (T)pluginInfo.Plugin).ToList()); }
public static PluginBase GetPlugin(string pluginId) { if (string.IsNullOrEmpty(pluginId)) { return(null); } var dict = PluginManagerCache.GetPluginSortedList(); if (dict.TryGetValue(pluginId, out PluginInstance pluginInfo)) { return(pluginInfo.Plugin); } return(null); }
public static PluginInfo GetPluginInfo(string pluginId) { if (string.IsNullOrEmpty(pluginId)) { return(null); } var dict = PluginManagerCache.GetPluginSortedList(); PluginInfo pluginInfo; if (dict.TryGetValue(pluginId, out pluginInfo)) { return(pluginInfo); } return(null); }
public static IMetadata GetEnabledPluginMetadata <T>(string pluginId) where T : PluginBase { if (string.IsNullOrEmpty(pluginId)) { return(null); } var dict = PluginManagerCache.GetPluginSortedList(); var isGet = dict.TryGetValue(pluginId, out PluginInstance pluginInfo); if (isGet && pluginInfo.Plugin != null && !pluginInfo.IsDisabled && pluginInfo.Plugin is T) { return(pluginInfo.Plugin); } return(null); }
public static T GetEnabledFeature <T>(string pluginId) where T : PluginBase { if (string.IsNullOrEmpty(pluginId)) { return(default(T)); } var dict = PluginManagerCache.GetPluginSortedList(); PluginInfo pluginInfo; var isGet = dict.TryGetValue(pluginId, out pluginInfo); if (isGet && pluginInfo.Plugin != null && !pluginInfo.IsDisabled && pluginInfo.Plugin is T) { return((T)pluginInfo.Plugin); } return(default(T)); }
public static Dictionary <string, string> GetPluginIdAndVersionDict() { var dict = PluginManagerCache.GetPluginSortedList(); var retval = new Dictionary <string, string>(); foreach (var pluginId in dict.Keys) { var pluginInfo = dict[pluginId]; if (pluginInfo.Plugin != null) { retval[pluginId] = pluginInfo.Plugin.Version; } else { retval[pluginId] = string.Empty; } } return(retval); }
public static PluginInstance GetPluginInfo <T>() where T : PluginBase { var dict = PluginManagerCache.GetPluginSortedList(); return(dict.Values.Where(instance => instance.Plugin is T).FirstOrDefault(instance => instance.IsRunnable && !instance.IsDisabled)); }