Example #1
0
        public override List <Album> FetchAlbums()
        {
            FormClient client = new FormClient(cookies);

            client.Add("cmd", "fetch-albums");
            client.Add("protocol_version", "2.3");

            return(ParseFetchAlbums(client.Submit(Uri)));
        }
Example #2
0
        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)));
        }
Example #3
0
        public override List <Image> 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);
        }
Example #4
0
        public override List <Album> FetchAlbumsPrune()
        {
            FormClient client = new FormClient(cookies);

            client.Add("cmd", "fetch-albums-prune");
            client.Add("protocol_version", "2.3");
            client.Add("check_writable", "no");
            List <Album> a = ParseFetchAlbums(client.Submit(Uri));

            a.Sort();
            return(a);
        }
Example #5
0
        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));
        }
Example #6
0
        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)));
        }
Example #7
0
        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));
        }
Example #8
0
        public override List <Image> 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);
        }
Example #9
0
        public override List <Album> 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);

            List <Album> a = ParseFetchAlbums(client.Submit(Uri));

            a.Sort();
            return(a);
        }
Example #10
0
        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);
        }
Example #11
0
        /*
         * 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)));
        }
Example #12
0
        /*
         * 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)));
        }
Example #13
0
        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)));
        }
Example #14
0
        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)));
        }
Example #15
0
        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));
        }
Example #16
0
        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;
        }
Example #17
0
        public override List<Album> 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);

            List<Album> a = ParseFetchAlbums (client.Submit (Uri));
            a.Sort ();
            return a;
        }
Example #18
0
        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));
        }
Example #19
0
        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));
        }
Example #20
0
        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));
        }
Example #21
0
        /*
        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));
        }
Example #22
0
        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));
        }
Example #23
0
        public override List<Image> 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;
        }
Example #24
0
        /*
        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));
        }
Example #25
0
        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));
        }
Example #26
0
        public override List<Image> 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;
        }
Example #27
0
 public override List<Album> FetchAlbumsPrune()
 {
     FormClient client = new FormClient (cookies);
     client.Add ("cmd", "fetch-albums-prune");
     client.Add ("protocol_version", "2.3");
     client.Add ("check_writable", "no");
     List<Album> a = ParseFetchAlbums (client.Submit (Uri));
     a.Sort ();
     return a;
 }
Example #28
0
        public override List<Album> FetchAlbums()
        {
            FormClient client = new FormClient (cookies);

            client.Add ("cmd", "fetch-albums");
            client.Add ("protocol_version", "2.3");

            return ParseFetchAlbums (client.Submit (Uri));
        }