コード例 #1
0
        /// <summary>
        /// 从目录中读取dll和exe中的插件,加载到插件仓库中
        /// </summary>
        /// <param name="pluginDir">需要管理插件的程序所在的目录</param>
        /// <param name="assemblyFileFilter">插件程序集文件过滤条件,只加载满足此文件过滤条件的插件文件</param>
        public static void ReloadPluginLib(this TreeView treeViewCmds, string pluginDir = null, string assemblyFileFilter = null)
        {
            var filePaths = PluginHelper.GetAssemblyFiles(pluginDir, assemblyFileFilter); //获取全部dll和exe文件路径
            var treeNodes = CreateCommandAssemblyTreeNodes(filePaths);                    //获得dll和exe中的插件信息,生成树状节点

            treeViewCmds.Nodes.Clear();
            treeViewCmds.Nodes.AddRange(treeNodes.ToArray());
            treeViewCmds.ExpandAll();
        }