コード例 #1
0
        internal override void Parse(XElement element)
        {
            Id = element.ElementAsLong("id");

            var bookElement = element.Element("book");

            if (bookElement != null)
            {
                Book = new BookSummary();
                Book.Parse(bookElement);
            }

            Rating         = element.ElementAsInt("rating");
            Votes          = element.ElementAsInt("votes");
            IsSpoiler      = element.ElementAsBool("spoiler_flag");
            SpoilersState  = element.ElementAsString("spoilers_state");
            Shelves        = element.ParseChildren <ReviewShelf>("shelves", "shelf");
            RecommendedFor = element.ElementAsString("recommended_for");
            RecommendedBy  = element.ElementAsString("recommended_by");
            DateStarted    = element.ElementAsDateTime("started_at");
            DateRead       = element.ElementAsDateTime("read_at");
            DateAdded      = element.ElementAsDateTime("date_added");
            DateUpdated    = element.ElementAsDateTime("date_updated");
            ReadCount      = element.ElementAsInt("read_count");
            Body           = element.ElementAsString("body");
            CommentsCount  = element.ElementAsInt("comments_count");
            Url            = element.ElementAsString("url");
            Owned          = element.ElementAsInt("owned");
        }
コード例 #2
0
        internal override void Parse(XElement element)
        {
            Id            = element.ElementAsLong("id");
            Header        = element.ElementAsString("header");
            Status        = element.ElementAsString("status");
            UpdatedAt     = element.ElementAsDateTime("updated_at");
            RatingsCount  = element.ElementAsInt("ratings_count");
            CommentsCount = element.ElementAsInt("comments_count");
            OldStatus     = element.ElementAsString("old_status");
            UserId        = element.ElementAsNullableLong("user_id");
            LikesCount    = element.ElementAsInt("likes_count");
            Liked         = element.ElementAsBool("liked");
            CreatedAt     = element.ElementAsDateTime("created_at");
            ReviewId      = element.ElementAsNullableLong("review_id");

            var review = element.Element("review");

            if (review != null)
            {
                Review = new Review();
                Review.Parse(review);
            }

            var book = element.Element("book");

            if (book != null)
            {
                Book = new BookSummary();
                Book.Parse(book);
            }

            var comments = element.Element("comments");

            if (comments != null)
            {
                Comments = new PaginatedList <Comment>();
                Comments.Parse(comments);
            }

            var user = element.Element("user");

            if (user != null)
            {
                User = new Actor();
                User.Parse(user);
            }
        }
コード例 #3
0
        internal override void Parse(XElement element)
        {
            UpdateType = element.AttributeAsString("type");
            Id         = element.ElementAsInt("id");
            ActionText = element.ElementAsString("action_text");
            Link       = element.ElementAsString("link");
            ImageUrl   = element.ElementAsString("image_url");
            UpdatedAt  = element.ElementAsDateTime("updated_at");
            Body       = element.ElementAsString("body");

            var user = element.Element("actor");

            if (user != null)
            {
                User = new Actor();
                User.Parse(user);
            }

            var action = element.Element("action");

            if (action != null)
            {
                Action = new Action();
                Action.Parse(action);
            }

            var @object = element.Element("object");

            var status = @object?.Element("read_status");

            if (status != null)
            {
                ReadStatus = new ReadStatus();
                ReadStatus.Parse(status);
            }

            var book = @object?.Element("book");

            if (book != null)
            {
                Book = new BookSummary();
                Book.Parse(book);
            }
        }
コード例 #4
0
        internal override void Parse(XElement element)
        {
            Id         = element.ElementAsLong("id");
            CreatedAt  = element.ElementAsDateTime("created_at");
            Message    = element.ElementAsString("message");
            LikesCount = element.ElementAsInt("likes_count");

            var book = element.Element("book");

            if (book != null)
            {
                Book = new BookSummary();
                Book.Parse(book);
            }

            var fromUser = element.Element("from_user");

            if (fromUser != null)
            {
                FromUser = new Actor();
                FromUser.Parse(fromUser);
            }

            var toUser = element.Element("to_user");

            if (toUser != null)
            {
                ToUser = new Actor();
                ToUser.Parse(toUser);
            }

            var comments = element.Element("comments");

            if (comments != null)
            {
                Comments = new PaginatedList <Comment>();
                Comments.Parse(comments);
            }
        }
コード例 #5
0
ファイル: UserStatus.cs プロジェクト: Wise-team3/BookBot
        internal override void Parse(XElement element)
        {
            Id            = element.ElementAsLong("id");
            Header        = element.ElementAsString("header");
            Body          = element.ElementAsString("body");
            CreatedAt     = element.ElementAsDateTime("created_at");
            UpdatedAt     = element.ElementAsDateTime("updated_at");
            LikesCount    = element.ElementAsInt("likes_count");
            CommentsCount = element.ElementAsInt("comments_count");
            Liked         = element.ElementAsBool("liked");
            Page          = element.ElementAsInt("page");
            Percent       = element.ElementAsInt("percent");
            WorkId        = element.ElementAsLong("work_id");

            var actor = element.Element("user");

            if (actor != null)
            {
                User = new Actor();
                User.Parse(actor);
            }

            var book = element.Element("book");

            if (book != null)
            {
                Book = new BookSummary();
                Book.Parse(book);
            }

            var comments = element.Element("comments");

            if (comments != null)
            {
                Comments = new PaginatedList <Comment>();
                Comments.Parse(comments);
            }
        }
コード例 #6
0
        internal override void Parse(XElement element)
        {
            Id      = element.ElementAsLong("id");
            OwnerId = element.ElementAsLong("current_owner_id");
            OriginalPurchaseDate     = element.ElementAsDateTime("original_purchase_date");
            OriginalPurchaseLocation = element.ElementAsString("original_purchase_location");
            Condition = element.ElementAsString("condition");

            var review = element.Element("review");

            if (review != null)
            {
                Review = new Review();
                Review.Parse(review);
            }

            var book = element.Element("book");

            if (book != null)
            {
                Book = new BookSummary();
                Book.Parse(book);
            }
        }
コード例 #7
0
ファイル: Review.cs プロジェクト: yceron/goodreads-dotnet
        internal override void Parse(XElement element)
        {
            Id = element.ElementAsInt("id");

            var bookElement = element.Element("book");
            if (bookElement != null)
            {
                Book = new BookSummary();
                Book.Parse(bookElement);
            }

            Rating = element.ElementAsInt("rating");
            Votes = element.ElementAsInt("votes");
            IsSpoiler = element.ElementAsBool("spoiler_flag");
            SpoilersState = element.ElementAsString("spoilers_state");
            Shelves = element.ParseChildren<ReviewShelf>("shelves", "shelf");
            RecommendedFor = element.ElementAsString("recommended_for");
            RecommendedBy = element.ElementAsString("recommended_by");
            DateStarted = element.ElementAsDateTime("started_at");
            DateRead = element.ElementAsDateTime("read_at");
            DateAdded = element.ElementAsDateTime("date_added");
            DateUpdated = element.ElementAsDateTime("date_updated");
            ReadCount = element.ElementAsInt("read_count");
            Body = element.ElementAsString("body");
            CommentsCount = element.ElementAsInt("comments_count");
            Url = element.ElementAsString("url");
            Owned = element.ElementAsInt("owned");
        }