~ubuntu-branches/debian/squeeze/f-spot/squeeze

« back to all changes in this revision

Viewing changes to extensions/Exporters/FlickrExport/FlickrNet/Comments.cs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane, Mirco Bauer, Iain Lane
  • Date: 2009-02-07 20:23:32 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20090207202332-oc93rfjo1st0571s
Tags: 0.5.0.3-2
[ Mirco Bauer]
* Upload to unstable.
* debian/control:
  + Lowered GNOME# build-deps to 2.0 ABI as that transition didn't happen
    yet in unstable.

[ Iain Lane ]
* debian/patches/svn-r4545_locales-import.dpatch: Patch backported from SVN
  trunk revision 4545 - initialize the translation catalog earlier (LP: #293305)
  (Closes: #514457). Thanks to Florian Heinle for finding the patch and to
  Chris Coulson for preparing the update.
* debian/control: Build-depend on libmono-dev (>= 1.2.4) to match configure
  checks.
* debian/rules: Pass CSC=/usr/bin/csc to configure for gio-sharp to fix FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Xml;
 
3
 
 
4
namespace FlickrNet
 
5
{
 
6
        /// <summary>
 
7
        /// Parent object containing details of a photos comments.
 
8
        /// </summary>
 
9
        internal class PhotoComments
 
10
        {
 
11
                static private string _photoId;
 
12
 
 
13
                static private Comment[] _comments;
 
14
 
 
15
                static internal Comment[] GetComments(XmlNode node)
 
16
                {
 
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];
 
21
 
 
22
                        for(int i = 0; i < _comments.Length; i++)
 
23
                        {
 
24
                                _comments[i] = new Comment(_photoId, nodes[i]);
 
25
                        }
 
26
 
 
27
                        return _comments;
 
28
                }
 
29
        }
 
30
 
 
31
        /// <summary>
 
32
        /// Contains the details of a comment made on a photo.
 
33
        /// returned by the <see cref="Flickr.PhotosCommentsGetList"/> method.
 
34
        /// </summary>
 
35
        public class Comment
 
36
        {
 
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;
 
44
 
 
45
                /// <summary>
 
46
                /// The photo id associated with this comment.
 
47
                /// </summary>
 
48
                public string PhotoId
 
49
                {
 
50
                        get { return _photoId; }
 
51
                }
 
52
 
 
53
                /// <summary>
 
54
                /// The comment id of this comment.
 
55
                /// </summary>
 
56
                public string CommentId
 
57
                {
 
58
                        get { return _commentId; }
 
59
                }
 
60
 
 
61
                /// <summary>
 
62
                /// The user id of the author of the comment.
 
63
                /// </summary>
 
64
                public string AuthorUserId
 
65
                {
 
66
                        get { return _authorUserId; }
 
67
                }
 
68
 
 
69
                /// <summary>
 
70
                /// The username (screen name) of the author of the comment.
 
71
                /// </summary>
 
72
                public string AuthorUserName
 
73
                {
 
74
                        get { return _authorUserName; }
 
75
                }
 
76
 
 
77
                /// <summary>
 
78
                /// The permalink to the comment on the photos web page.
 
79
                /// </summary>
 
80
                public Uri Permalink
 
81
                {
 
82
                        get { return _permaLink; }
 
83
                }
 
84
 
 
85
                /// <summary>
 
86
                /// The date and time that the comment was created.
 
87
                /// </summary>
 
88
                public DateTime DateCreated
 
89
                {
 
90
                        get { return _dateCreated; }
 
91
                }
 
92
 
 
93
                /// <summary>
 
94
                /// The comment text (can contain HTML).
 
95
                /// </summary>
 
96
                public string CommentHtml
 
97
                {
 
98
                        get { return _comment; }
 
99
                }
 
100
 
 
101
                internal Comment(string photoId, XmlNode node)
 
102
                {
 
103
                        _photoId = photoId;
 
104
 
 
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;
 
117
                }
 
118
        }
 
119
}