public PicasaWeb Connect () { System.Console.WriteLine ("GoogleAccount.Connect()"); GoogleConnection conn = new GoogleConnection (GoogleService.Picasa); ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy (); if (unlock_captcha == null || token == null) conn.Authenticate(username, password); else { conn.Authenticate(username, password, token, unlock_captcha); token = null; unlock_captcha = null; } connection = conn; PicasaWeb picasa = new PicasaWeb(conn); this.picasa = picasa; return picasa; }
// args [0] -> user name, args [1] -> album title static void Main(string [] args) { ServicePointManager.ServerCertificateValidationCallback += delegate { return true; }; GoogleConnection conn = new GoogleConnection (GoogleService.Picasa); Console.Write ("Password: "******"Album created. Title: {0} Unique ID: {1}", album.Title, album.UniqueID); }
static void Main(string [] args) { string user = args [0]; string albumid = args [1]; string imageid = args [2]; string tag = args [3]; Console.Write ("Password: "******"") password = null; ServicePointManager.ServerCertificateValidationCallback += delegate { return true; }; GoogleConnection conn = new GoogleConnection (GoogleService.Picasa); conn.Authenticate (user, password); PicasaPicture picture = new PicasaPicture (conn, albumid, imageid); Console.WriteLine (" Image Name: {0} ID: {1}", picture.Title, picture.UniqueID); picture.AddTag (tag); }
static void Main(string [] args) { Console.Write ("User name: "); string user = Console.ReadLine (); Console.Write ("Password: "******"") picasa = new PicasaWeb (conn, user); else { conn.Authenticate (user, password); picasa = new PicasaWeb (conn); } Console.WriteLine ("Picasa: Title: {0}, User: {1}, NickName: {2}, QuotaUsed: {3}, QuotaLimit: {4}\n", picasa.Title, picasa.User, picasa.NickName, picasa.QuotaUsed, picasa.QuotaLimit); PicasaAlbumCollection coll = picasa.GetAlbums (); foreach (PicasaAlbum album in coll.AllValues) { Console.WriteLine ("Title: {0} ID: {1}", album.Title, album.UniqueID); } }
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); } }
public void login() { try { connection = new GoogleConnection(GoogleService.Picasa); //ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy(); connection.Authenticate(this.username, this.password); web = new PicasaWeb(connection); this.loggedIn = true; } catch (Exception) { this.loggedIn = false; } }