예제 #1
0
        /// <summary>
        /// Parses the basic information from the XML response (ID, name, image links, Goodreads link).
        /// </summary>
        /// <param name="xmlAuthorBasic">The XML node containing the information.</param>
        /// <returns>The parsed <see cref="Author"/>.</returns>
        internal static Author ParseAuthorBasic(XElement xmlAuthorBasic)
        {
            var author = new Author();
            author.Name = xmlAuthorBasic.Element("name").Value;
            author.ID = xmlAuthorBasic.Element("id").IntValue();
            author.Link = xmlAuthorBasic.Element("link").Value;
            author.ImageLink = xmlAuthorBasic.Element("image_url").Value;
            author.ImageSmallLink = xmlAuthorBasic.Element("small_image_url").Value;

            return author;
        }
예제 #2
0
        internal static Author ParseAuthor(XElement xmlAuthor)
        {
            var author = new Author();
            author = ParseAuthorBasic(xmlAuthor);
            author.FansCount = xmlAuthor.Element("fans_count").IntValue();
            author.About = xmlAuthor.Element("about").Value;
            // TODO: parse influences
            author.WorksCount = xmlAuthor.Element("works_count").IntValue();
            author.Gender = xmlAuthor.Element("gender").Value.ToGender();
            author.Hometown = xmlAuthor.Element("hometown").Value;
            author.DateOfBirth = DateTime.Parse(xmlAuthor.Element("born_at").Value);
            author.DateOfDeath = DateTime.Parse(xmlAuthor.Element("died_at").Value);

            return author;
        }