Example #1
0
        public PicasaPicture(GoogleConnection conn, string aid, string pid)
        {
            if (conn == null)
            {
                throw new ArgumentNullException("conn");
            }
            if (conn.User == null)
            {
                throw new ArgumentException("Need authentication before being used.", "conn");
            }
            this.conn = conn;

            if (aid == null || aid == String.Empty)
            {
                throw new ArgumentNullException("aid");
            }
            this.album = new PicasaAlbum(conn, aid);

            if (pid == null || pid == String.Empty)
            {
                throw new ArgumentNullException("pid");
            }

            string      received = conn.DownloadString(GDataApi.GetPictureEntry(conn.User, aid, pid));
            XmlDocument doc      = new XmlDocument();

            doc.LoadXml(received);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);

            XmlUtil.AddDefaultNamespaces(nsmgr);
            XmlNode entry = doc.SelectSingleNode("atom:entry", nsmgr);

            ParsePicture(entry, nsmgr);
        }
Example #2
0
        public PicasaAlbum(GoogleConnection conn, string user, string aid, string authkey) : this(conn)
        {
            if (user == null || user == String.Empty)
            {
                throw new ArgumentNullException("user");
            }

            if (aid == null || aid == String.Empty)
            {
                throw new ArgumentNullException("aid");
            }

            this.user    = user;
            this.id      = aid;
            this.authkey = authkey;

            string download_link = GDataApi.GetAlbumEntryById(user, id);
            if (authkey != null && authkey != "")
            {
                download_link += "&authkey=" + authkey;
            }
            string received = conn.DownloadString(download_link);

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(received);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
            XmlUtil.AddDefaultNamespaces(nsmgr);
            XmlNode entry = doc.SelectSingleNode("atom:entry", nsmgr);
            ParseAlbum(entry, nsmgr);
        }
Example #3
0
        public PicasaPictureCollection GetPictures()
        {
            string download_link = GDataApi.GetAlbumFeedById(user, id);

            if (authkey != null && authkey != "")
            {
                download_link += "&authkey=" + authkey;
            }
            string      received = conn.DownloadString(download_link);
            XmlDocument doc      = new XmlDocument();

            doc.LoadXml(received);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);

            XmlUtil.AddDefaultNamespaces(nsmgr);
            XmlNode feed = doc.SelectSingleNode("atom:feed", nsmgr);
            PicasaPictureCollection coll = new PicasaPictureCollection();

            foreach (XmlNode item in feed.SelectNodes("atom:entry", nsmgr))
            {
                coll.Add(new PicasaPicture(conn, this, item, nsmgr));
            }
            coll.SetReadOnly();
            return(coll);
        }
        public PicasaWeb(GoogleConnection conn, string username)
        {
            if (conn == null)
            {
                throw new ArgumentNullException("conn");
            }

            if (conn.User == null && username == null)
            {
                throw new ArgumentException("The connection should be authenticated OR you should call this constructor with a non-null username argument");
            }

            this.conn = conn;
            this.user = username ?? conn.User;

            string      received = conn.DownloadString(GDataApi.GetGalleryEntry(user));
            XmlDocument doc      = new XmlDocument();

            doc.LoadXml(received);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);

            XmlUtil.AddDefaultNamespaces(nsmgr);
            XmlNode entry = doc.SelectSingleNode("atom:entry", nsmgr);

            ParseGallery(entry, nsmgr);
        }
Example #5
0
        public PicasaWeb(GoogleConnection conn, string username)
        {
            if (conn == null)
                throw new ArgumentNullException ("conn");

            if (conn.User == null && username == null)
                throw new ArgumentException ("The connection should be authenticated OR you should call this constructor with a non-null username argument");

            this.conn = conn;
            this.user = username ?? conn.User;

            string received = conn.DownloadString (GDataApi.GetGalleryEntry (user));
            XmlDocument doc = new XmlDocument ();
            doc.LoadXml (received);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager (doc.NameTable);
            XmlUtil.AddDefaultNamespaces (nsmgr);
            XmlNode entry = doc.SelectSingleNode ("atom:entry", nsmgr);
            ParseGallery (entry, nsmgr);
        }
Example #6
0
		public PicasaAlbum (GoogleConnection conn, string aid) : this (conn)
		{
			if (conn.User == null)
				throw new ArgumentException ("Need authentication before being used.", "conn");

			if (aid == null || aid == String.Empty)
				throw new ArgumentNullException ("aid");

			this.user = conn.User;
			this.id = aid;

			string received = conn.DownloadString (GDataApi.GetAlbumEntryById (conn.User, aid));
			XmlDocument doc = new XmlDocument ();
			doc.LoadXml (received);
			XmlNamespaceManager nsmgr = new XmlNamespaceManager (doc.NameTable);
			XmlUtil.AddDefaultNamespaces (nsmgr);
			XmlNode entry = doc.SelectSingleNode ("atom:entry", nsmgr);
			ParseAlbum (entry, nsmgr);
		}
        public PicasaAlbumCollection GetAlbums()
        {
            string gallery_link = GDataApi.GetGalleryFeed(user);
            string received     = conn.DownloadString(gallery_link);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(received);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);

            XmlUtil.AddDefaultNamespaces(nsmgr);
            XmlNode feed = doc.SelectSingleNode("atom:feed", nsmgr);
            PicasaAlbumCollection coll = new PicasaAlbumCollection();

            foreach (XmlNode item in feed.SelectNodes("atom:entry", nsmgr))
            {
                coll.Add(new PicasaAlbum(conn, user, item, nsmgr));
            }
            coll.SetReadOnly();
            return(coll);
        }
Example #8
0
        public PicasaAlbum(GoogleConnection conn, string aid) : this(conn)
        {
            if (conn.User == null)
            {
                throw new ArgumentException("Need authentication before being used.", "conn");
            }

            if (aid == null || aid == String.Empty)
            {
                throw new ArgumentNullException("aid");
            }

            this.user = conn.User;
            this.id   = aid;

            string      received = conn.DownloadString(GDataApi.GetAlbumEntryById(conn.User, aid));
            XmlDocument doc      = new XmlDocument();
            doc.LoadXml(received);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
            XmlUtil.AddDefaultNamespaces(nsmgr);
            XmlNode entry = doc.SelectSingleNode("atom:entry", nsmgr);
            ParseAlbum(entry, nsmgr);
        }
Example #9
0
        public PicasaAlbum(GoogleConnection conn, string user, string aid, string authkey)
            : this(conn)
        {
            if (user == null || user == String.Empty)
                throw new ArgumentNullException ("user");

            if (aid == null || aid == String.Empty)
                throw new ArgumentNullException ("aid");

            this.user = user;
            this.id = aid;
            this.authkey = authkey;

            string download_link = GDataApi.GetAlbumEntryById (user, id);
            if (authkey != null && authkey != "")
                download_link += "&authkey=" + authkey;
            string received = conn.DownloadString (download_link);

            XmlDocument doc = new XmlDocument ();
            doc.LoadXml (received);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager (doc.NameTable);
            XmlUtil.AddDefaultNamespaces (nsmgr);
            XmlNode entry = doc.SelectSingleNode ("atom:entry", nsmgr);
            ParseAlbum (entry, nsmgr);
        }