Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Updated to avoid warning.
Browse files Browse the repository at this point in the history
	Updated samples to use 2.0 validation. Renamed upload-image.cs to
	upload-images.cs and make it take a directory instead of a file.
  • Loading branch information
gonzalop committed Aug 24, 2010
1 parent adf2eeb commit 972ce30
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sample/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SAMPLES=list-albums.cs create-album.cs upload-image.cs tag-image.cs
SAMPLES=list-albums.cs create-album.cs upload-images.cs tag-image.cs
MCSFLAGS= -debug+ -debug:full -nologo -r:Mono.Google.dll

EXTRA_DIST=$(SAMPLES)
Expand Down
2 changes: 1 addition & 1 deletion sample/create-album.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Test {
// args [0] -> user name, args [1] -> album title
static void Main (string [] args)
{
ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy ();
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
GoogleConnection conn = new GoogleConnection (GoogleService.Picasa);
Console.Write ("Password: ");
string pass = Console.ReadLine ();
Expand Down
2 changes: 1 addition & 1 deletion sample/list-albums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void Main (string [] args)
Console.Write ("Password: ");
string password = Console.ReadLine ();

ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy ();
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
GoogleConnection conn = new GoogleConnection (GoogleService.Picasa);
PicasaWeb picasa;
if (password == null || password.Trim () == "")
Expand Down
2 changes: 1 addition & 1 deletion sample/tag-image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static void Main (string [] args)
if (password == null || password.Trim () == "")
password = null;

ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy ();
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
GoogleConnection conn = new GoogleConnection (GoogleService.Picasa);
conn.Authenticate (user, password);
PicasaPicture picture = new PicasaPicture (conn, albumid, imageid);
Expand Down
12 changes: 10 additions & 2 deletions sample/upload-image.cs → sample/upload-images.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
//

using System;
using System.IO;
using System.Net;
using Mono.Google;
using Mono.Google.Picasa;
Expand All @@ -43,12 +44,19 @@ static void Main (string [] args)
if (password == null || password.Trim () == "")
password = null;

ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy ();
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);
album.UploadPicture (filepath);
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);
}
}
}

0 comments on commit 972ce30

Please sign in to comment.