示例#1
0
        /// <summary>
        /// 解析XElement为register对象
        /// </summary>
        /// <param name="xElem">配置文件中的结点XElement</param>
        /// <returns>解析得到的register对象</returns>
        private register XElementToRegister(XElement xElem)
        {
            if (xElem == null) return null;
            XAttribute name = xElem.Attribute(ATTRI_NAME);
            var Name = name != null ? name.Value : "";
            var Type = this.GetAssType(xElem.Attribute(ATTRI_TYPE).Value);
            var MapTo = this.GetAssType(xElem.Attribute(ATTRI_MAPTO).Value);
            register ret = new register { Name = Name, Type = this.GetAssType(xElem.Attribute(ATTRI_TYPE).Value), MapTo = this.GetAssType(xElem.Attribute(ATTRI_MAPTO).Value) };
            XElement c = xElem.Element(XName.Get(CFG_CSTRNODE));

            if (c != null) ret.constructor = this.AddParamsToItem(c, new constructor()) as constructor;

            xElem.Elements(XName.Get(CFG_MTHDNODE)).ToList().ForEach(s =>
            {
                ret.AddMethod(this.AddParamsToItem(s, new method { Name = s.Attribute(ATTRI_NAME).Value }) as method);
            });

            xElem.Elements(XName.Get(CFG_PROPNODE)).ToList().ForEach(p =>
            {
                ret.AddProperty(new property { dependon = p.Attribute(ATTRI_DEPEND).Value, Name = p.Attribute(ATTRI_NAME).Value });
            });

            return ret;
        }
示例#2
0
 public void Remove(register item)
 {
     registers.Remove(registers.Where(w => w.Value == item).First().Key);
 }
示例#3
0
 public void Remove(register item)
 {
     registers.Remove(registers.Where(w => w.Value == item).First().Key);
 }
示例#4
0
 public void Add(register item)
 {
     registers.Add(registers.Count, item);
 }
示例#5
0
 public void Add(register item)
 {
     registers.Add(registers.Count, item);
 }