Exemplo n.º 1
0
        /// <summary>
        /// 通过插件类型和状态获取当前所有的插件
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="type">插件类型</param>
        /// <param name="state">插件状态</param>
        /// <returns>满足条件的所有插件</returns>
        public Dictionary <T, IPlugin> GetPluginsByType <T>(PluginType type = PluginType.SpfDataParse, PluginState state = PluginState.Normal) where T : AbstractPluginInfo
        {
            var plugin = state == PluginState.None ? Plugins.Where(p => p.Key.PluginType == type && p.Key is T) :
                         Plugins.Where(p => p.Key.PluginType == type && p.Key is T && state.HasFlag(p.Key.State));

            return(plugin.ToDictionary(x => (T)x.Key, x => x.Value));
        }