htmlattributecollection.cs

来自「破解的飞信源代码」· CS 代码 · 共 69 行

CS
69
字号
namespace Imps.Utils.TagParser
{
    using System;
    using System.Collections;
    using System.Reflection;

    public class HtmlAttributeCollection : CollectionBase
    {
        private TagElement mElement;

        public HtmlAttributeCollection()
        {
            this.mElement = null;
        }

        internal HtmlAttributeCollection(TagElement element)
        {
            this.mElement = element;
        }

        public int Add(TagAttribute attribute)
        {
            return base.List.Add(attribute);
        }

        public TagAttribute FindByName(string name)
        {
            if (this.IndexOf(name) == -1)
            {
                return null;
            }
            return this[this.IndexOf(name)];
        }

        public int IndexOf(string name)
        {
            for (int i = 0; i < base.List.Count; i++)
            {
                if (this[i].Name.ToLower().Equals(name.ToLower()))
                {
                    return i;
                }
            }
            return -1;
        }

        public TagAttribute this[string name]
        {
            get
            {
                return this.FindByName(name);
            }
        }

        public TagAttribute this[int index]
        {
            get
            {
                return (TagAttribute) base.List[index];
            }
            set
            {
                base.List[index] = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?