Fixed design-time displaying of the language mappings

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1778 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-04-17 13:17:44 +00:00
parent 27910e584a
commit b585a239b6
15 changed files with 83 additions and 117 deletions

View file

@ -1,20 +1,31 @@
using System; /*
using System.Collections.Generic; * Greenshot - a free and open source screenshot tool
using System.Text; * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
using GreenshotPlugin.Controls; *
using GreenshotPlugin.Core; * For more information see: http://getgreenshot.org/
using Greenshot.IniFile; * The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
using System.ComponentModel.Design; *
using System.Reflection; * This program is free software: you can redistribute it and/or modify
using System.IO; * it under the terms of the GNU General Public License as published by
using System.Windows.Forms; * 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 <http://www.gnu.org/licenses/>.
*/
using System;
namespace GreenshotImgurPlugin.Forms { namespace GreenshotImgurPlugin {
public class ImgurForm : GreenshotForm { /// <summary>
protected override string LanguagePattern { /// This class is needed for design-time resolving of the language files
get { /// </summary>
return Language.LANGUAGE_FILENAME_PATTERN; public class ImgurForm : GreenshotPlugin.Controls.GreenshotForm {
} public ImgurForm() : base() {
} }
} }
} }

View file

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
namespace GreenshotImgurPlugin.Forms namespace GreenshotImgurPlugin
{ {
partial class ImgurHistory partial class ImgurHistory
{ {

View file

@ -27,7 +27,7 @@ using GreenshotPlugin.Controls;
using GreenshotPlugin.Core; using GreenshotPlugin.Core;
using Greenshot.IniFile; using Greenshot.IniFile;
namespace GreenshotImgurPlugin.Forms { namespace GreenshotImgurPlugin {
/// <summary> /// <summary>
/// Description of ImgurHistory. /// Description of ImgurHistory.
/// </summary> /// </summary>
@ -35,7 +35,6 @@ namespace GreenshotImgurPlugin.Forms {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImgurHistory)); private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImgurHistory));
private ListViewColumnSorter columnSorter; private ListViewColumnSorter columnSorter;
private static ImgurConfiguration config = IniConfig.GetIniSection<ImgurConfiguration>(); private static ImgurConfiguration config = IniConfig.GetIniSection<ImgurConfiguration>();
private ILanguage lang = Language.GetInstance();
private static ImgurHistory instance; private static ImgurHistory instance;
public static void ShowHistory() { public static void ShowHistory() {
@ -119,9 +118,9 @@ namespace GreenshotImgurPlugin.Forms {
pictureBox1.Image = pictureBox1.ErrorImage; pictureBox1.Image = pictureBox1.ErrorImage;
for (int i = 0; i < listview_imgur_uploads.SelectedItems.Count; i++) { for (int i = 0; i < listview_imgur_uploads.SelectedItems.Count; i++) {
ImgurInfo imgurInfo = (ImgurInfo)listview_imgur_uploads.SelectedItems[i].Tag; ImgurInfo imgurInfo = (ImgurInfo)listview_imgur_uploads.SelectedItems[i].Tag;
DialogResult result = MessageBox.Show(lang.GetFormattedString(LangKey.delete_question, imgurInfo.Title), lang.GetFormattedString(LangKey.delete_title, imgurInfo.Hash), MessageBoxButtons.YesNo, MessageBoxIcon.Question); DialogResult result = MessageBox.Show(Language.GetFormattedString("imgur", LangKey.delete_question, imgurInfo.Title), Language.GetFormattedString("imgur", LangKey.delete_title, imgurInfo.Hash), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes) { if (result == DialogResult.Yes) {
BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(ImgurPlugin.Attributes.Name, lang.GetString(LangKey.communication_wait)); BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(ImgurPlugin.Attributes.Name, Language.GetString("imgur", LangKey.communication_wait));
try { try {
ImgurUtils.DeleteImgurImage(imgurInfo); ImgurUtils.DeleteImgurImage(imgurInfo);
} catch (Exception ex) { } catch (Exception ex) {
@ -161,7 +160,7 @@ namespace GreenshotImgurPlugin.Forms {
} }
private void ClearHistoryButtonClick(object sender, EventArgs e) { private void ClearHistoryButtonClick(object sender, EventArgs e) {
DialogResult result = MessageBox.Show(lang.GetString(LangKey.clear_question), "Imgur", MessageBoxButtons.YesNo, MessageBoxIcon.Question); DialogResult result = MessageBox.Show(Language.GetString("imgur", LangKey.clear_question), "Imgur", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes) { if (result == DialogResult.Yes) {
config.runtimeImgurHistory.Clear(); config.runtimeImgurHistory.Clear();
config.ImgurUploadHistory.Clear(); config.ImgurUploadHistory.Clear();

View file

@ -59,7 +59,7 @@ namespace GreenshotImgurPlugin {
// buttonOK // buttonOK
// //
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.LanguageKey = "OK"; this.buttonOK.LanguageKey = "imgur.OK";
this.buttonOK.Location = new System.Drawing.Point(222, 129); this.buttonOK.Location = new System.Drawing.Point(222, 129);
this.buttonOK.Name = "buttonOK"; this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.Size = new System.Drawing.Size(75, 23);
@ -70,7 +70,7 @@ namespace GreenshotImgurPlugin {
// buttonCancel // buttonCancel
// //
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.LanguageKey = "CANCEL"; this.buttonCancel.LanguageKey = "imgur.CANCEL";
this.buttonCancel.Location = new System.Drawing.Point(303, 129); this.buttonCancel.Location = new System.Drawing.Point(303, 129);
this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.Size = new System.Drawing.Size(75, 23);
@ -80,7 +80,7 @@ namespace GreenshotImgurPlugin {
// //
// label_url // label_url
// //
this.label_url.LanguageKey = "label_url"; this.label_url.LanguageKey = "imgur.label_url";
this.label_url.Location = new System.Drawing.Point(12, 21); this.label_url.Location = new System.Drawing.Point(12, 21);
this.label_url.Name = "label_url"; this.label_url.Name = "label_url";
this.label_url.Size = new System.Drawing.Size(84, 20); this.label_url.Size = new System.Drawing.Size(84, 20);
@ -109,34 +109,32 @@ namespace GreenshotImgurPlugin {
// //
// label_upload_format // label_upload_format
// //
this.label_upload_format.LanguageKey = "label_upload_format"; this.label_upload_format.LanguageKey = "imgur.label_upload_format";
this.label_upload_format.Location = new System.Drawing.Point(12, 50); this.label_upload_format.Location = new System.Drawing.Point(12, 50);
this.label_upload_format.Name = "label_upload_format"; this.label_upload_format.Name = "label_upload_format";
this.label_upload_format.Size = new System.Drawing.Size(84, 20); this.label_upload_format.Size = new System.Drawing.Size(84, 20);
this.label_upload_format.TabIndex = 9; this.label_upload_format.TabIndex = 9;
this.label_upload_format.Text = "Image format";
// //
// historyButton // historyButton
// //
this.historyButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.historyButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.historyButton.LanguageKey = "imgur_history"; this.historyButton.LanguageKey = "imgur.history";
this.historyButton.Location = new System.Drawing.Point(13, 129); this.historyButton.Location = new System.Drawing.Point(13, 129);
this.historyButton.Name = "historyButton"; this.historyButton.Name = "historyButton";
this.historyButton.Size = new System.Drawing.Size(75, 23); this.historyButton.Size = new System.Drawing.Size(75, 23);
this.historyButton.TabIndex = 11; this.historyButton.TabIndex = 11;
this.historyButton.Text = "History";
this.historyButton.UseVisualStyleBackColor = true; this.historyButton.UseVisualStyleBackColor = true;
this.historyButton.Click += new System.EventHandler(this.ButtonHistoryClick); this.historyButton.Click += new System.EventHandler(this.ButtonHistoryClick);
// //
// checkbox_usepagelink // checkbox_usepagelink
// //
this.checkbox_usepagelink.AutoSize = true; this.checkbox_usepagelink.AutoSize = true;
this.checkbox_usepagelink.LanguageKey = "use_page_link"; this.checkbox_usepagelink.LanguageKey = "imgur.use_page_link";
this.checkbox_usepagelink.Location = new System.Drawing.Point(15, 97); this.checkbox_usepagelink.Location = new System.Drawing.Point(15, 97);
this.checkbox_usepagelink.Name = "checkbox_usepagelink"; this.checkbox_usepagelink.Name = "checkbox_usepagelink";
this.checkbox_usepagelink.PropertyName = "UsePageLink"; this.checkbox_usepagelink.PropertyName = "UsePageLink";
this.checkbox_usepagelink.SectionName = "Imgur"; this.checkbox_usepagelink.SectionName = "Imgur";
this.checkbox_usepagelink.Size = new System.Drawing.Size(251, 17); this.checkbox_usepagelink.Size = new System.Drawing.Size(297, 17);
this.checkbox_usepagelink.TabIndex = 13; this.checkbox_usepagelink.TabIndex = 13;
this.checkbox_usepagelink.UseVisualStyleBackColor = true; this.checkbox_usepagelink.UseVisualStyleBackColor = true;
// //
@ -154,10 +152,10 @@ namespace GreenshotImgurPlugin {
this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK); this.Controls.Add(this.buttonOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.LanguageKey = "imgur.settings_title";
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "SettingsForm"; this.Name = "SettingsForm";
this.Text = "Imgur settings";
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View file

@ -20,7 +20,6 @@
*/ */
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using GreenshotImgurPlugin.Forms;
using GreenshotPlugin.Core; using GreenshotPlugin.Core;
using GreenshotPlugin.Controls; using GreenshotPlugin.Controls;
@ -29,8 +28,7 @@ namespace GreenshotImgurPlugin {
/// Description of PasswordRequestForm. /// Description of PasswordRequestForm.
/// </summary> /// </summary>
public partial class SettingsForm : ImgurForm { public partial class SettingsForm : ImgurForm {
public SettingsForm(ImgurConfiguration config) { public SettingsForm(ImgurConfiguration config) : base() {
language = Language.GetInstance();
// //
// The InitializeComponent() call is required for Windows Forms designer support. // The InitializeComponent() call is required for Windows Forms designer support.
// //

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}</ProjectGuid> <ProjectGuid>{80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -67,7 +67,6 @@
<Compile Include="ImgurPlugin.cs" /> <Compile Include="ImgurPlugin.cs" />
<Compile Include="ImgurConfiguration.cs" /> <Compile Include="ImgurConfiguration.cs" />
<Compile Include="ImgurUtils.cs" /> <Compile Include="ImgurUtils.cs" />
<Compile Include="Language.cs" />
<Compile Include="LanguageKeys.cs" /> <Compile Include="LanguageKeys.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<None Include="Languages\language_imgurplugin-de-DE.xml"> <None Include="Languages\language_imgurplugin-de-DE.xml">

View file

@ -68,9 +68,8 @@ namespace GreenshotImgurPlugin {
/// <returns>bool true if OK was pressed, false if cancel</returns> /// <returns>bool true if OK was pressed, false if cancel</returns>
public bool ShowConfigDialog() { public bool ShowConfigDialog() {
SettingsForm settingsForm; SettingsForm settingsForm;
ILanguage lang = Language.GetInstance();
BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(ImgurPlugin.Attributes.Name, lang.GetString(LangKey.communication_wait)); BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(ImgurPlugin.Attributes.Name, Language.GetString("Imgur", LangKey.communication_wait));
try { try {
settingsForm = new SettingsForm(this); settingsForm = new SettingsForm(this);
} finally { } finally {

View file

@ -37,13 +37,10 @@ namespace GreenshotImgurPlugin {
public class ImgurDestination : AbstractDestination { public class ImgurDestination : AbstractDestination {
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImgurDestination)); private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImgurDestination));
private static ImgurConfiguration config = IniConfig.GetIniSection<ImgurConfiguration>(); private static ImgurConfiguration config = IniConfig.GetIniSection<ImgurConfiguration>();
private ILanguage lang = Language.GetInstance();
private ImgurPlugin plugin = null; private ImgurPlugin plugin = null;
private ILanguage coreLanguage;
public ImgurDestination(ImgurPlugin plugin) { public ImgurDestination(ImgurPlugin plugin) {
this.plugin = plugin; this.plugin = plugin;
this.coreLanguage = plugin.CoreLanguage;
} }
public override string Designation { public override string Designation {
@ -54,7 +51,7 @@ namespace GreenshotImgurPlugin {
public override string Description { public override string Description {
get { get {
return lang.GetString(LangKey.upload_menu_item); return Language.GetString("imgur", LangKey.upload_menu_item);
} }
} }
@ -69,7 +66,7 @@ namespace GreenshotImgurPlugin {
using (Image image = surface.GetImageForExport()) { using (Image image = surface.GetImageForExport()) {
bool uploaded = plugin.Upload(captureDetails, image); bool uploaded = plugin.Upload(captureDetails, image);
if (uploaded) { if (uploaded) {
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, coreLanguage.GetFormattedString("exported_to", Description)); surface.SendMessageEvent(this, SurfaceMessageTyp.Info, Language.GetFormattedString("imgur", "exported_to", Description));
surface.Modified = false; surface.Modified = false;
} }
return uploaded; return uploaded;

View file

@ -27,7 +27,6 @@ using System.Windows.Forms;
using System.Threading; using System.Threading;
using Greenshot.Plugin; using Greenshot.Plugin;
using GreenshotImgurPlugin.Forms;
using GreenshotPlugin.Controls; using GreenshotPlugin.Controls;
using GreenshotPlugin.Core; using GreenshotPlugin.Core;
using Greenshot.IniFile; using Greenshot.IniFile;
@ -40,7 +39,6 @@ namespace GreenshotImgurPlugin {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImgurPlugin)); private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImgurPlugin));
private static ImgurConfiguration config; private static ImgurConfiguration config;
public static PluginAttribute Attributes; public static PluginAttribute Attributes;
private ILanguage lang = Language.GetInstance();
private IGreenshotHost host; private IGreenshotHost host;
private ComponentResourceManager resources; private ComponentResourceManager resources;
private ToolStripMenuItem historyMenuItem = null; private ToolStripMenuItem historyMenuItem = null;
@ -48,11 +46,6 @@ namespace GreenshotImgurPlugin {
public ImgurPlugin() { public ImgurPlugin() {
} }
public ILanguage CoreLanguage {
get {
return host.CoreLanguage;
}
}
public IEnumerable<IDestination> Destinations() { public IEnumerable<IDestination> Destinations() {
yield return new ImgurDestination(this); yield return new ImgurDestination(this);
} }
@ -79,14 +72,14 @@ namespace GreenshotImgurPlugin {
ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur"); ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur");
itemPlugInRoot.Image = (Image)resources.GetObject("Imgur"); itemPlugInRoot.Image = (Image)resources.GetObject("Imgur");
historyMenuItem = new ToolStripMenuItem(lang.GetString(LangKey.imgur_history)); historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.imgur_history));
historyMenuItem.Tag = host; historyMenuItem.Tag = host;
historyMenuItem.Click += delegate { historyMenuItem.Click += delegate {
ImgurHistory.ShowHistory(); ImgurHistory.ShowHistory();
}; };
itemPlugInRoot.DropDownItems.Add(historyMenuItem); itemPlugInRoot.DropDownItems.Add(historyMenuItem);
ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem(lang.GetString(LangKey.imgur_configure)); ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.imgur_configure));
itemPlugInConfig.Tag = host; itemPlugInConfig.Tag = host;
itemPlugInConfig.Click += delegate { itemPlugInConfig.Click += delegate {
config.ShowConfigDialog(); config.ShowConfigDialog();
@ -138,7 +131,7 @@ namespace GreenshotImgurPlugin {
public bool Upload(ICaptureDetails captureDetails, Image image) { public bool Upload(ICaptureDetails captureDetails, Image image) {
using (MemoryStream stream = new MemoryStream()) { using (MemoryStream stream = new MemoryStream()) {
BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Attributes.Name, lang.GetString(LangKey.communication_wait)); BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Attributes.Name, Language.GetString("imgur", LangKey.communication_wait));
host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors); host.SaveToStream(image, stream, config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
try { try {
@ -161,7 +154,7 @@ namespace GreenshotImgurPlugin {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
MessageBox.Show(lang.GetString(LangKey.upload_failure) + " " + e.Message); MessageBox.Show(Language.GetString("imgur", LangKey.upload_failure) + " " + e.Message);
} finally { } finally {
backgroundForm.CloseDialog(); backgroundForm.CloseDialog();
} }
@ -176,7 +169,7 @@ namespace GreenshotImgurPlugin {
ToolStripMenuItem item = (ToolStripMenuItem)sender; ToolStripMenuItem item = (ToolStripMenuItem)sender;
IImageEditor imageEditor = (IImageEditor)item.Tag; IImageEditor imageEditor = (IImageEditor)item.Tag;
using (MemoryStream stream = new MemoryStream()) { using (MemoryStream stream = new MemoryStream()) {
BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Attributes.Name, lang.GetString(LangKey.communication_wait)); BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Attributes.Name, Language.GetString("imgur", LangKey.communication_wait));
imageEditor.SaveToStream(stream, config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors); imageEditor.SaveToStream(stream, config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
try { try {
@ -199,7 +192,7 @@ namespace GreenshotImgurPlugin {
Clipboard.SetText(imgurInfo.Original); Clipboard.SetText(imgurInfo.Original);
} }
} catch(Exception e) { } catch(Exception e) {
MessageBox.Show(lang.GetString(LangKey.upload_failure) + " " + e.Message); MessageBox.Show(Language.GetString("imgur", LangKey.upload_failure) + " " + e.Message);
} finally { } finally {
backgroundForm.CloseDialog(); backgroundForm.CloseDialog();
} }

View file

@ -107,7 +107,7 @@ namespace GreenshotImgurPlugin {
uploadRequest.Append(HttpUtility.UrlEncode(filename, Encoding.UTF8)); uploadRequest.Append(HttpUtility.UrlEncode(filename, Encoding.UTF8));
} }
string url = config.ImgurApiUrl + "/upload"; string url = config.ImgurApiUrl + "/upload";
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreatedWebRequest(url); HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
webRequest.Method = "POST"; webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.ContentType = "application/x-www-form-urlencoded";
@ -125,11 +125,11 @@ namespace GreenshotImgurPlugin {
LOG.Info(responseString); LOG.Info(responseString);
ImgurInfo imgurInfo = ImgurInfo.ParseResponse(responseString); ImgurInfo imgurInfo = ImgurInfo.ParseResponse(responseString);
return imgurInfo; return imgurInfo;
} }
public static void RetrieveImgurThumbnail(ImgurInfo imgurInfo) { public static void RetrieveImgurThumbnail(ImgurInfo imgurInfo) {
LOG.InfoFormat("Retrieving Imgur image for {0} with url {1}", imgurInfo.Hash, imgurInfo); LOG.InfoFormat("Retrieving Imgur image for {0} with url {1}", imgurInfo.Hash, imgurInfo);
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreatedWebRequest(imgurInfo.SmallSquare); HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(imgurInfo.SmallSquare);
webRequest.Method = "GET"; webRequest.Method = "GET";
webRequest.ServicePoint.Expect100Continue = false; webRequest.ServicePoint.Expect100Continue = false;
@ -143,7 +143,7 @@ namespace GreenshotImgurPlugin {
public static ImgurInfo RetrieveImgurInfo(string hash, string deleteHash) { public static ImgurInfo RetrieveImgurInfo(string hash, string deleteHash) {
string url = config.ImgurApiUrl + "/image/" + hash; string url = config.ImgurApiUrl + "/image/" + hash;
LOG.InfoFormat("Retrieving Imgur info for {0} with url {1}", hash, url); LOG.InfoFormat("Retrieving Imgur info for {0} with url {1}", hash, url);
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreatedWebRequest(url); HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
webRequest.Method = "GET"; webRequest.Method = "GET";
webRequest.ServicePoint.Expect100Continue = false; webRequest.ServicePoint.Expect100Continue = false;
string responseString; string responseString;
@ -172,7 +172,7 @@ namespace GreenshotImgurPlugin {
try { try {
string url = config.ImgurApiUrl + "/delete/" + imgurInfo.DeleteHash; string url = config.ImgurApiUrl + "/delete/" + imgurInfo.DeleteHash;
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreatedWebRequest(url); HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
//webRequest.Method = "DELETE"; //webRequest.Method = "DELETE";
webRequest.Method = "GET"; webRequest.Method = "GET";

View file

@ -1,40 +0,0 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/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 <http://www.gnu.org/licenses/>.
*/
using System;
using System.Threading;
using GreenshotPlugin.Core;
namespace GreenshotImgurPlugin {
/// <summary>
/// Wrapper for the language container for the Jira plugin.
/// </summary>
public class Language : LanguageContainer, ILanguage {
private static ILanguage uniqueInstance;
public const string LANGUAGE_FILENAME_PATTERN = @"language_imgurplugin-*.xml";
public static ILanguage GetInstance() {
if(uniqueInstance == null) {
uniqueInstance = new LanguageContainer(LANGUAGE_FILENAME_PATTERN);
}
return uniqueInstance;
}
}
}

View file

@ -37,10 +37,13 @@
<resource name="delete_title"> <resource name="delete_title">
Imgur {0} löschen Imgur {0} löschen
</resource> </resource>
<resource name="imgur_history"> <resource name="use_page_link">
Benutze der Seite-URL statt Bild-URL im Zwischenablage
</resource>
<resource name="history">
Verlauf Verlauf
</resource> </resource>
<resource name="imgur_configure"> <resource name="configure">
Einstellungen Einstellungen
</resource> </resource>
</resources> </resources>

View file

@ -40,10 +40,10 @@
<resource name="use_page_link"> <resource name="use_page_link">
Use page link instead of image link on clipboard Use page link instead of image link on clipboard
</resource> </resource>
<resource name="imgur_history"> <resource name="history">
History History
</resource> </resource>
<resource name="imgur_configure"> <resource name="configure">
Configure Configure
</resource> </resource>
</resources> </resources>

View file

@ -13,23 +13,29 @@
<resource name="label_use_proxy"> <resource name="label_use_proxy">
Utiliser proxy Utiliser proxy
</resource> </resource>
<resource name="OK"> <resource name="OK">
OK OK
</resource> </resource>
<resource name="CANCEL"> <resource name="CANCEL">
Annuler Annuler
</resource> </resource>
<resource name="upload_success"> <resource name="upload_success">
L'image a été téléversée vers Imgur avec succès ! L'image a été téléversée vers Imgur avec succès !
</resource> </resource>
<resource name="upload_failure"> <resource name="upload_failure">
Une erreur est survenue lors du téléversement vers Imgur: Une erreur est survenue lors du téléversement vers Imgur:
</resource> </resource>
<resource name="label_upload_format"> <resource name="label_upload_format">
Format d'image Format d'image
</resource> </resource>
<resource name="upload_wait"> <resource name="upload_wait">
Téléversement vers ImgUr, veuillez patienter... Téléversement vers ImgUr, veuillez patienter...
</resource>
<resource name="history">
Histoire
</resource>
<resource name="configure">
Configurer
</resource> </resource>
</resources> </resources>
</language> </language>

View file

@ -37,10 +37,13 @@
<resource name="delete_title"> <resource name="delete_title">
Imgur {0} verwijderen Imgur {0} verwijderen
</resource> </resource>
<resource name="imgur_history"> <resource name="use_page_link">
Geschiedenis Kopieer de pagina link in plaats van de beeld link in het klembord
</resource> </resource>
<resource name="imgur_configure"> <resource name="history">
Verloop
</resource>
<resource name="configure">
Instellingen Instellingen
</resource> </resource>
</resources> </resources>