From 9288fa8212406c8c0b4e85781dbe74cacc74de21 Mon Sep 17 00:00:00 2001 From: RKrom Date: Sun, 13 Jan 2013 15:56:18 +0000 Subject: [PATCH] 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 --- GreenshotPhotobucketPlugin/PhotobucketUtils.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GreenshotPhotobucketPlugin/PhotobucketUtils.cs b/GreenshotPhotobucketPlugin/PhotobucketUtils.cs index 1d84bad89..910b1aa6c 100644 --- a/GreenshotPhotobucketPlugin/PhotobucketUtils.cs +++ b/GreenshotPhotobucketPlugin/PhotobucketUtils.cs @@ -33,6 +33,7 @@ namespace GreenshotPhotobucketPlugin { public static class PhotobucketUtils { private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketUtils)); private static readonly PhotobucketConfiguration config = IniConfig.GetIniSection(); + private static List albumsCache = null; /// /// Do the actual upload to Photobucket @@ -134,6 +135,9 @@ namespace GreenshotPhotobucketPlugin { /// /// List public static List RetrievePhotobucketAlbums() { + if (albumsCache != null) { + return albumsCache; + } string responseString; OAuthSession oAuth = createSession(); @@ -159,6 +163,7 @@ namespace GreenshotPhotobucketPlugin { List albums = new List(); recurseAlbums(albums, null, doc.GetElementsByTagName("content").Item(0).ChildNodes); LOG.DebugFormat("Albums: {0}", string.Join(",", albums.ToArray())); + albumsCache = albums; return albums; } catch(Exception e) { LOG.Error("Error while Reading albums: ", e);