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:
RKrom 2013-01-13 15:56:18 +00:00
commit 9288fa8212

View file

@ -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<PhotobucketConfiguration>();
private static List<string> albumsCache = null;
/// <summary>
/// Do the actual upload to Photobucket
@ -134,6 +135,9 @@ namespace GreenshotPhotobucketPlugin {
/// </summary>
/// <returns>List<string></returns>
public static List<string> RetrievePhotobucketAlbums() {
if (albumsCache != null) {
return albumsCache;
}
string responseString;
OAuthSession oAuth = createSession();
@ -159,6 +163,7 @@ namespace GreenshotPhotobucketPlugin {
List<string> albums = new List<string>();
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);