mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -07:00
Added some rudimentary cache for the albums, very rudimentary... Greenshot needs a restart to recognize new albums.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2428 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
502abed36a
commit
9288fa8212
1 changed files with 5 additions and 0 deletions
|
@ -33,6 +33,7 @@ namespace GreenshotPhotobucketPlugin {
|
||||||
public static class PhotobucketUtils {
|
public static class PhotobucketUtils {
|
||||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketUtils));
|
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketUtils));
|
||||||
private static readonly PhotobucketConfiguration config = IniConfig.GetIniSection<PhotobucketConfiguration>();
|
private static readonly PhotobucketConfiguration config = IniConfig.GetIniSection<PhotobucketConfiguration>();
|
||||||
|
private static List<string> albumsCache = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Do the actual upload to Photobucket
|
/// Do the actual upload to Photobucket
|
||||||
|
@ -134,6 +135,9 @@ namespace GreenshotPhotobucketPlugin {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>List<string></returns>
|
/// <returns>List<string></returns>
|
||||||
public static List<string> RetrievePhotobucketAlbums() {
|
public static List<string> RetrievePhotobucketAlbums() {
|
||||||
|
if (albumsCache != null) {
|
||||||
|
return albumsCache;
|
||||||
|
}
|
||||||
string responseString;
|
string responseString;
|
||||||
|
|
||||||
OAuthSession oAuth = createSession();
|
OAuthSession oAuth = createSession();
|
||||||
|
@ -159,6 +163,7 @@ namespace GreenshotPhotobucketPlugin {
|
||||||
List<string> albums = new List<string>();
|
List<string> albums = new List<string>();
|
||||||
recurseAlbums(albums, null, doc.GetElementsByTagName("content").Item(0).ChildNodes);
|
recurseAlbums(albums, null, doc.GetElementsByTagName("content").Item(0).ChildNodes);
|
||||||
LOG.DebugFormat("Albums: {0}", string.Join(",", albums.ToArray()));
|
LOG.DebugFormat("Albums: {0}", string.Join(",", albums.ToArray()));
|
||||||
|
albumsCache = albums;
|
||||||
return albums;
|
return albums;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
LOG.Error("Error while Reading albums: ", e);
|
LOG.Error("Error while Reading albums: ", e);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue