Hishop.Plugins/ConfigablePlugin.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace Hishop.Plugins
{
using System;
using System.Collections.Specialized;
using System.Reflection;
using System.Xml;
public abstract class ConfigablePlugin
{
private const string CastMsg = "{0}的输入格式不正确,请按正确格式输入";
private const string RequiredMsg = "{0}为必填项";
protected ConfigablePlugin()
{
}
private static void AppendAttrubiteNode(XmlDocument doc, ConfigElementAttribute att, PropertyInfo property)
{
XmlNode newChild = doc.CreateElement("att");
XmlAttribute node = doc.CreateAttribute("Property");
node.Value = property.Name;
newChild.Attributes.Append(node);
XmlAttribute attribute2 = doc.CreateAttribute("Name");
attribute2.Value = string.IsNullOrEmpty(att.Name) ? property.Name : att.Name;
newChild.Attributes.Append(attribute2);
XmlAttribute attribute3 = doc.CreateAttribute("Description");
attribute3.Value = att.Description;
newChild.Attributes.Append(attribute3);
XmlAttribute attribute4 = doc.CreateAttribute("Nullable");
attribute4.Value = att.Nullable.ToString();
newChild.Attributes.Append(attribute4);
XmlAttribute attribute5 = doc.CreateAttribute("InputType");
attribute5.Value = ((int) att.InputType).ToString();
newChild.Attributes.Append(attribute5);
if ((att.Options != null) && (att.Options.Length > 0))
{
XmlNode node2 = doc.CreateElement("Options");
foreach (string str in att.Options)
{
XmlNode node3 = doc.CreateElement("Item");
node3.InnerText = str;
node2.AppendChild(node3);
}
newChild.AppendChild(node2);
}
doc.SelectSingleNode("xml").AppendChild(newChild);
}
public virtual ConfigData GetConfigData(NameValueCollection form)
{
ConfigData data = new ConfigData {
NeedProtect = this.NeedProtect
};
PropertyInfo[] properties = base.GetType().GetProperties();
foreach (PropertyInfo info in properties)
{
string str = form[info.Name] ?? "false";
ConfigElementAttribute customAttribute = (ConfigElementAttribute) Attribute.GetCustomAttribute(info, typeof(ConfigElementAttribute));
if (customAttribute != null)
{
后面还有 67 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
