Exemplo n.º 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);
        }
		internal void Add (PicasaAlbum album)
		{
			if (BaseGet (album.UniqueID) != null)
				throw new Exception ("Duplicate album?");

			BaseAdd (album.UniqueID, album);
		}
Exemplo n.º 3
0
        internal void Add(PicasaAlbum album)
        {
            if (BaseGet(album.UniqueID) != null)
            {
                throw new Exception("Duplicate album?");
            }

            BaseAdd(album.UniqueID, album);
        }
Exemplo n.º 4
0
        /*
         *      "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" +
         *      "<rss version=\"2.0\" xmlns:gphoto=\"http://www.temp.com/\">\n" +
         *      "  <channel>\n" +
         *      "    <gphoto:user>{0}</gphoto:user>\n" +
         *      "    <gphoto:id>{1}</gphoto:id>\n" +
         *      "    <gphoto:op>deleteAlbum</gphoto:op>\n" +
         *      "  </channel>\n" +
         *      "</rss>";
         */

//		static string GetXmlForDelete (string user, string aid)
//		{
//			XmlUtil xml = new XmlUtil ();
//			xml.WriteElementString ("user", user, PicasaNamespaces.GPhoto);
//			xml.WriteElementString ("id", aid, PicasaNamespaces.GPhoto);
//			xml.WriteElementString ("op", "deleteAlbum", PicasaNamespaces.GPhoto);
//			return xml.GetDocumentString ();
//		}

        public void DeleteAlbum(PicasaAlbum album)
        {
            if (album == null)
            {
                throw new ArgumentNullException("album");
            }

            DeleteAlbum(album.UniqueID);
        }
		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);
		}
Exemplo n.º 6
0
    static void Main(string [] args)
    {
        string user = args [0];
        string albumid = args [1];
        string filepath = args [2];
        Console.Write ("Password: "******"")
            password = null;

        ServicePointManager.ServerCertificateValidationCallback +=  delegate { return true; };
        GoogleConnection conn = new GoogleConnection (GoogleService.Picasa);
        conn.Authenticate (user, password);
        PicasaAlbum album = new PicasaAlbum (conn, albumid);
        Console.WriteLine ("  Album Title: {0} ID: {1}", album.Title, album.UniqueID);
        string [] files = Directory.GetFiles (filepath, "*.jpg");
        int count = files.Length;
        int i = 0;
        foreach (string f in files) {
            i++;
            Console.WriteLine ("Uploading {0} ({1} of {2})", Path.GetFileName (f), i, count);
            album.UploadPicture (f);
        }
    }
Exemplo n.º 7
0
        private void populateDetails(PicasaAlbum album)
        {
            this.lblName.Text = album.Title;
            this.txtBoxDescription.Text = album.Description;
            this.lblNumPictures.Text = album.PicturesCount.ToString();

            if (AlbumAccess.Public == album.Access) {
                this.permissionData.Text = "Public";
            } else {
                this.permissionData.Text = "Private";
            }

            this.lblBytesUsed.Text = album.BytesUsed.ToString();
        }
		internal PicasaPicture (GoogleConnection conn, PicasaAlbum album, XmlNode nodeitem, XmlNamespaceManager nsmgr)
		{
			this.conn = conn;
			this.album = album;
			ParsePicture (nodeitem, nsmgr);
		}
Exemplo n.º 9
0
 internal PicasaPicture(GoogleConnection conn, PicasaAlbum album, XmlNode nodeitem, XmlNamespaceManager nsmgr)
 {
     this.conn  = conn;
     this.album = album;
     ParsePicture(nodeitem, nsmgr);
 }
Exemplo n.º 10
0
        /*
            "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" +
            "<rss version=\"2.0\" xmlns:gphoto=\"http://www.temp.com/\">\n" +
            "  <channel>\n" +
            "    <gphoto:user>{0}</gphoto:user>\n" +
            "    <gphoto:id>{1}</gphoto:id>\n" +
            "    <gphoto:op>deleteAlbum</gphoto:op>\n" +
            "  </channel>\n" +
            "</rss>";
        */
        //        static string GetXmlForDelete (string user, string aid)
        //        {
        //            XmlUtil xml = new XmlUtil ();
        //            xml.WriteElementString ("user", user, PicasaNamespaces.GPhoto);
        //            xml.WriteElementString ("id", aid, PicasaNamespaces.GPhoto);
        //            xml.WriteElementString ("op", "deleteAlbum", PicasaNamespaces.GPhoto);
        //            return xml.GetDocumentString ();
        //        }
        public void DeleteAlbum(PicasaAlbum album)
        {
            if (album == null)
                throw new ArgumentNullException ("album");

            DeleteAlbum (album.UniqueID);
        }
		private void HandleResponse (object sender, Gtk.ResponseArgs args)
		{
			if (args.ResponseId != Gtk.ResponseType.Ok) {
				Dialog.Destroy ();
				return;
			}

			if (scale_check != null) {
				scale = scale_check.Active;
				size = size_spin.ValueAsInt;
			} else
				scale = false;

			browser = browser_check.Active;
			rotate = rotate_check.Active;
//			meta = meta_check.Active;
			export_tag = tag_check.Active;

			if (account != null) {
				//System.Console.WriteLine ("history = {0}", album_optionmenu.History);
				album = (PicasaAlbum) account.Picasa.GetAlbums() [Math.Max (0, album_optionmenu.History)];
				photo_index = 0;

				Dialog.Destroy ();

				command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (this.Upload));
				command_thread.Name = Catalog.GetString ("Uploading Pictures");

				progress_dialog = new FSpot.ThreadProgressDialog (command_thread, items.Length);
				progress_dialog.Start ();

				// Save these settings for next time
				Preferences.Set (SCALE_KEY, scale);
				Preferences.Set (SIZE_KEY, size);
				Preferences.Set (ROTATE_KEY, rotate);
				Preferences.Set (BROWSER_KEY, browser);
//				Preferences.Set (Preferences.EXPORT_GALLERY_META, meta);
				Preferences.Set (TAG_KEY, export_tag);
			}
		}