diff --git a/src/Greenshot.Addon.Box/BoxDestination.cs b/src/Greenshot.Addon.Box/BoxDestination.cs
index c54ef96fd..c0ee744ce 100644
--- a/src/Greenshot.Addon.Box/BoxDestination.cs
+++ b/src/Greenshot.Addon.Box/BoxDestination.cs
@@ -57,15 +57,20 @@ namespace Greenshot.Addon.Box
private static readonly LogSource Log = new LogSource();
private readonly IBoxConfiguration _boxConfiguration;
private readonly IBoxLanguage _boxLanguage;
+ private readonly INetworkConfiguration _networkConfiguration;
private readonly OAuth2Settings _oauth2Settings;
private static readonly Uri UploadFileUri = new Uri("https://upload.box.com/api/2.0/files/content");
private static readonly Uri FilesUri = new Uri("https://www.box.com/api/2.0/files/");
[ImportingConstructor]
- public BoxDestination(IBoxConfiguration boxConfiguration, IBoxLanguage boxLanguage)
+ public BoxDestination(
+ IBoxConfiguration boxConfiguration,
+ IBoxLanguage boxLanguage,
+ INetworkConfiguration networkConfiguration)
{
_boxConfiguration = boxConfiguration;
_boxLanguage = boxLanguage;
+ _networkConfiguration = networkConfiguration;
_oauth2Settings = new OAuth2Settings
{
@@ -166,6 +171,8 @@ namespace Greenshot.Addon.Box
string filename = surface.GenerateFilename(CoreConfiguration, _boxConfiguration);
var oauthHttpBehaviour = HttpBehaviour.Current.ShallowClone();
+ // Use the network settings
+ oauthHttpBehaviour.HttpSettings = _networkConfiguration;
// Use UploadProgress
if (progress != null)
{
diff --git a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs
index bdf3a745b..070d1f956 100644
--- a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs
+++ b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs
@@ -65,7 +65,10 @@ namespace Greenshot.Addon.Dropbox
private IHttpBehaviour _oAuthHttpBehaviour;
[ImportingConstructor]
- public DropboxDestination(IDropboxConfiguration dropboxPluginConfiguration, IDropboxLanguage dropboxLanguage)
+ public DropboxDestination(
+ IDropboxConfiguration dropboxPluginConfiguration,
+ IDropboxLanguage dropboxLanguage,
+ INetworkConfiguration networkConfiguration)
{
_dropboxPluginConfiguration = dropboxPluginConfiguration;
_dropboxLanguage = dropboxLanguage;
@@ -89,10 +92,14 @@ namespace Greenshot.Addon.Dropbox
RedirectUrl = "http://localhost:47336",
Token = dropboxPluginConfiguration
};
- _oAuthHttpBehaviour = OAuth2HttpBehaviourFactory.Create(_oAuth2Settings);
+ var httpBehaviour = OAuth2HttpBehaviourFactory.Create(_oAuth2Settings) as IChangeableHttpBehaviour;
+
+ _oAuthHttpBehaviour = httpBehaviour;
+ // Use the default network settings
+ httpBehaviour.HttpSettings = networkConfiguration;
}
- public override Bitmap DisplayIcon
+ public override Bitmap DisplayIcon
{
get
{
diff --git a/src/Greenshot.Addon.Flickr/FlickrDestination.cs b/src/Greenshot.Addon.Flickr/FlickrDestination.cs
index 802e54831..870a3213b 100644
--- a/src/Greenshot.Addon.Flickr/FlickrDestination.cs
+++ b/src/Greenshot.Addon.Flickr/FlickrDestination.cs
@@ -76,7 +76,8 @@ namespace Greenshot.Addon.Flickr
});
[ImportingConstructor]
- public FlickrDestination(IFlickrConfiguration flickrConfiguration, IFlickrLanguage flickrLanguage)
+ public FlickrDestination(IFlickrConfiguration flickrConfiguration,
+ IFlickrLanguage flickrLanguage, INetworkConfiguration networkConfiguration)
{
_flickrConfiguration = flickrConfiguration;
_flickrLanguage = flickrLanguage;
@@ -105,7 +106,9 @@ namespace Greenshot.Addon.Flickr
_oAuthHttpBehaviour = OAuth1HttpBehaviourFactory.Create(_oAuthSettings);
_oAuthHttpBehaviour.ValidateResponseContentType = false;
- }
+ // Use the default network settings
+ _oAuthHttpBehaviour.HttpSettings = networkConfiguration;
+ }
public override string Description => _flickrLanguage.UploadMenuItem;
diff --git a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs
index 3b84c9945..f61205fdb 100644
--- a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs
+++ b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs
@@ -56,13 +56,18 @@ namespace Greenshot.Addon.GooglePhotos
private static readonly LogSource Log = new LogSource();
private readonly IGooglePhotosConfiguration _googlePhotosConfiguration;
private readonly IGooglePhotosLanguage _googlePhotosLanguage;
+ private readonly INetworkConfiguration _networkConfiguration;
private readonly OAuth2Settings _oAuth2Settings;
[ImportingConstructor]
- public GooglePhotosDestination(IGooglePhotosConfiguration googlePhotosConfiguration, IGooglePhotosLanguage googlePhotosLanguage)
+ public GooglePhotosDestination(
+ IGooglePhotosConfiguration googlePhotosConfiguration,
+ IGooglePhotosLanguage googlePhotosLanguage,
+ INetworkConfiguration networkConfiguration)
{
_googlePhotosConfiguration = googlePhotosConfiguration;
_googlePhotosLanguage = googlePhotosLanguage;
+ _networkConfiguration = networkConfiguration;
_oAuth2Settings = new OAuth2Settings
{
@@ -157,7 +162,7 @@ namespace Greenshot.Addon.GooglePhotos
string filename = surface.GenerateFilename(CoreConfiguration, _googlePhotosConfiguration);
var oAuthHttpBehaviour = HttpBehaviour.Current.ShallowClone();
-
+ oAuthHttpBehaviour.HttpSettings = _networkConfiguration;
// Use UploadProgress
if (progress != null)
{
diff --git a/src/Greenshot.Addon.Imgur/ImgurApi.cs b/src/Greenshot.Addon.Imgur/ImgurApi.cs
index e80923a5f..7c499a430 100644
--- a/src/Greenshot.Addon.Imgur/ImgurApi.cs
+++ b/src/Greenshot.Addon.Imgur/ImgurApi.cs
@@ -61,7 +61,10 @@ namespace Greenshot.Addon.Imgur
private HttpBehaviour Behaviour { get; }
[ImportingConstructor]
- public ImgurApi(IImgurConfiguration imgurConfiguration, ICoreConfiguration coreConfiguration)
+ public ImgurApi(
+ IImgurConfiguration imgurConfiguration,
+ ICoreConfiguration coreConfiguration,
+ INetworkConfiguration networkConfiguration)
{
_imgurConfiguration = imgurConfiguration;
_coreConfiguration = coreConfiguration;
@@ -87,7 +90,8 @@ namespace Greenshot.Addon.Imgur
Behaviour = new HttpBehaviour
{
- JsonSerializer = new JsonNetJsonSerializer(),
+ HttpSettings = networkConfiguration,
+ JsonSerializer = new JsonNetJsonSerializer(),
OnHttpClientCreated = httpClient =>
{
httpClient.SetAuthorization("Client-ID", _imgurConfiguration.ClientId);
diff --git a/src/Greenshot.Addon.Jira/JiraConnector.cs b/src/Greenshot.Addon.Jira/JiraConnector.cs
index 76b0ba866..a29ff1699 100644
--- a/src/Greenshot.Addon.Jira/JiraConnector.cs
+++ b/src/Greenshot.Addon.Jira/JiraConnector.cs
@@ -65,13 +65,17 @@ namespace Greenshot.Addon.Jira
private DateTimeOffset _loggedInTime = DateTimeOffset.MinValue;
[ImportingConstructor]
- public JiraConnector(IJiraConfiguration jiraConfiguration, JiraMonitor jiraMonitor, ICoreConfiguration coreConfiguration)
+ public JiraConnector(
+ IJiraConfiguration jiraConfiguration,
+ JiraMonitor jiraMonitor,
+ ICoreConfiguration coreConfiguration,
+ INetworkConfiguration networkConfiguration)
{
jiraConfiguration.Url = jiraConfiguration.Url.Replace(DefaultPostfix, "");
_jiraConfiguration = jiraConfiguration;
_jiraMonitor = jiraMonitor;
_coreConfiguration = coreConfiguration;
- _jiraClient = JiraClient.Create(new Uri(jiraConfiguration.Url));
+ _jiraClient = JiraClient.Create(new Uri(jiraConfiguration.Url), networkConfiguration);
}
public Bitmap FavIcon { get; private set; }
diff --git a/src/Greenshot.Addon.Lutim/LutimApi.cs b/src/Greenshot.Addon.Lutim/LutimApi.cs
index f120ad5e5..c26382ef7 100644
--- a/src/Greenshot.Addon.Lutim/LutimApi.cs
+++ b/src/Greenshot.Addon.Lutim/LutimApi.cs
@@ -1,165 +1,165 @@
-/*
- * Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
- *
- * For more information see: http://getgreenshot.org/
- * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Net;
-using System.Threading;
-using System.Threading.Tasks;
-using Dapplo.HttpExtensions;
-using Dapplo.Log;
-using Greenshot.Addon.Lutim.Entities;
-using Greenshot.Addons.Core;
-using Greenshot.Addons.Interfaces;
-
-namespace Greenshot.Addon.Lutim
-{
- ///
- /// A collection of Lutim API methods
- ///
- [Export]
- public class LutimApi
- {
- private static readonly LogSource Log = new LogSource();
- private readonly ILutimConfiguration _lutimConfiguration;
- private readonly ICoreConfiguration _coreConfiguration;
-
- [ImportingConstructor]
- public LutimApi(ILutimConfiguration lutimConfiguration, ICoreConfiguration coreConfiguration)
- {
- _lutimConfiguration = lutimConfiguration;
- _coreConfiguration = coreConfiguration;
- }
-
- ///
- /// Check if we need to load the history
- ///
- ///
- public bool IsHistoryLoadingNeeded()
- {
- Log.Info().WriteLine("Checking if lutim cache loading needed, configuration has {0} lutim hashes, loaded are {1} hashes.", _lutimConfiguration.LutimUploadHistory.Count, _lutimConfiguration.RuntimeLutimHistory.Count);
- return _lutimConfiguration.RuntimeLutimHistory.Count != _lutimConfiguration.LutimUploadHistory.Count;
- }
-
- ///
- /// Load the complete history of the lutim uploads, with the corresponding information
- ///
- public void LoadHistory()
- {
- if (!IsHistoryLoadingNeeded())
- {
- return;
- }
-
- // Load the ImUr history
- foreach (string key in _lutimConfiguration.LutimUploadHistory.Keys.ToList())
- {
- if (_lutimConfiguration.RuntimeLutimHistory.ContainsKey(key))
- {
- // Already loaded
- continue;
- }
-
- try
- {
- var value = _lutimConfiguration.LutimUploadHistory[key];
- // TODO: Read from something
- //LutimInfo lutimInfo = LutimInfo.FromIniString(key, value);
- // Config.RuntimeLutimHistory[key] = lutimInfo;
- }
- catch (ArgumentException)
- {
- Log.Info().WriteLine("Bad format of lutim history item for short {0}", key);
- _lutimConfiguration.LutimUploadHistory.Remove(key);
- _lutimConfiguration.RuntimeLutimHistory.Remove(key);
- }
- catch (Exception e)
- {
- Log.Error().WriteLine(e, "Problem loading lutim history for short " + key);
- }
- }
- }
-
- ///
- /// Do the actual upload to Lutim
- /// For more details on the available parameters, see: http://api.lutim.com/resources_anon
- ///
- /// ISurface to upload
- /// LutimInfo with details
- public async Task UploadToLutim(ISurface surfaceToUpload)
- {
- var baseUrl = new Uri(_lutimConfiguration.LutimUrl);
-
- // TODO: Upload
- var result = await baseUrl.PostAsync("");
- return result.LutimInfo;
- }
-
- ///
- /// Delete an lutim image, this is done by specifying the delete hash
- ///
- ///
- public async Task DeleteLutimImage(AddResult lutimInfo)
- {
- Log.Info().WriteLine("Deleting Lutim image for {0}", lutimInfo.LutimInfo.Short);
-
- var lutimBaseUri = new Uri(_lutimConfiguration.LutimUrl);
- var deleteUri = lutimBaseUri.AppendSegments("d", lutimInfo.LutimInfo.RealShort, lutimInfo.LutimInfo.Token).ExtendQuery("format", "json");
-
- var httpResponse = await deleteUri.GetAsAsync>();
-
- if (httpResponse.StatusCode != HttpStatusCode.BadRequest)
- {
- throw new Exception(httpResponse.ErrorResponse);
- }
-
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
+ *
+ * For more information see: http://getgreenshot.org/
+ * The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.Linq;
+using System.Net;
+using System.Threading;
+using System.Threading.Tasks;
+using Dapplo.HttpExtensions;
+using Dapplo.Log;
+using Greenshot.Addon.Lutim.Entities;
+using Greenshot.Addons.Core;
+using Greenshot.Addons.Interfaces;
+
+namespace Greenshot.Addon.Lutim
+{
+ ///
+ /// A collection of Lutim API methods
+ ///
+ [Export]
+ public class LutimApi
+ {
+ private static readonly LogSource Log = new LogSource();
+ private readonly ILutimConfiguration _lutimConfiguration;
+ private readonly ICoreConfiguration _coreConfiguration;
+
+ [ImportingConstructor]
+ public LutimApi(ILutimConfiguration lutimConfiguration, ICoreConfiguration coreConfiguration)
+ {
+ _lutimConfiguration = lutimConfiguration;
+ _coreConfiguration = coreConfiguration;
+ }
+
+ ///
+ /// Check if we need to load the history
+ ///
+ ///
+ public bool IsHistoryLoadingNeeded()
+ {
+ Log.Info().WriteLine("Checking if lutim cache loading needed, configuration has {0} lutim hashes, loaded are {1} hashes.", _lutimConfiguration.LutimUploadHistory.Count, _lutimConfiguration.RuntimeLutimHistory.Count);
+ return _lutimConfiguration.RuntimeLutimHistory.Count != _lutimConfiguration.LutimUploadHistory.Count;
+ }
+
+ ///
+ /// Load the complete history of the lutim uploads, with the corresponding information
+ ///
+ public void LoadHistory()
+ {
+ if (!IsHistoryLoadingNeeded())
+ {
+ return;
+ }
+
+ // Load the ImUr history
+ foreach (string key in _lutimConfiguration.LutimUploadHistory.Keys.ToList())
+ {
+ if (_lutimConfiguration.RuntimeLutimHistory.ContainsKey(key))
+ {
+ // Already loaded
+ continue;
+ }
+
+ try
+ {
+ var value = _lutimConfiguration.LutimUploadHistory[key];
+ // TODO: Read from something
+ //LutimInfo lutimInfo = LutimInfo.FromIniString(key, value);
+ // Config.RuntimeLutimHistory[key] = lutimInfo;
+ }
+ catch (ArgumentException)
+ {
+ Log.Info().WriteLine("Bad format of lutim history item for short {0}", key);
+ _lutimConfiguration.LutimUploadHistory.Remove(key);
+ _lutimConfiguration.RuntimeLutimHistory.Remove(key);
+ }
+ catch (Exception e)
+ {
+ Log.Error().WriteLine(e, "Problem loading lutim history for short " + key);
+ }
+ }
+ }
+
+ ///
+ /// Do the actual upload to Lutim
+ /// For more details on the available parameters, see: http://api.lutim.com/resources_anon
+ ///
+ /// ISurface to upload
+ /// LutimInfo with details
+ public async Task UploadToLutim(ISurface surfaceToUpload)
+ {
+ var baseUrl = new Uri(_lutimConfiguration.LutimUrl);
+
+ // TODO: Upload
+ var result = await baseUrl.PostAsync("");
+ return result.LutimInfo;
+ }
+
+ ///
+ /// Delete an lutim image, this is done by specifying the delete hash
+ ///
+ ///
+ public async Task DeleteLutimImage(AddResult lutimInfo)
+ {
+ Log.Info().WriteLine("Deleting Lutim image for {0}", lutimInfo.LutimInfo.Short);
+
+ var lutimBaseUri = new Uri(_lutimConfiguration.LutimUrl);
+ var deleteUri = lutimBaseUri.AppendSegments("d", lutimInfo.LutimInfo.RealShort, lutimInfo.LutimInfo.Token).ExtendQuery("format", "json");
+
+ var httpResponse = await deleteUri.GetAsAsync>();
+
+ if (httpResponse.StatusCode != HttpStatusCode.BadRequest)
+ {
+ throw new Exception(httpResponse.ErrorResponse);
+ }
+
Log.Info().WriteLine("Delete result: {0}", httpResponse.Response);
- // Make sure we remove it from the history, if no error occured
- _lutimConfiguration.RuntimeLutimHistory.Remove(lutimInfo.LutimInfo.Short);
- _lutimConfiguration.LutimUploadHistory.Remove(lutimInfo.LutimInfo.Short);
- }
-
- ///
- /// Helper for logging
- ///
- ///
- ///
- private void LogHeader(IDictionary nameValues, string key)
- {
- if (nameValues.ContainsKey(key))
- {
- Log.Info().WriteLine("{0}={1}", key, nameValues[key]);
- }
- }
-
- public Task RetrieveLutimInfoAsync(string hash, string s, CancellationToken cancellationToken)
- {
- throw new NotImplementedException();
- }
-
- public Task RetrieveLutimThumbnailAsync(LutimInfo lutimInfo, CancellationToken cancellationToken)
- {
- throw new NotImplementedException();
- }
- }
-}
+ // Make sure we remove it from the history, if no error occured
+ _lutimConfiguration.RuntimeLutimHistory.Remove(lutimInfo.LutimInfo.Short);
+ _lutimConfiguration.LutimUploadHistory.Remove(lutimInfo.LutimInfo.Short);
+ }
+
+ ///
+ /// Helper for logging
+ ///
+ ///
+ ///
+ private void LogHeader(IDictionary nameValues, string key)
+ {
+ if (nameValues.ContainsKey(key))
+ {
+ Log.Info().WriteLine("{0}={1}", key, nameValues[key]);
+ }
+ }
+
+ public Task RetrieveLutimInfoAsync(string hash, string s, CancellationToken cancellationToken)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task RetrieveLutimThumbnailAsync(LutimInfo lutimInfo, CancellationToken cancellationToken)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs
index 4e02c6a92..d4bd468b3 100644
--- a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs
+++ b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs
@@ -66,13 +66,13 @@ namespace Greenshot.Addon.OneDrive
private static readonly Uri OneDriveUri = GraphUri.AppendSegments("v1.0", "me", "drive");
private static readonly Uri OAuth2Uri = new Uri("https://login.microsoftonline.com").AppendSegments("common", "oauth2", "v2.0");
- private static readonly HttpBehaviour OneDriveHttpBehaviour = new HttpBehaviour
- {
- JsonSerializer = new JsonNetJsonSerializer()
- };
+ private readonly HttpBehaviour _oneDriveHttpBehaviour;
[ImportingConstructor]
- public OneDriveDestination(IOneDriveConfiguration oneDriveConfiguration, IOneDriveLanguage oneDriveLanguage)
+ public OneDriveDestination(
+ IOneDriveConfiguration oneDriveConfiguration,
+ IOneDriveLanguage oneDriveLanguage,
+ INetworkConfiguration networkConfiguration)
{
_oneDriveConfiguration = oneDriveConfiguration;
_oneDriveLanguage = oneDriveLanguage;
@@ -96,6 +96,11 @@ namespace Greenshot.Addon.OneDrive
AuthorizeMode = AuthorizeModes.EmbeddedBrowser,
Token = oneDriveConfiguration
};
+ _oneDriveHttpBehaviour = new HttpBehaviour
+ {
+ HttpSettings = networkConfiguration,
+ JsonSerializer = new JsonNetJsonSerializer()
+ };
}
public override string Description => _oneDriveLanguage.UploadMenuItem;
@@ -196,7 +201,7 @@ namespace Greenshot.Addon.OneDrive
{
var filename = surfaceToUpload.GenerateFilename(CoreConfiguration, _oneDriveConfiguration);
var uploadUri = OneDriveUri.AppendSegments("root:", "Screenshots", filename + ":", "content");
- var localBehaviour = OneDriveHttpBehaviour.ShallowClone();
+ var localBehaviour = _oneDriveHttpBehaviour.ShallowClone();
if (progress != null)
{
localBehaviour.UploadProgress = percent => { UiContext.RunOn(() => progress.Report((int)(percent * 100)), token); };
@@ -219,7 +224,7 @@ namespace Greenshot.Addon.OneDrive
string imageId, OneDriveLinkType oneDriveLinkType)
{
var sharableLink = OneDriveUri.AppendSegments("items", imageId, "createLink");
- var localBehaviour = OneDriveHttpBehaviour.ShallowClone();
+ var localBehaviour = _oneDriveHttpBehaviour.ShallowClone();
var oauthHttpBehaviour = OAuth2HttpBehaviourFactory.Create(oAuth2Settings, localBehaviour);
oauthHttpBehaviour.MakeCurrent();
var body = new OneDriveGetLinkRequest();
diff --git a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs
index 5a9a0bf1c..bc2472b15 100644
--- a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs
+++ b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs
@@ -43,7 +43,6 @@ using Greenshot.Addons.Addons;
using Greenshot.Addons.Core;
using Greenshot.Addons.Extensions;
using Greenshot.Addons.Interfaces;
-using Greenshot.Addons.Interfaces.Plugin;
using Greenshot.Gfx;
#endregion
@@ -61,6 +60,7 @@ namespace Greenshot.Addon.Photobucket
private readonly string _albumPath;
private readonly IPhotobucketConfiguration _photobucketConfiguration;
private readonly IPhotobucketLanguage _photobucketLanguage;
+ private readonly INetworkConfiguration _networkConfiguration;
private readonly OAuth1Settings _oAuthSettings;
private readonly OAuth1HttpBehaviour _oAuthHttpBehaviour;
private IList _albumsCache;
@@ -71,12 +71,16 @@ namespace Greenshot.Addon.Photobucket
/// IPhotobucketConfiguration
/// IPhotobucketLanguage
[ImportingConstructor]
- public PhotobucketDestination(IPhotobucketConfiguration photobucketConfiguration, IPhotobucketLanguage photobucketLanguage)
+ public PhotobucketDestination(
+ IPhotobucketConfiguration photobucketConfiguration,
+ IPhotobucketLanguage photobucketLanguage,
+ INetworkConfiguration networkConfiguration)
{
_photobucketConfiguration = photobucketConfiguration;
_photobucketLanguage = photobucketLanguage;
+ _networkConfiguration = networkConfiguration;
- _oAuthSettings = new OAuth1Settings
+ _oAuthSettings = new OAuth1Settings
{
Token = photobucketConfiguration,
ClientId = photobucketConfiguration.ClientId,
@@ -99,6 +103,7 @@ namespace Greenshot.Addon.Photobucket
CheckVerifier = false
};
var oAuthHttpBehaviour = OAuth1HttpBehaviourFactory.Create(_oAuthSettings);
+ oAuthHttpBehaviour.HttpSettings = networkConfiguration;
// Store the leftover values
oAuthHttpBehaviour.OnAccessTokenValues = values =>
{
@@ -140,7 +145,7 @@ namespace Greenshot.Addon.Photobucket
/// IPhotobucketConfiguration
/// IPhotobucketLanguage
/// path to the album, null for default
- public PhotobucketDestination(IPhotobucketConfiguration photobucketConfiguration, IPhotobucketLanguage photobucketLanguage, string albumPath) : this (photobucketConfiguration, photobucketLanguage)
+ public PhotobucketDestination(IPhotobucketConfiguration photobucketConfiguration, IPhotobucketLanguage photobucketLanguage, INetworkConfiguration networkConfiguration, string albumPath) : this (photobucketConfiguration, photobucketLanguage, networkConfiguration)
{
_photobucketConfiguration = photobucketConfiguration;
_albumPath = albumPath;
@@ -193,7 +198,7 @@ namespace Greenshot.Addon.Photobucket
}
foreach (var album in albums)
{
- yield return new PhotobucketDestination(_photobucketConfiguration, _photobucketLanguage, album);
+ yield return new PhotobucketDestination(_photobucketConfiguration, _photobucketLanguage, _networkConfiguration, album);
}
}
diff --git a/src/Greenshot.Addons/Core/INetworkConfiguration.cs b/src/Greenshot.Addons/Core/INetworkConfiguration.cs
index 27022b4e1..f19da36a4 100644
--- a/src/Greenshot.Addons/Core/INetworkConfiguration.cs
+++ b/src/Greenshot.Addons/Core/INetworkConfiguration.cs
@@ -23,16 +23,10 @@
#region Usings
-using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.Drawing;
using Dapplo.HttpExtensions;
using Dapplo.Ini;
using Dapplo.InterfaceImpl.Extensions;
-using Dapplo.Windows.Common.Structs;
-using Greenshot.Addons.Core.Enums;
-using Greenshot.Addons.Interfaces;
#endregion