diff --git a/GreenshotImgurPlugin/Forms/ImgurHistory.Designer.cs b/GreenshotImgurPlugin/Forms/ImgurHistory.Designer.cs
index 79633ad04..26f73dddc 100644
--- a/GreenshotImgurPlugin/Forms/ImgurHistory.Designer.cs
+++ b/GreenshotImgurPlugin/Forms/ImgurHistory.Designer.cs
@@ -155,7 +155,7 @@ namespace GreenshotImgurPlugin
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.listview_imgur_uploads);
this.Name = "ImgurHistory";
- this.Text = "ImgurHistory";
+ this.LanguageKey = "imgur.history";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ImgurHistoryFormClosing);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
diff --git a/GreenshotImgurPlugin/Forms/ImgurHistory.cs b/GreenshotImgurPlugin/Forms/ImgurHistory.cs
index b795b6adc..da20e92c1 100644
--- a/GreenshotImgurPlugin/Forms/ImgurHistory.cs
+++ b/GreenshotImgurPlugin/Forms/ImgurHistory.cs
@@ -31,7 +31,7 @@ namespace GreenshotImgurPlugin {
///
/// Description of ImgurHistory.
///
- public partial class ImgurHistory : Form {
+ public partial class ImgurHistory : ImgurForm {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImgurHistory));
private GreenshotColumnSorter columnSorter;
private static ImgurConfiguration config = IniConfig.GetIniSection();
@@ -48,6 +48,7 @@ namespace GreenshotImgurPlugin {
}
private ImgurHistory() {
+ this.ManualLanguageApply = true;
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
@@ -63,6 +64,10 @@ namespace GreenshotImgurPlugin {
if (listview_imgur_uploads.Items.Count > 0) {
listview_imgur_uploads.Items[0].Selected = true;
}
+ ApplyLanguage();
+ if (config.Credits > 0) {
+ this.Text = this.Text + " (" + config.Credits + " credits)";
+ }
}
private void redraw() {
diff --git a/GreenshotImgurPlugin/ImgurConfiguration.cs b/GreenshotImgurPlugin/ImgurConfiguration.cs
index 23e140e07..0eec9d764 100644
--- a/GreenshotImgurPlugin/ImgurConfiguration.cs
+++ b/GreenshotImgurPlugin/ImgurConfiguration.cs
@@ -49,6 +49,10 @@ namespace GreenshotImgurPlugin {
// Not stored, only run-time!
public Dictionary runtimeImgurHistory = new Dictionary();
+ public int Credits {
+ get;
+ set;
+ }
///
/// Supply values we can't put as defaults
diff --git a/GreenshotImgurPlugin/ImgurUtils.cs b/GreenshotImgurPlugin/ImgurUtils.cs
index 91997fb3c..63d14f837 100644
--- a/GreenshotImgurPlugin/ImgurUtils.cs
+++ b/GreenshotImgurPlugin/ImgurUtils.cs
@@ -160,6 +160,7 @@ namespace GreenshotImgurPlugin {
}
string responseString;
using (WebResponse response = webRequest.GetResponse()) {
+ LogCredits(response);
Stream responseStream = response.GetResponseStream();
StreamReader responseReader = new StreamReader(responseStream);
responseString = responseReader.ReadToEnd();
@@ -181,6 +182,7 @@ namespace GreenshotImgurPlugin {
webRequest.ServicePoint.Expect100Continue = false;
using (WebResponse response = webRequest.GetResponse()) {
+ LogCredits(response);
Stream responseStream = response.GetResponseStream();
imgurInfo.Image = Image.FromStream(responseStream);
}
@@ -196,6 +198,7 @@ namespace GreenshotImgurPlugin {
string responseString;
try {
using (WebResponse response = webRequest.GetResponse()) {
+ LogCredits(response);
Stream responseStream = response.GetResponseStream();
StreamReader responseReader = new StreamReader(responseStream);
responseString = responseReader.ReadToEnd();
@@ -227,6 +230,7 @@ namespace GreenshotImgurPlugin {
string responseString;
using (WebResponse response = webRequest.GetResponse()) {
+ LogCredits(response);
Stream responseStream = response.GetResponseStream();
StreamReader responseReader = new StreamReader(responseStream);
responseString = responseReader.ReadToEnd();
@@ -245,5 +249,17 @@ namespace GreenshotImgurPlugin {
config.ImgurUploadHistory.Remove(imgurInfo.Hash);
imgurInfo.Image = null;
}
+
+ private static void LogCredits(WebResponse response) {
+ try {
+ int credits = 0;
+ if (int.TryParse(response.Headers["X-RateLimit-Remaining"], out credits)) {
+ config.Credits = credits;
+ }
+ LOG.InfoFormat("X-RateLimit-Limit={0}", response.Headers["X-RateLimit-Limit"]);
+ LOG.InfoFormat("X-RateLimit-Remaining={0}", response.Headers["X-RateLimit-Remaining"]);
+
+ } catch {}
+ }
}
}