Logo Search packages:      
Sourcecode: f-spot version File versions  Download package

Comments.cs

using System;
using System.Xml;

namespace FlickrNet
{
      /// <summary>
      /// Parent object containing details of a photos comments.
      /// </summary>
00009       internal class PhotoComments
      {
            static private string _photoId;

            static private Comment[] _comments;

            static internal Comment[] GetComments(XmlNode node)
            {
                  if( node.Attributes["photo_id"] != null )
                        _photoId = node.Attributes["photo_id"].Value;
                  XmlNodeList nodes = node.SelectNodes("comment");
                  _comments = new Comment[nodes.Count];

                  for(int i = 0; i < _comments.Length; i++)
                  {
                        _comments[i] = new Comment(_photoId, nodes[i]);
                  }

                  return _comments;
            }
      }

      /// <summary>
      /// Contains the details of a comment made on a photo.
      /// returned by the <see cref="Flickr.PhotosCommentsGetList"/> method.
      /// </summary>
00035       public class Comment
      {
            private string _photoId;
            private string _authorUserId;
            private string _authorUserName;
            private string _commentId;
            private Uri _permaLink;
            private DateTime _dateCreated;
            private string _comment;

            /// <summary>
            /// The photo id associated with this comment.
            /// </summary>
            public string PhotoId
00049             {
                  get { return _photoId; }
            }

            /// <summary>
            /// The comment id of this comment.
            /// </summary>
            public string CommentId
00057             {
                  get { return _commentId; }
            }

            /// <summary>
            /// The user id of the author of the comment.
            /// </summary>
            public string AuthorUserId
00065             {
                  get { return _authorUserId; }
            }

            /// <summary>
            /// The username (screen name) of the author of the comment.
            /// </summary>
            public string AuthorUserName
00073             {
                  get { return _authorUserName; }
            }

            /// <summary>
            /// The permalink to the comment on the photos web page.
            /// </summary>
            public Uri Permalink
00081             {
                  get { return _permaLink; }
            }

            /// <summary>
            /// The date and time that the comment was created.
            /// </summary>
            public DateTime DateCreated
00089             {
                  get { return _dateCreated; }
            }

            /// <summary>
            /// The comment text (can contain HTML).
            /// </summary>
            public string CommentHtml
00097             {
                  get { return _comment; }
            }

            internal Comment(string photoId, XmlNode node)
            {
                  _photoId = photoId;

                  if( node.Attributes["id"] != null )
                        _commentId = node.Attributes["id"].Value;
                  if( node.Attributes["author"] != null )
                        _authorUserId = node.Attributes["author"].Value;
                  if( node.Attributes["authorname"] != null )
                        _authorUserName = node.Attributes["authorname"].Value;
                  if( node.Attributes["permalink"] != null )
                        _permaLink = new Uri(node.Attributes["permalink"].Value);
                  if( node.Attributes["datecreate"] != null )
                        _dateCreated = Utils.UnixTimestampToDate(node.Attributes["datecreate"].Value);
                  if( node.InnerXml.Length > 0 )
                        _comment = node.InnerText;
            }
      }
}

Generated by  Doxygen 1.6.0   Back to index