void ITwentyThreeParsable.Load(System.Xml.XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (reader.LocalName != "replies")
            {
                UtilityMethods.CheckParsingException(reader); return;
            }

            reader.Read();
            if (reader.LocalName != "topic")
            {
                UtilityMethods.CheckParsingException(reader); return;
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "topic_id":
                    TopicId = reader.Value;
                    break;

                case "subject":
                    Subject = reader.Value;
                    break;

                case "group_id":
                    GroupId = reader.Value;
                    break;

                case "name":
                    GroupName = reader.Value;
                    break;

                case "author":
                    AuthorUserId = reader.Value;
                    break;

                case "authorname":
                    AuthorName = reader.Value;
                    break;

                case "is_pro":
                    AuthorIsPro = reader.Value == "1";
                    break;

                case "role":
                    AuthorRole = UtilityMethods.ParseRoleToMemberType(reader.Value);
                    break;

                case "iconserver":
                    GroupIconServer = reader.Value;
                    break;

                case "iconfarm":
                    GroupIconFarm = reader.Value;
                    break;

                case "author_iconfarm":
                    AuthorIconFarm = reader.Value;
                    break;

                case "author_iconserver":
                    AuthorIconServer = reader.Value;
                    break;

                case "can_edit":
                    CanEdit = reader.Value == "1";
                    break;

                case "can_delete":
                    CanDelete = reader.Value == "1";
                    break;

                case "can_reply":
                    CanReply = reader.Value == "1";
                    break;

                case "is_sticky":
                    IsSticky = reader.Value == "1";
                    break;

                case "is_locked":
                    IsLocked = reader.Value == "1";
                    break;

                case "datecreate":
                    DateCreated = UtilityMethods.UnixTimestampToDate(reader.Value);
                    break;

                case "datelastpost":
                    DateLastPost = UtilityMethods.UnixTimestampToDate(reader.Value);
                    break;

                case "total":
                    Total = reader.ReadContentAsInt();
                    break;

                case "pages":
                    Pages = reader.ReadContentAsInt();
                    break;

                case "page":
                    Page = reader.ReadContentAsInt();
                    break;

                case "per_page":
                    PerPage = reader.ReadContentAsInt();
                    break;

                case "group_alias":
                    GroupAlias = reader.Value == "" ? null : reader.Value;
                    break;

                case "author_is_deleted":
                    AuthorIsDeleted = reader.Value == "1";
                    break;

                case "author_path_alias":
                    AuthorPathAlias = reader.Value == "" ? null : reader.Value;
                    break;

                case "lastedit":
                    LastEdit = reader.Value == "" || reader.Value == "0"
                            ? (DateTime?)null
                            : UtilityMethods.UnixTimestampToDate(reader.Value);
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }

            reader.Read();

            if (reader.LocalName == "message")
            {
                Message = reader.ReadElementContentAsString();
                reader.Read();
            }

            while (reader.LocalName == "reply" && reader.NodeType == System.Xml.XmlNodeType.Element)
            {
                var reply = new TopicReply();
                ((ITwentyThreeParsable)reply).Load(reader);
                Add(reply);
            }
        }
Example #2
0
        void ITwentyThreeParsable.Load(System.Xml.XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (reader.LocalName != "reply")
            {
                UtilityMethods.CheckParsingException(reader); return;
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "id":
                    ReplyId = reader.Value;
                    break;

                case "author":
                    AuthorUserId = reader.Value;
                    break;

                case "authorname":
                    AuthorName = reader.Value;
                    break;

                case "is_pro":
                    AuthorIsPro = reader.Value == "1";
                    break;

                case "role":
                    AuthorRole = UtilityMethods.ParseRoleToMemberType(reader.Value);
                    break;

                case "iconserver":
                    AuthorIconServer = reader.Value;
                    break;

                case "iconfarm":
                    AuthorIconFarm = reader.Value;
                    break;

                case "can_edit":
                    CanEdit = reader.Value == "1";
                    break;

                case "can_delete":
                    CanDelete = reader.Value == "1";
                    break;

                case "datecreate":
                    DateCreated = UtilityMethods.UnixTimestampToDate(reader.Value);
                    break;

                case "lastedit":
                    DateLastEdited = UtilityMethods.UnixTimestampToDate(reader.Value);
                    break;

                case "author_is_deleted":
                    AuthorIsDeleted = reader.Value == "1";
                    break;

                case "author_path_alias":
                    AuthorPathAlias = reader.Value == "" ? null : reader.Value;
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }

            reader.Read();

            if (reader.LocalName == "message")
            {
                Message = reader.ReadElementContentAsString();
            }

            reader.Skip();
        }