Example #1
0
        /// <summary>
        /// 注册扩展处理程序
        /// </summary>
        /// <param name="extendName">扩展名称,而且也是访问地址的名称。如扩展名称为:ext,那么可使用/ext.sh访问该扩展插件</param>
        /// <param name="getReqHandler">委托PluginHandler<CmsContext,string>的实例</param>
        /// <param name="postReqHandler">委托PluginHandler<CmsContext,string>的实例</param>
        /// <returns></returns>
        public bool Register(IPlugin plugin,
                             PluginHandler <T> reqHandler)
        {
            Type type = plugin.GetType();
            PluginPackAttribute attr = PluginUtil.GetAttribute(plugin);
            string indent            = attr.WorkIndent;

            if (reqHandler == null || reqHandlers.Keys.Contains(indent))
            {
                return(false);
            }

            if (reqHandler != null)
            {
                reqHandlers.Add(indent, reqHandler);
            }

            return(true);
        }
Example #2
0
 public PluginPackAttribute GetAttribute(IPlugin plugin)
 {
     return(PluginUtil.GetAttribute(plugin));
 }