Hishop.Plugins/PluginContainer.cs

(开头部分) 10KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace Hishop.Plugins
{
    using System;
    using System.Collections;
    using System.Globalization;
    using System.IO;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Web.Caching;
    using System.Xml;
    using System.Web;

    public abstract class PluginContainer
    {
        //protected static volatile Cache pluginCache = HttpRuntime.Cache;
        protected static Cache pluginCache = HttpRuntime.Cache;

        protected PluginContainer()
        {
            pluginCache.Remove(this.IndexCacheKey);
            pluginCache.Remove(this.TypeCacheKey);
        }

        private void AddPlugin(Type t, string filename, XmlDocument catalog, XmlNode mapNode)
        {
            XmlNode newChild = mapNode.SelectSingleNode(t.BaseType.Name);
            if (newChild == null)
            {
                newChild = catalog.CreateElement(t.BaseType.Name);
                mapNode.AppendChild(newChild);
            }
            XmlNode node2 = catalog.CreateElement("item");
            XmlAttribute node = catalog.CreateAttribute("identity");
            node.Value = t.FullName.ToLower();
            node2.Attributes.Append(node);
            XmlAttribute attribute2 = catalog.CreateAttribute("file");
            attribute2.Value = filename;
            node2.Attributes.Append(attribute2);
            PluginAttribute customAttribute = (PluginAttribute)Attribute.GetCustomAttribute(t, typeof(PluginAttribute));
            if (customAttribute != null)
            {
                XmlAttribute attribute4 = catalog.CreateAttribute("name");
                attribute4.Value = customAttribute.Name;
                node2.Attributes.Append(attribute4);
                XmlAttribute attribute5 = catalog.CreateAttribute("seq");
                attribute5.Value = (customAttribute.Sequence > 0) ? customAttribute.Sequence.ToString(CultureInfo.InvariantCulture) : "0";
                node2.Attributes.Append(attribute5);
                ConfigablePlugin plugin = Activator.CreateInstance(t) as ConfigablePlugin;
                XmlAttribute attribute6 = catalog.CreateAttribute("logo");
                if (string.IsNullOrEmpty(plugin.Logo) || (plugin.Logo.Trim().Length == 0))
                {
                    attribute6.Value = "";
                }
                else
                {
                    attribute6.Value = this.PluginVirtualPath + "/images/" + plugin.Logo.Trim();
                }
                node2.Attributes.Append(attribute6);
                XmlAttribute attribute7 = catalog.CreateAttribute("shortDescription");
                attribute7.Value = plugin.ShortDescription;
后面还有 199 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。