7
/// Parent object containing details of a photos comments.
9
internal class PhotoComments
11
static private string _photoId;
13
static private Comment[] _comments;
15
static internal Comment[] GetComments(XmlNode node)
17
if( node.Attributes["photo_id"] != null )
18
_photoId = node.Attributes["photo_id"].Value;
19
XmlNodeList nodes = node.SelectNodes("comment");
20
_comments = new Comment[nodes.Count];
22
for(int i = 0; i < _comments.Length; i++)
24
_comments[i] = new Comment(_photoId, nodes[i]);
32
/// Contains the details of a comment made on a photo.
33
/// returned by the <see cref="Flickr.PhotosCommentsGetList"/> method.
37
private string _photoId;
38
private string _authorUserId;
39
private string _authorUserName;
40
private string _commentId;
41
private Uri _permaLink;
42
private DateTime _dateCreated;
43
private string _comment;
46
/// The photo id associated with this comment.
50
get { return _photoId; }
54
/// The comment id of this comment.
56
public string CommentId
58
get { return _commentId; }
62
/// The user id of the author of the comment.
64
public string AuthorUserId
66
get { return _authorUserId; }
70
/// The username (screen name) of the author of the comment.
72
public string AuthorUserName
74
get { return _authorUserName; }
78
/// The permalink to the comment on the photos web page.
82
get { return _permaLink; }
86
/// The date and time that the comment was created.
88
public DateTime DateCreated
90
get { return _dateCreated; }
94
/// The comment text (can contain HTML).
96
public string CommentHtml
98
get { return _comment; }
101
internal Comment(string photoId, XmlNode node)
105
if( node.Attributes["id"] != null )
106
_commentId = node.Attributes["id"].Value;
107
if( node.Attributes["author"] != null )
108
_authorUserId = node.Attributes["author"].Value;
109
if( node.Attributes["authorname"] != null )
110
_authorUserName = node.Attributes["authorname"].Value;
111
if( node.Attributes["permalink"] != null )
112
_permaLink = new Uri(node.Attributes["permalink"].Value);
113
if( node.Attributes["datecreate"] != null )
114
_dateCreated = Utils.UnixTimestampToDate(node.Attributes["datecreate"].Value);
115
if( node.InnerXml.Length > 0 )
116
_comment = node.InnerText;