public void Upload(Photo photo, string gallery) { if (login == null || passwd == null) { throw new Exception("Must Login First"); } string path = string.Format("/{0}/{1}/", login, gallery); FormClient client = new FormClient(cookies); client.SuppressCookiePath = true; client.Add("cmd", "uploadns1"); client.Add("start", System.Web.HttpUtility.UrlEncode(path)); client.Add("photo", new FileInfo(photo.DefaultVersionUri.LocalPath)); client.Add("desc", photo.Description); if (photo.Tags != null) { StringBuilder taglist = new StringBuilder(); foreach (Tag t in photo.Tags) { taglist.Append(t.Name + " "); } client.Add("keywords", taglist.ToString()); } string upload_url = UploadBaseUrl + path + "?"; Stream response = client.Submit(upload_url).GetResponseStream(); StreamReader reader = new StreamReader(response, Encoding.UTF8); Console.WriteLine(reader.ReadToEnd()); }
public void Upload (Photo photo, string gallery) { if (login == null || passwd == null) throw new Exception ("Must Login First"); string path = string.Format ("/{0}/{1}/", login, gallery); FormClient client = new FormClient (cookies); client.SuppressCookiePath = true; client.Add ("cmd", "uploadns1"); client.Add ("start", System.Web.HttpUtility.UrlEncode (path)); client.Add ("photo", new FileInfo (photo.DefaultVersionUri.LocalPath)); client.Add ("desc", photo.Description); if (photo.Tags != null) { StringBuilder taglist = new StringBuilder (); foreach (Tag t in photo.Tags) { taglist.Append (t.Name + " "); } client.Add ("keywords", taglist.ToString ()); } string upload_url = UploadBaseUrl + path + "?"; Stream response = client.Submit (upload_url).GetResponseStream (); StreamReader reader = new StreamReader (response, Encoding.UTF8); Console.WriteLine (reader.ReadToEnd ()); }
public override ArrayList FetchAlbums() { FormClient client = new FormClient(cookies); client.Add("cmd", "fetch-albums"); client.Add("protocol_version", "2.3"); return(ParseFetchAlbums(client.Submit(uri))); }
public override bool MoveAlbum(Album album, string end_name) { FormClient client = new FormClient(cookies); client.Add("cmd", "move-album"); client.Add("protocol_version", "2.7"); client.Add("set_albumName", album.Name); client.Add("set_destalbumName", end_name); return(ParseMoveAlbum(client.Submit(uri))); }
public override ArrayList FetchAlbumsPrune() { FormClient client = new FormClient(cookies); client.Add("cmd", "fetch-albums-prune"); client.Add("protocol_version", "2.3"); client.Add("check_writable", "no"); ArrayList a = ParseFetchAlbums(client.Submit(uri)); a.Sort(); return(a); }
public override ArrayList FetchAlbumImages(Album album, bool include_ablums) { FormClient client = new FormClient(cookies); client.Add("cmd", "fetch-album-images"); client.Add("protocol_version", "2.3"); client.Add("set_albumName", album.Name); client.Add("albums_too", include_ablums ? "yes" : "no"); album.Images = ParseFetchAlbumImages(client.Submit(uri), album); return(album.Images); }
public override bool MoveAlbum(Album album, string end_name) { FormClient client = new FormClient(cookies); client.Add("g2_form[cmd]", "move-album"); client.Add("g2_form[protocol_version]", "2.10"); client.Add("g2_form[set_albumName]", album.Name); client.Add("g2_form[set_destalbumName]", end_name); AddG2Specific(client); return(ParseMoveAlbum(client.Submit(uri))); }
public override void Login(string username, string passwd) { //Console.WriteLine ("Gallery1: Attempting to login"); FormClient client = new FormClient(cookies); client.Add("cmd", "login"); client.Add("protocol_version", "2.3"); client.Add("uname", username); client.Add("password", passwd); ParseLogin(client.Submit(uri)); }
public override ArrayList FetchAlbumImages(Album album, bool include_ablums) { FormClient client = new FormClient(cookies); client.Add("g2_form[cmd]", "fetch-album-images"); client.Add("g2_form[protocol_version]", "2.10"); client.Add("g2_form[set_albumName]", album.Name); client.Add("g2_form[albums_too]", include_ablums ? "yes" : "no"); AddG2Specific(client); album.Images = ParseFetchAlbumImages(client.Submit(uri), album); return(album.Images); }
public override void Login(string username, string passwd) { Console.WriteLine("Gallery2: Attempting to login"); FormClient client = new FormClient(cookies); client.Add("g2_form[cmd]", "login"); client.Add("g2_form[protocol_version]", "2.10"); client.Add("g2_form[uname]", username); client.Add("g2_form[password]", passwd); AddG2Specific(client); ParseLogin(client.Submit(uri)); }
public static GalleryVersion DetectGalleryVersion(string url) { //Figure out if the url is for G1 or G2 Console.WriteLine("Detecting Gallery version"); GalleryVersion version; if (url.EndsWith(Gallery1.script_name)) { version = GalleryVersion.Version1; } else if (url.EndsWith(Gallery2.script_name)) { version = GalleryVersion.Version2; } else { //check what script is available on the server FormClient client = new FormClient(); try { client.Submit(new Uri(Gallery.FixUrl(url, Gallery1.script_name))); version = GalleryVersion.Version1; } catch (System.Net.WebException) { try { client.Submit(new Uri(Gallery.FixUrl(url, Gallery2.script_name))); version = GalleryVersion.Version2; } catch (System.Net.WebException) { //Uh oh, neither version detected version = GalleryVersion.VersionUnknown; } } } Console.WriteLine("Detected: " + version.ToString()); return(version); }
public override ArrayList FetchAlbumsPrune() { FormClient client = new FormClient(cookies); client.Add("g2_form[cmd]", "fetch-albums-prune"); client.Add("g2_form[protocol_version]", "2.10"); client.Add("g2_form[check_writable]", "no"); AddG2Specific(client); ArrayList a = ParseFetchAlbums(client.Submit(uri)); a.Sort(); return(a); }
/* * public override Album AlbumProperties (string album) * { * FormClient client = new FormClient (cookies); * client.Add ("cmd", "album-properties"); * client.Add ("protocol_version", "2.3"); * client.Add ("set_albumName", album); * * return ParseAlbumProperties (client.Submit (uri)); * } */ public override bool NewAlbum(string parent_name, string name, string title, string description) { FormClient client = new FormClient(cookies); client.Multipart = true; client.Add("cmd", "new-album"); client.Add("protocol_version", "2.8"); client.Add("set_albumName", parent_name); client.Add("newAlbumName", name); client.Add("newAlbumTitle", title); client.Add("newAlbumDesc", description); return(ParseNewAlbum(client.Submit(uri))); }
public void Login (string login, string passwd) { FormClient client = new FormClient (cookies); client.SuppressCookiePath = true; client.Add ("finish", String.Empty); client.Add ("check_cookies", String.Empty); client.Add ("login", login); client.Add ("password", passwd); Stream response = client.Submit (AuthUrl).GetResponseStream (); StreamReader reader = new StreamReader (response, Encoding.UTF8); Console.WriteLine (reader.ReadToEnd ()); this.login = login; this.passwd = passwd; }
/* * public override Album AlbumProperties (string album) * { * FormClient client = new FormClient (cookies); * client.Add ("cmd", "album-properties"); * client.Add ("protocol_version", "2.3"); * client.Add ("set_albumName", album); * * return ParseAlbumProperties (client.Submit (uri)); * } */ public override bool NewAlbum(string parent_name, string name, string title, string description) { FormClient client = new FormClient(cookies); client.Multipart = true; client.Add("g2_form[cmd]", "new-album"); client.Add("g2_form[protocol_version]", "2.10"); client.Add("g2_form[set_albumName]", parent_name); client.Add("g2_form[newAlbumName]", name); client.Add("g2_form[newAlbumTitle]", title); client.Add("g2_form[newAlbumDesc]", description); AddG2Specific(client); return(ParseNewAlbum(client.Submit(uri))); }
public void Login(string login, string passwd) { FormClient client = new FormClient(cookies); client.SuppressCookiePath = true; client.Add("finish", String.Empty); client.Add("check_cookies", String.Empty); client.Add("login", login); client.Add("password", passwd); Stream response = client.Submit(AuthUrl).GetResponseStream(); StreamReader reader = new StreamReader(response, Encoding.UTF8); Console.WriteLine(reader.ReadToEnd()); this.login = login; this.passwd = passwd; }
public override int AddItem(Album album, string path, string filename, string caption, bool autorotate) { FormClient client = new FormClient(cookies); client.Add("cmd", "add-item"); client.Add("protocol_version", "2.9"); client.Add("set_albumName", album.Name); client.Add("caption", caption); client.Add("userfile_name", filename); client.Add("force_filename", filename); client.Add("auto_rotate", autorotate ? "yes" : "no"); client.Add("userfile", new FileInfo(path)); return(ParseAddItem(client.Submit(uri, Progress))); }
public override int AddItem(Album album, string path, string filename, string caption, bool autorotate) { FormClient client = new FormClient(cookies); client.Add("g2_form[cmd]", "add-item"); client.Add("g2_form[protocol_version]", "2.10"); client.Add("g2_form[set_albumName]", album.Name); client.Add("g2_form[caption]", caption); client.Add("g2_form[userfile_name]", filename); client.Add("g2_form[force_filename]", filename); client.Add("g2_form[auto_rotate]", autorotate ? "yes" : "no"); client.Add("g2_userfile", new FileInfo(path)); AddG2Specific(client); return(ParseAddItem(client.Submit(uri, Progress))); }
public override int AddItem(Album album, string path, string filename, string caption, string description, bool autorotate) { FormClient client = new FormClient (cookies); client.Add ("g2_form[cmd]", "add-item"); client.Add ("g2_form[protocol_version]", "2.10"); client.Add ("g2_form[set_albumName]", album.Name); client.Add ("g2_form[caption]", caption); client.Add ("g2_form[userfile_name]", filename); client.Add ("g2_form[force_filename]", filename); client.Add ("g2_form[auto_rotate]", autorotate ? "yes" : "no"); client.Add ("g2_form[extrafield.Description]", description); client.Add ("g2_userfile", new FileInfo (path)); client.expect_continue = expect_continue; AddG2Specific (client); return ParseAddItem (client.Submit (uri, Progress)); }
/* public override Album AlbumProperties (string album) { FormClient client = new FormClient (cookies); client.Add ("cmd", "album-properties"); client.Add ("protocol_version", "2.3"); client.Add ("set_albumName", album); return ParseAlbumProperties (client.Submit (uri)); } */ public override bool NewAlbum(string parent_name, string name, string title, string description) { FormClient client = new FormClient (cookies); client.Multipart = true; client.Add ("cmd", "new-album"); client.Add ("protocol_version", "2.8"); client.Add ("set_albumName", parent_name); client.Add ("newAlbumName", name); client.Add ("newAlbumTitle", title); client.Add ("newAlbumDesc", description); return ParseNewAlbum (client.Submit (uri)); }
public override ArrayList FetchAlbumImages(Album album, bool include_ablums) { FormClient client = new FormClient (cookies); client.Add ("g2_form[cmd]", "fetch-album-images"); client.Add ("g2_form[protocol_version]","2.10"); client.Add ("g2_form[set_albumName]", album.Name); client.Add ("g2_form[albums_too]", include_ablums ? "yes" : "no"); AddG2Specific (client); album.Images = ParseFetchAlbumImages (client.Submit (uri), album); return album.Images; }
public override void Login(string username, string passwd) { //Console.WriteLine ("Gallery1: Attempting to login"); FormClient client = new FormClient (cookies); client.Add ("cmd", "login"); client.Add ("protocol_version", "2.3"); client.Add ("uname", username); client.Add ("password", passwd); ParseLogin (client.Submit (uri)); }
public override bool MoveAlbum(Album album, string end_name) { FormClient client = new FormClient (cookies); client.Add ("cmd", "move-album"); client.Add ("protocol_version", "2.7"); client.Add ("set_albumName", album.Name); client.Add ("set_destalbumName", end_name); return ParseMoveAlbum (client.Submit (uri)); }
public override ArrayList FetchAlbums() { FormClient client = new FormClient (cookies); client.Add ("cmd", "fetch-albums"); client.Add ("protocol_version", "2.3"); return ParseFetchAlbums (client.Submit (uri)); }
public override ArrayList FetchAlbumsPrune() { FormClient client = new FormClient (cookies); client.Add ("cmd", "fetch-albums-prune"); client.Add ("protocol_version", "2.3"); client.Add ("check_writable", "no"); ArrayList a = ParseFetchAlbums (client.Submit (uri)); a.Sort(); return a; }
public override int AddItem(Album album, string path, string filename, string caption, string description, bool autorotate) { FormClient client = new FormClient (cookies); client.Add ("cmd", "add-item"); client.Add ("protocol_version", "2.9"); client.Add ("set_albumName", album.Name); client.Add ("caption", caption); client.Add ("userfile_name", filename); client.Add ("force_filename", filename); client.Add ("auto_rotate", autorotate ? "yes" : "no"); client.Add ("userfile", new FileInfo (path)); client.Add ("extrafield.Description", description); client.expect_continue = expect_continue; return ParseAddItem (client.Submit (uri, Progress)); }
public override ArrayList FetchAlbumImages(Album album, bool include_ablums) { FormClient client = new FormClient (cookies); client.Add ("cmd", "fetch-album-images"); client.Add ("protocol_version","2.3"); client.Add ("set_albumName", album.Name); client.Add ("albums_too", include_ablums ? "yes" : "no"); album.Images = ParseFetchAlbumImages (client.Submit (uri), album); return album.Images; }
public static GalleryVersion DetectGalleryVersion(string url) { //Figure out if the url is for G1 or G2 Log.Debug ("Detecting Gallery version"); GalleryVersion version; if (url.EndsWith (Gallery1.script_name)) { version = GalleryVersion.Version1; } else if (url.EndsWith (Gallery2.script_name)) { version = GalleryVersion.Version2; } else { //check what script is available on the server FormClient client = new FormClient (); try { client.Submit (new Uri (Gallery.FixUrl (url, Gallery1.script_name))); version = GalleryVersion.Version1; } catch (System.Net.WebException) { try { client.Submit (new Uri (Gallery.FixUrl (url, Gallery2.script_name))); version = GalleryVersion.Version2; } catch (System.Net.WebException) { //Uh oh, neither version detected version = GalleryVersion.VersionUnknown; } } } Log.Debug ("Detected: " + version.ToString()); return version; }
/* public override Album AlbumProperties (string album) { FormClient client = new FormClient (cookies); client.Add ("cmd", "album-properties"); client.Add ("protocol_version", "2.3"); client.Add ("set_albumName", album); return ParseAlbumProperties (client.Submit (uri)); } */ public override bool NewAlbum(string parent_name, string name, string title, string description) { FormClient client = new FormClient (cookies); client.Multipart = true; client.Add ("g2_form[cmd]", "new-album"); client.Add ("g2_form[protocol_version]", "2.10"); client.Add ("g2_form[set_albumName]", parent_name); client.Add ("g2_form[newAlbumName]", name); client.Add ("g2_form[newAlbumTitle]", title); client.Add ("g2_form[newAlbumDesc]", description); AddG2Specific (client); return ParseNewAlbum (client.Submit (uri)); }
public override bool MoveAlbum(Album album, string end_name) { FormClient client = new FormClient (cookies); client.Add ("g2_form[cmd]", "move-album"); client.Add ("g2_form[protocol_version]", "2.10"); client.Add ("g2_form[set_albumName]", album.Name); client.Add ("g2_form[set_destalbumName]", end_name); AddG2Specific (client); return ParseMoveAlbum (client.Submit (uri)); }
public override void Login(string username, string passwd) { Log.Debug ("Gallery2: Attempting to login"); FormClient client = new FormClient (cookies); client.Add ("g2_form[cmd]", "login"); client.Add ("g2_form[protocol_version]", "2.10"); client.Add ("g2_form[uname]", username); client.Add ("g2_form[password]", passwd); AddG2Specific (client); ParseLogin (client.Submit (uri)); }
public override ArrayList FetchAlbumsPrune() { FormClient client = new FormClient (cookies); client.Add ("g2_form[cmd]", "fetch-albums-prune"); client.Add ("g2_form[protocol_version]", "2.10"); client.Add ("g2_form[check_writable]", "no"); AddG2Specific (client); ArrayList a = ParseFetchAlbums (client.Submit (uri)); a.Sort(); return a; }