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 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 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 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 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 ("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 ("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 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 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 FetchAlbums () { FormClient client = new FormClient (cookies); client.Add ("cmd", "fetch-albums"); client.Add ("protocol_version", "2.3"); return ParseFetchAlbums (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; }
private void AddG2Specific (FormClient client) { if (AuthToken != null && AuthToken != String.Empty) client.Add("g2_authToken", AuthToken); client.Add("g2_controller", "remote.GalleryRemote"); }
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 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 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)); }