Exemplo n.º 1
0
        internal Member(HtmlNodeCollection nodes)
        {
            var firstNode = nodes.First();

            _encEmail  = Regex.Replace(firstNode.Attributes["name"].Value, "_\\w*$", "");
            this.Email = HttpUtility.UrlDecode(_encEmail);

            foreach (var prop in _props.Unignored())
            {
                var name     = String.Format("{0}_{1}", _encEmail, prop.Name.ToLower());
                var thisNode = nodes.SingleOrDefault(n => n.Attributes["name"].Value == name);
                if (thisNode != null)
                {
                    var val = thisNode.Attributes["value"].Value;
                    if (prop.PropertyType == typeof(string))
                    {
                        prop.SetValue(this, val);
                    }
                    else if (prop.PropertyType == typeof(bool))
                    {
                        prop.SetValue(this, val == "on");
                    }
                }
            }

            if (this.NoMail)
            {
                this.NoMailReason = NoMailReason.Unknown;
                string name = _encEmail + "_nomail";
                var    node = nodes.SingleOrDefault(n => n.Attributes["name"].Value == name);
                if (node != null)
                {
                    string reason = node.NextSibling.InnerText;
                    switch (reason)
                    {
                    case "[A]":
                        this.NoMailReason = NoMailReason.Administrator;
                        break;

                    case "[B]":
                        this.NoMailReason = NoMailReason.Bounce;
                        break;

                    case "[U]":
                        this.NoMailReason = NoMailReason.User;
                        break;
                    }
                }
            }
        }