コード例 #1
0
        // Public

        public UserModel(string name, int threadsCount)
        {
            this.Name          = name;
            this._threadsCount = threadsCount;
            IncludeFilter      = new IncludeFilterModel();
            ExcludeFilter      = new ExcludeFilterModel();
        }
コード例 #2
0
        public static FilterModel FromXmlElement(XmlElement xe)
        {
            if (xe == null)
            {
                throw new BadXmlException();
            }

            FilterModel result = null;

            if (xe.Name == ConfigConsts.IncludeFilterTag)
            {
                result = new IncludeFilterModel();
            }
            else if (xe.Name == ConfigConsts.ExcludeFilterTag)
            {
                result = new ExcludeFilterModel();
            }
            else
            {
                throw new BadXmlException();
            }

            foreach (XmlElement method in xe.ChildNodes)
            {
                if (method.Name == ConfigConsts.AndFilterMethodTag)
                {
                    foreach (XmlElement itm in method.ChildNodes)
                    {
                        result.AndList.Add(itm.InnerText);
                    }
                }
                else if (method.Name == ConfigConsts.OrFilterMethodTag)
                {
                    foreach (XmlElement itm in method.ChildNodes)
                    {
                        result.OrList.Add(itm.InnerText);
                    }
                }
                else
                {
                    throw new BadXmlException();
                }
            }

            return(result);
        }