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

Person.cs

using System;
using System.Xml.Serialization;
using System.Xml.Schema;

namespace FlickrNet
{

      /// <summary>
      /// The <see cref="Person"/> class contains details returned by the <see cref="Flickr.PeopleGetInfo"/>
      /// method.
      /// </summary>
      [System.Serializable]
      [XmlRoot("person")]
00014       public class Person
      {
            internal static Person SerializePerson(System.Xml.XmlNode node)
            {
                  Person p = (Person)Utils.Deserialize(node, typeof(Person));
                  return p;
            }
            private string _userId;
            private int _isAdmin;
            private int _isPro;
            private int _iconServer;
            private int _iconFarm;
            private string _username;
            private string _realname;
            private string _location;
            private PersonPhotosSummary _summary = new PersonPhotosSummary();
            private string _photosUrl;
            private string _profileUrl;
            private string _mboxHash;

            /// <summary>The user id of the user.</summary>
            /// <remarks/>
            [XmlAttribute("nsid", Form=XmlSchemaForm.Unqualified)]
00037             public string UserId { get { return _userId; } set { _userId = value; } }

            /// <summary>Is the user an administrator.
            /// 1 = admin, 0 = normal user.</summary>
            /// <remarks></remarks>
            [XmlAttribute("isadmin", Form=XmlSchemaForm.Unqualified)]
00043             public int IsAdmin { get { return _isAdmin; } set { _isAdmin = value; } }

            /// <summary>Does the user posses a pro account.
            /// 0 = free acouunt, 1 = pro account holder.</summary>
            [XmlAttribute("ispro", Form=XmlSchemaForm.Unqualified)]
00048             public int IsPro { get { return _isPro; } set { _isPro = value; } }

            /// <summary>Does the user posses a pro account.
            /// 0 = free acouunt, 1 = pro account holder.</summary>
            [XmlAttribute("iconserver", Form=XmlSchemaForm.Unqualified)]
00053             public int IconServer { get { return _iconServer; } set { _iconServer = value; } }

            /// <summary>No idea what purpose this field serves.</summary>
            [XmlAttribute("iconfarm", Form=XmlSchemaForm.Unqualified)]
00057             public int IconFarm { get { return _iconFarm; } set { _iconFarm = value; } }

            /// <summary>The users username, also known as their screenname.</summary>
            [XmlElement("username", Form=XmlSchemaForm.Unqualified)]
00061             public string UserName { get { return _username; } set { _username = value; } }

            /// <summary>The users real name, as entered in their profile.</summary>
            [XmlElement("realname", Form=XmlSchemaForm.Unqualified)]
00065             public string RealName { get { return _realname; } set { _realname = value; } }

            /// <summary>The SHA1 hash of the users email address - used for FOAF networking.</summary>
            [XmlElement("mbox_sha1sum", Form=XmlSchemaForm.Unqualified)]
00069             public string MailBoxSha1Hash { get { return _mboxHash; } set { _mboxHash = value; } }

            /// <summary>Consists of your current location followed by country.</summary>
            /// <example>e.g. Newcastle, UK.</example>
            [XmlElement("location", Form=XmlSchemaForm.Unqualified)]
00074             public string Location { get { return _location; } set { _location = value; } }

            /// <summary>Sub element containing a summary of the users photo information.</summary>
            /// <remarks/>
            [XmlElement("photos", Form=XmlSchemaForm.Unqualified)]
00079             public PersonPhotosSummary PhotosSummary { get { return _summary; } set { _summary = value; } }

            /// <summary>
            /// The users photo location on Flickr
            /// http://www.flickr.com/photos/username/
            /// </summary>
            [XmlElement("photosurl",Form=XmlSchemaForm.Unqualified)]
00086             public string PhotosUrl { get { return _photosUrl; } set { _photosUrl = value; } }

            /// <summary>
            /// The users profile location on Flickr
            /// http://www.flickr.com/people/username/
            /// </summary>
            [XmlElement("profileurl",Form=XmlSchemaForm.Unqualified)]
00093             public string ProfileUrl { get { return _profileUrl; } set { _profileUrl = value; } }

            /// <summary>
            /// Returns the <see cref="Uri"/> for the users Buddy Icon.
            /// </summary>
            [XmlIgnore()]
            public Uri BuddyIconUrl
00100             {
                  get
                  {
                        if( IconServer == 0 )
                              return new Uri("http://www.flickr.com/images/buddyicon.jpg");
                        else
                              return new Uri(String.Format("http://static.flickr.com/{0}/buddyicons/{1}.jpg", IconServer, UserId));
                  }
            }
      }

      /// <summary>
      /// A summary of a users photos.
      /// </summary>
      [System.Serializable]
00115       public class PersonPhotosSummary
      {
            private int _photoCount;
            private int _views;

            /// <summary>The first date the user uploaded a picture, converted into <see cref="DateTime"/> format.</summary>
            [XmlIgnore()]
            public DateTime FirstDate
00123             {
                  get { return Utils.UnixTimestampToDate(firstdate_raw); }
            }

            /// <summary>The first date the user took a picture, converted into <see cref="DateTime"/> format.</summary>
            [XmlIgnore()]
            public DateTime FirstTakenDate
00130             {
                  get
                  {
                        if( firsttakendate_raw == null || firsttakendate_raw.Length == 0 ) return DateTime.MinValue;
                        return System.DateTime.Parse(firsttakendate_raw);
                  }
            }

            /// <summary>The total number of photos for the user.</summary>
            /// <remarks/>
            [XmlElement("count", Form=XmlSchemaForm.Unqualified)]
            public int PhotoCount
00142             {
                  get { return _photoCount; }
                  set { _photoCount = value; }
            }

            /// <summary>The total number of photos for the user.</summary>
            /// <remarks/>
            [XmlElement("views", Form=XmlSchemaForm.Unqualified)]
            public int Views
00151             {
                  get { return _views; }
                  set { _views = value; }
            }

            /// <remarks>The unix timestamp of the date the first photo was uploaded.</remarks>
            [XmlElement("firstdate", Form=XmlSchemaForm.Unqualified)]
00158             public string firstdate_raw;

            /// <remarks>The date the first photo was taken.</remarks>
            [XmlElement("firsttakendate", Form=XmlSchemaForm.Unqualified)]
00162             public string firsttakendate_raw;

      }
}

Generated by  Doxygen 1.6.0   Back to index