diff --git a/Greenshot/AssemblyInfo.cs.template b/Greenshot/AssemblyInfo.cs.template
index 1996bede2..2e15ddb95 100644
--- a/Greenshot/AssemblyInfo.cs.template
+++ b/Greenshot/AssemblyInfo.cs.template
@@ -47,4 +47,4 @@ using System.Runtime.InteropServices;
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
-[assembly: AssemblyVersion("1.0.4.$WCREV$")]
+[assembly: AssemblyVersion("1.0.5.$WCREV$")]
diff --git a/Greenshot/Greenshot.sln b/Greenshot/Greenshot.sln
index 60ae08ba3..250a07fc3 100644
--- a/Greenshot/Greenshot.sln
+++ b/Greenshot/Greenshot.sln
@@ -18,13 +18,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotOCRPlugin", "..\Gr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotOCRCommand", "..\GreenshotOCRCommand\GreenshotOCRCommand.csproj", "{D61E6ECE-E0B6-4467-B492-F08A06BA8F02}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotBoxPlugin", "..\..\Greenshot-Plugins\GreenshotBoxPlugin\GreenshotBoxPlugin.csproj", "{697CF066-9077-4F22-99D9-D989CCE7282B}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotBoxPlugin", "..\GreenshotBoxPlugin\GreenshotBoxPlugin.csproj", "{697CF066-9077-4F22-99D9-D989CCE7282B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotDropboxPlugin", "..\..\Greenshot-Plugins\GreenshotDropboxPlugin\GreenshotDropboxPlugin.csproj", "{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotDropboxPlugin", "..\GreenshotDropboxPlugin\GreenshotDropboxPlugin.csproj", "{AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotFlickrPlugin", "..\..\Greenshot-Plugins\GreenshotFlickrPlugin\GreenshotFlickrPlugin.csproj", "{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotFlickrPlugin", "..\GreenshotFlickrPlugin\GreenshotFlickrPlugin.csproj", "{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotPicasaPlugin", "..\..\Greenshot-Plugins\GreenshotPicasaPlugin\GreenshotPicasaPlugin.csproj", "{1893A2E4-A78A-4713-A8E7-E70058DABEE0}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotPicasaPlugin", "..\GreenshotPicasaPlugin\GreenshotPicasaPlugin.csproj", "{1893A2E4-A78A-4713-A8E7-E70058DABEE0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenshotOfficePlugin", "..\GreenshotOfficePlugin\GreenshotOfficePlugin.csproj", "{92599C09-FF29-4ABD-B6E6-C48ECD781BAB}"
EndProject
diff --git a/GreenshotBoxPlugin/Box.png b/GreenshotBoxPlugin/Box.png
new file mode 100644
index 000000000..199a09dfd
Binary files /dev/null and b/GreenshotBoxPlugin/Box.png differ
diff --git a/GreenshotImmioPlugin/ImmioConfiguration.cs b/GreenshotBoxPlugin/BoxConfiguration.cs
similarity index 62%
rename from GreenshotImmioPlugin/ImmioConfiguration.cs
rename to GreenshotBoxPlugin/BoxConfiguration.cs
index 7a969c684..80b5b9512 100644
--- a/GreenshotImmioPlugin/ImmioConfiguration.cs
+++ b/GreenshotBoxPlugin/BoxConfiguration.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -20,41 +20,37 @@
*/
using System.Windows.Forms;
using Greenshot.IniFile;
-using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
-namespace GreenshotImmioPlugin {
+namespace GreenshotBoxPlugin {
///
- /// Description of ImmioConfiguration.
+ /// Description of ImgurConfiguration.
///
- [IniSection("Immio", Description="Greenshot Immio Plugin configuration")]
- public class ImmioConfiguration : IniSection {
+ [IniSection("Box", Description = "Greenshot Box Plugin configuration")]
+ public class BoxConfiguration : IniSection {
[IniProperty("UploadFormat", Description="What file type to use for uploading", DefaultValue="png")]
public OutputFormat UploadFormat;
+
[IniProperty("UploadJpegQuality", Description="JPEG file save quality in %.", DefaultValue="80")]
public int UploadJpegQuality;
- [IniProperty("UploadReduceColors", Description="Reduce color amount of the uploaded image to 256", DefaultValue="False")]
- public bool UploadReduceColors;
- [IniProperty("UsePageLink", Description = "Use pagelink instead of direct link on the clipboard", DefaultValue = "False")]
- public bool UsePageLink;
+
+ [IniProperty("AfterUploadLinkToClipBoard", Description = "After upload send Box link to clipboard.", DefaultValue = "true")]
+ public bool AfterUploadLinkToClipBoard;
+
+ [IniProperty("BoxToken", Description = "Token.", DefaultValue = "")]
+ public string BoxToken;
///
- /// A form for username/password
+ /// A form for token
///
/// bool true if OK was pressed, false if cancel
public bool ShowConfigDialog() {
- SettingsForm settingsForm = null;
-
- new PleaseWaitForm().ShowAndWait(ImmioPlugin.Attributes.Name, Language.GetString("immio", LangKey.communication_wait),
- delegate() {
- settingsForm = new SettingsForm(this);
- }
- );
- DialogResult result = settingsForm.ShowDialog();
+ DialogResult result = new SettingsForm(this).ShowDialog();
if (result == DialogResult.OK) {
return true;
}
return false;
}
+
}
}
diff --git a/GreenshotBoxPlugin/BoxCredentials.cs b/GreenshotBoxPlugin/BoxCredentials.cs
new file mode 100644
index 000000000..1b6b21674
--- /dev/null
+++ b/GreenshotBoxPlugin/BoxCredentials.cs
@@ -0,0 +1,31 @@
+/*
+ * 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 .
+ */
+using System;
+
+namespace GreenshotBoxPlugin {
+ ///
+ /// This class is merely a placeholder for the file keeping the API key and secret for Box integration.
+ /// Copy this file to BoxCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the plugin then.)
+ ///
+ public static class BoxCredentials {
+ public static string API_KEY = empty;
+ }
+}
\ No newline at end of file
diff --git a/GreenshotBoxPlugin/BoxCredentials.private.cs b/GreenshotBoxPlugin/BoxCredentials.private.cs
new file mode 100644
index 000000000..83d4005f2
--- /dev/null
+++ b/GreenshotBoxPlugin/BoxCredentials.private.cs
@@ -0,0 +1,31 @@
+/*
+ * 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 .
+ */
+using System;
+
+namespace GreenshotBoxPlugin {
+ ///
+ /// This class is merely a placeholder for the file keeping the API key and secret for Box integration.
+ /// Copy this file to BoxCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the plugin then.)
+ ///
+ public static class BoxCredentials {
+ public static string API_KEY = "gwjm9lx8df7y2xskay4f1yxkrakhgy7n";
+ }
+}
\ No newline at end of file
diff --git a/GreenshotImmioPlugin/ImmioDestination.cs b/GreenshotBoxPlugin/BoxDestination.cs
similarity index 70%
rename from GreenshotImmioPlugin/ImmioDestination.cs
rename to GreenshotBoxPlugin/BoxDestination.cs
index 978600cf6..36d817548 100644
--- a/GreenshotImmioPlugin/ImmioDestination.cs
+++ b/GreenshotBoxPlugin/BoxDestination.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -24,44 +24,43 @@ using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
-namespace GreenshotImmioPlugin {
- ///
- /// Description of ImmioDestination.
- ///
- public class ImmioDestination : AbstractDestination {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImmioDestination));
- private static ImmioConfiguration config = IniConfig.GetIniSection();
- private ImmioPlugin plugin = null;
+namespace GreenshotBoxPlugin {
+ public class BoxDestination : AbstractDestination {
+ private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(BoxDestination));
+ private static BoxConfiguration config = IniConfig.GetIniSection();
- public ImmioDestination(ImmioPlugin plugin) {
+ private BoxPlugin plugin = null;
+ public BoxDestination(BoxPlugin plugin) {
this.plugin = plugin;
}
public override string Designation {
get {
- return "Immio";
+ return "Box";
}
}
public override string Description {
get {
- return Language.GetString("immio", LangKey.upload_menu_item);
+ return Language.GetString("box", LangKey.upload_menu_item);
}
}
public override Image DisplayIcon {
get {
- ComponentResourceManager resources = new ComponentResourceManager(typeof(ImmioPlugin));
- return (Image)resources.GetObject("Immio");
+ ComponentResourceManager resources = new ComponentResourceManager(typeof(BoxPlugin));
+ return (Image)resources.GetObject("Box");
}
}
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
using (Image image = surface.GetImageForExport()) {
- string uploadURL = null;
- exportInformation.ExportMade = plugin.Upload(captureDetails, image, out uploadURL);
- exportInformation.Uri = uploadURL;
+ string uploadUrl = plugin.Upload(captureDetails, image);
+ if (uploadUrl != null) {
+ exportInformation.ExportMade = true;
+ exportInformation.Uri = uploadUrl;
+ }
}
ProcessExport(exportInformation, surface);
return exportInformation;
diff --git a/GreenshotOfficeCommunicatorPlugin/OfficeCommunicatorPlugin.cs b/GreenshotBoxPlugin/BoxPlugin.cs
similarity index 51%
rename from GreenshotOfficeCommunicatorPlugin/OfficeCommunicatorPlugin.cs
rename to GreenshotBoxPlugin/BoxPlugin.cs
index 54747e3da..07f0bdbb2 100644
--- a/GreenshotOfficeCommunicatorPlugin/OfficeCommunicatorPlugin.cs
+++ b/GreenshotBoxPlugin/BoxPlugin.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -24,47 +24,30 @@ using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
-using System.Threading;
-
+using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
-using Greenshot.IniFile;
-using CommunicatorAPI;
-using System.Runtime.InteropServices;
-namespace GreenshotOfficeCommunicatorPlugin {
+namespace GreenshotBoxPlugin {
///
- /// This is the OfficeCommunicatorPlugin
+ /// This is the Box base code
///
- public class OfficeCommunicatorPlugin : IGreenshotPlugin {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(OfficeCommunicatorPlugin));
+ public class BoxPlugin : IGreenshotPlugin {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(BoxPlugin));
+ private static BoxConfiguration config;
public static PluginAttribute Attributes;
- private OfficeCommunicatorConfiguration config = IniConfig.GetIniSection();
private IGreenshotHost host;
- private Communicator communicator;
- public IGreenshotHost Host {
- get {
- return host;
- }
- }
+ private ComponentResourceManager resources;
- public Communicator Communicator {
- get {
- return communicator;
- }
- set {
- communicator = value;
- }
- }
-
- public OfficeCommunicatorPlugin() {
+ public BoxPlugin() {
}
public IEnumerable Destinations() {
- yield return new OfficeCommunicatorDestination(this);
+ yield return new BoxDestination(this);
}
+
public IEnumerable Processors() {
yield break;
}
@@ -73,20 +56,27 @@ namespace GreenshotOfficeCommunicatorPlugin {
/// Implementation of the IGreenshotPlugin.Initialize
///
/// Use the IGreenshotPluginHost interface to register events
- /// Use the ICaptureHost interface to register in the MainContextMenu
/// My own attributes
- /// true if plugin is initialized, false if not (doesn't show)
public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
this.host = (IGreenshotHost)pluginHost;
Attributes = myAttributes;
- communicator = new Communicator();
- communicator.Signin(null, null);
+ // Register configuration (don't need the configuration itself)
+ config = IniConfig.GetIniSection();
+ resources = new ComponentResourceManager(typeof(BoxPlugin));
+
+ ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();
+ itemPlugInConfig.Image = (Image)resources.GetObject("Box");
+ itemPlugInConfig.Text = Language.GetString("box", LangKey.Configure);
+ itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
+
+ PluginUtils.AddToContextMenu(host, itemPlugInConfig);
+
return true;
}
public virtual void Shutdown() {
- LOG.Debug("OfficeCommunicator Plugin shutdown.");
+ LOG.Debug("Box Plugin shutdown.");
}
///
@@ -102,8 +92,40 @@ namespace GreenshotOfficeCommunicatorPlugin {
///
///
public void Closing(object sender, FormClosingEventArgs e) {
- LOG.Debug("Application closing, de-registering OfficeCommunicator Plugin!");
+ LOG.Debug("Application closing, de-registering Box Plugin!");
Shutdown();
}
+
+ public void ConfigMenuClick(object sender, EventArgs eventArgs) {
+ config.ShowConfigDialog();
+ }
+
+ ///
+ /// This will be called when the menu item in the Editor is clicked
+ ///
+ public string Upload(ICaptureDetails captureDetails, Image image) {
+ OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, false);
+ try {
+ string url = null;
+ string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails));
+ ImageContainer imageToUpload = new ImageContainer(image, outputSettings, filename);
+
+ new PleaseWaitForm().ShowAndWait(BoxPlugin.Attributes.Name, Language.GetString("box", LangKey.communication_wait),
+ delegate() {
+ url = BoxUtils.UploadToBox(imageToUpload, captureDetails.Title, filename);
+ }
+ );
+
+ if (url != null && config.AfterUploadLinkToClipBoard) {
+ ClipboardHelper.SetClipboardData(url);
+ }
+
+ return url;
+ } catch (Exception ex) {
+ LOG.Error("Error uploading.", ex);
+ MessageBox.Show(Language.GetString("box", LangKey.upload_failure) + " " + ex.ToString());
+ return null;
+ }
+ }
}
}
diff --git a/GreenshotImmioPlugin/ImmioPlugin.resx b/GreenshotBoxPlugin/BoxPlugin.resx
similarity index 86%
rename from GreenshotImmioPlugin/ImmioPlugin.resx
rename to GreenshotBoxPlugin/BoxPlugin.resx
index 00ce7ed3d..57b6289de 100644
--- a/GreenshotImmioPlugin/ImmioPlugin.resx
+++ b/GreenshotBoxPlugin/BoxPlugin.resx
@@ -117,15 +117,8 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAMVJREFUOE9jDA0J
- ZSAJADW8ffeOSAQyHaJhzvHXaGjR6TdoCKgMi4Zzj79+/vH3Pxg8ePfz2cdfQBGgTqBx2DVAlKKB9Zfe
- 49QAlIOofvP1N9BsINp69QPEtdhtAEoAHbDi3FtMX+HUgKkUiw29m6e0rshsWORfO88WSLatyp+4fRqa
- ThQbgKqBStuWO6ChpcdTFx+vXnh8IbofkFUvPOKDhhYciVlwtATFBojBmEqRRdA14FcNlEXRQFA1ugbS
- Eh8wSRGPAL2C6QdnoO9oAAAAAElFTkSuQmCC
-
+
+
+ box.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
\ No newline at end of file
diff --git a/GreenshotBoxPlugin/BoxUtils.cs b/GreenshotBoxPlugin/BoxUtils.cs
new file mode 100644
index 000000000..3c6352ad1
--- /dev/null
+++ b/GreenshotBoxPlugin/BoxUtils.cs
@@ -0,0 +1,132 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
+ *
+ * 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Net;
+using System.Xml;
+using Greenshot.IniFile;
+using GreenshotPlugin.Controls;
+using GreenshotPlugin.Core;
+
+namespace GreenshotBoxPlugin {
+ ///
+ /// Description of ImgurUtils.
+ ///
+ public class BoxUtils {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(BoxUtils));
+ private static BoxConfiguration config = IniConfig.GetIniSection();
+
+ private BoxUtils() {
+ }
+
+ private static string ParseTicket(string response) {
+ try {
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(response);
+ XmlNodeList nodes = doc.GetElementsByTagName("ticket");
+ if(nodes.Count > 0) {
+ return nodes.Item(0).InnerText;
+ }
+ } catch (Exception ex) {
+ LOG.Error("Error parsing Box Response.", ex);
+ }
+ return null;
+ }
+
+ private static bool Authorize() {
+ string ticketUrl = string.Format("https://www.box.com/api/1.0/rest?action=get_ticket&api_key={0}", BoxCredentials.API_KEY);
+ string ticketXML = NetworkHelper.GetAsString(new Uri(ticketUrl));
+ string ticket = ParseTicket(ticketXML);
+ string authorizeUrl = string.Format("https://www.box.com/api/1.0/auth/{0}", ticket);
+ OAuthLoginForm loginForm = new OAuthLoginForm("Box Authorize", new Size(1060,600), authorizeUrl, "http://getgreenshot.org");
+ loginForm.ShowDialog();
+ if (loginForm.isOk) {
+ if (loginForm.CallbackParameters != null && loginForm.CallbackParameters.ContainsKey("auth_token")) {
+ config.BoxToken = loginForm.CallbackParameters["auth_token"];
+ IniConfig.Save();
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ ///
+ /// Upload file by post
+ ///
+ ///
+ ///
+ /// response
+ public static string HttpUploadFile(string url, Dictionary parameters) {
+ HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
+ webRequest.Method = "POST";
+ webRequest.KeepAlive = true;
+ webRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
+ NetworkHelper.WriteMultipartFormData(webRequest, parameters);
+
+ return NetworkHelper.GetResponse(webRequest);
+ }
+
+ ///
+ /// Do the actual upload to Box
+ /// For more details on the available parameters, see: http://developers.box.net/w/page/12923951/ApiFunction_Upload%20and%20Download
+ ///
+ /// byte[] with image data
+ /// url to uploaded image
+ public static string UploadToBox(ImageContainer image, string title, string filename) {
+ string folderId = "0";
+ if (string.IsNullOrEmpty(config.BoxToken)) {
+ if (!Authorize()) {
+ return null;
+ }
+ }
+
+ string strUrl = string.Format("https://upload.box.net/api/1.0/upload/{0}/{1}?file_name={2}&new_copy=1", config.BoxToken, folderId, filename);
+
+ Dictionary parameters = new Dictionary();
+ parameters.Add("share", "1");
+ parameters.Add("new_file", image);
+
+ string response = HttpUploadFile(strUrl, parameters);
+ // Check if the token is wrong
+ if ("wrong auth token".Equals(response)) {
+ config.BoxToken = null;
+ IniConfig.Save();
+ return UploadToBox(image, title, filename);
+ }
+ LOG.DebugFormat("Box response: {0}", response);
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(response);
+ XmlNodeList nodes = doc.GetElementsByTagName("status");
+ if(nodes.Count > 0) {
+ if ("upload_ok".Equals(nodes.Item(0).InnerText)) {
+ nodes = doc.GetElementsByTagName("file");
+ if (nodes.Count > 0) {
+ long id = long.Parse(nodes.Item(0).Attributes["id"].Value);
+ return string.Format("http://www.box.com/files/0/f/0/1/f_{0}", id);
+ }
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/GreenshotOfficeCommunicatorPlugin/Forms/OfficeCommunicatorForm.cs b/GreenshotBoxPlugin/Forms/BoxForm.cs
similarity index 73%
rename from GreenshotOfficeCommunicatorPlugin/Forms/OfficeCommunicatorForm.cs
rename to GreenshotBoxPlugin/Forms/BoxForm.cs
index 126f4d2bc..b8aa634be 100644
--- a/GreenshotOfficeCommunicatorPlugin/Forms/OfficeCommunicatorForm.cs
+++ b/GreenshotBoxPlugin/Forms/BoxForm.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -18,14 +18,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-using System;
+using GreenshotPlugin.Controls;
-namespace GreenshotOfficeCommunicatorPlugin {
- ///
- /// This class is needed for design-time resolving of the language files
- ///
- public class OfficeCommunicatorForm : GreenshotPlugin.Controls.GreenshotForm {
- public OfficeCommunicatorForm() : base() {
- }
+namespace GreenshotBoxPlugin.Forms {
+ public class BoxForm : GreenshotForm {
}
-}
+}
\ No newline at end of file
diff --git a/GreenshotImmioPlugin/Forms/SettingsForm.Designer.cs b/GreenshotBoxPlugin/Forms/SettingsForm.Designer.cs
similarity index 59%
rename from GreenshotImmioPlugin/Forms/SettingsForm.Designer.cs
rename to GreenshotBoxPlugin/Forms/SettingsForm.Designer.cs
index 18595162b..a1a0d777e 100644
--- a/GreenshotImmioPlugin/Forms/SettingsForm.Designer.cs
+++ b/GreenshotBoxPlugin/Forms/SettingsForm.Designer.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-namespace GreenshotImmioPlugin {
+namespace GreenshotBoxPlugin {
partial class SettingsForm {
///
/// Designer variable used to keep track of non-visual components.
@@ -50,70 +50,99 @@ namespace GreenshotImmioPlugin {
this.buttonCancel = new GreenshotPlugin.Controls.GreenshotButton();
this.combobox_uploadimageformat = new GreenshotPlugin.Controls.GreenshotComboBox();
this.label_upload_format = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.label_AfterUpload = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.checkboxAfterUploadLinkToClipBoard = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.SuspendLayout();
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonOK.LanguageKey = "immio.OK";
- this.buttonOK.Location = new System.Drawing.Point(222, 88);
+ this.buttonOK.LanguageKey = "OK";
+ this.buttonOK.Location = new System.Drawing.Point(267, 72);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
- this.buttonOK.TabIndex = 2;
+ this.buttonOK.TabIndex = 12;
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.ButtonOKClick);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonCancel.LanguageKey = "immio.CANCEL";
- this.buttonCancel.Location = new System.Drawing.Point(303, 88);
+ this.buttonCancel.LanguageKey = "CANCEL";
+ this.buttonCancel.Location = new System.Drawing.Point(348, 72);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
- this.buttonCancel.TabIndex = 3;
+ this.buttonCancel.TabIndex = 13;
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancelClick);
//
// combobox_uploadimageformat
//
+ this.combobox_uploadimageformat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.combobox_uploadimageformat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.combobox_uploadimageformat.FormattingEnabled = true;
- this.combobox_uploadimageformat.Location = new System.Drawing.Point(102, 7);
+ this.combobox_uploadimageformat.Location = new System.Drawing.Point(208, 12);
this.combobox_uploadimageformat.Name = "combobox_uploadimageformat";
this.combobox_uploadimageformat.PropertyName = "UploadFormat";
- this.combobox_uploadimageformat.SectionName = "Immio";
- this.combobox_uploadimageformat.Size = new System.Drawing.Size(276, 21);
- this.combobox_uploadimageformat.TabIndex = 8;
+ this.combobox_uploadimageformat.SectionName = "Box";
+ this.combobox_uploadimageformat.Size = new System.Drawing.Size(215, 21);
+ this.combobox_uploadimageformat.TabIndex = 5;
//
// label_upload_format
//
- this.label_upload_format.LanguageKey = "immio.label_upload_format";
- this.label_upload_format.Location = new System.Drawing.Point(12, 10);
+ this.label_upload_format.LanguageKey = "box.label_upload_format";
+ this.label_upload_format.Location = new System.Drawing.Point(10, 12);
this.label_upload_format.Name = "label_upload_format";
- this.label_upload_format.Size = new System.Drawing.Size(84, 20);
- this.label_upload_format.TabIndex = 9;
+ this.label_upload_format.Size = new System.Drawing.Size(192, 20);
+ this.label_upload_format.TabIndex = 4;
+ //
+ // label_AfterUpload
+ //
+ this.label_AfterUpload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.label_AfterUpload.LanguageKey = "box.label_AfterUpload";
+ this.label_AfterUpload.Location = new System.Drawing.Point(10, 46);
+ this.label_AfterUpload.Name = "label_AfterUpload";
+ this.label_AfterUpload.Size = new System.Drawing.Size(84, 21);
+ this.label_AfterUpload.TabIndex = 8;
+ //
+ // checkboxAfterUploadLinkToClipBoard
+ //
+ this.checkboxAfterUploadLinkToClipBoard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
+ this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "box.label_AfterUploadLinkToClipBoard";
+ this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(208, 48);
+ this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";
+ this.checkboxAfterUploadLinkToClipBoard.PropertyName = "AfterUploadLinkToClipBoard";
+ this.checkboxAfterUploadLinkToClipBoard.SectionName = "Box";
+ this.checkboxAfterUploadLinkToClipBoard.Size = new System.Drawing.Size(15, 14);
+ this.checkboxAfterUploadLinkToClipBoard.TabIndex = 10;
+ this.checkboxAfterUploadLinkToClipBoard.UseVisualStyleBackColor = true;
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.ClientSize = new System.Drawing.Size(387, 123);
+ this.ClientSize = new System.Drawing.Size(432, 104);
+ this.Controls.Add(this.checkboxAfterUploadLinkToClipBoard);
+ this.Controls.Add(this.label_AfterUpload);
this.Controls.Add(this.label_upload_format);
this.Controls.Add(this.combobox_uploadimageformat);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.LanguageKey = "immio.settings_title";
+ this.LanguageKey = "box.settings_title";
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SettingsForm";
this.ResumeLayout(false);
this.PerformLayout();
-
}
private GreenshotPlugin.Controls.GreenshotComboBox combobox_uploadimageformat;
private GreenshotPlugin.Controls.GreenshotLabel label_upload_format;
private GreenshotPlugin.Controls.GreenshotButton buttonCancel;
private GreenshotPlugin.Controls.GreenshotButton buttonOK;
+ private GreenshotPlugin.Controls.GreenshotLabel label_AfterUpload;
+ private GreenshotPlugin.Controls.GreenshotCheckBox checkboxAfterUploadLinkToClipBoard;
}
}
diff --git a/GreenshotPhotobucketPlugin/Forms/SettingsForm.cs b/GreenshotBoxPlugin/Forms/SettingsForm.cs
similarity index 83%
rename from GreenshotPhotobucketPlugin/Forms/SettingsForm.cs
rename to GreenshotBoxPlugin/Forms/SettingsForm.cs
index 8c04847f5..af76b4593 100644
--- a/GreenshotPhotobucketPlugin/Forms/SettingsForm.cs
+++ b/GreenshotBoxPlugin/Forms/SettingsForm.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -19,23 +19,28 @@
* along with this program. If not, see .
*/
using System;
+using System.Drawing;
using System.Windows.Forms;
-using GreenshotPlugin.Core;
-using GreenshotPlugin.Controls;
-namespace GreenshotPhotobucketPlugin {
+using GreenshotBoxPlugin.Forms;
+using GreenshotPlugin.Core;
+
+namespace GreenshotBoxPlugin {
///
/// Description of PasswordRequestForm.
///
- public partial class SettingsForm : PhotobucketForm {
- public SettingsForm(PhotobucketConfiguration config) : base() {
+ public partial class SettingsForm : BoxForm {
+ string boxTicket = string.Empty;
+
+ public SettingsForm(BoxConfiguration config) {
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
+
}
-
+
void ButtonOKClick(object sender, EventArgs e) {
this.DialogResult = DialogResult.OK;
}
diff --git a/GreenshotPhotobucketPlugin/GreenshotPhotobucketPlugin.csproj b/GreenshotBoxPlugin/GreenshotBoxPlugin.csproj
similarity index 60%
rename from GreenshotPhotobucketPlugin/GreenshotPhotobucketPlugin.csproj
rename to GreenshotBoxPlugin/GreenshotBoxPlugin.csproj
index c15664559..275f9fb6d 100644
--- a/GreenshotPhotobucketPlugin/GreenshotPhotobucketPlugin.csproj
+++ b/GreenshotBoxPlugin/GreenshotBoxPlugin.csproj
@@ -2,10 +2,10 @@
- {9C0ECC4C-7807-4111-916A-4F57BB29788A}
+ {697CF066-9077-4F22-99D9-D989CCE7282B}Library
- GreenshotPhotobucketPlugin
- GreenshotPhotobucketPlugin
+ GreenshotBoxPlugin
+ GreenshotBoxPluginv2.0PropertiesFalse
@@ -13,16 +13,14 @@
4falseOnBuildSuccess
-
-
- 3.5
+
- ..\Greenshot\Lib\log4net.dll
+ ..\lib\log4net.dll
@@ -30,7 +28,12 @@
-
+
+
+
+
+
+ Form
@@ -39,45 +42,47 @@
SettingsForm.cs
-
-
-
-
-
-
- Never
-
-
- Never
-
-
- Never
-
-
- Never
-
-
-
-
- PhotobucketPlugin.cs
+
+ BoxPlugin.csDesigner
-
+
+
+
+
+
+
+
+
+
+
+ {5B924697-4DCD-4F98-85F1-105CB84B7341}GreenshotPlugin
- "$(SolutionDir)\tools\TortoiseSVN\SubWCRev.exe" "$(ProjectDir)\" "$(ProjectDir)\Properties\AssemblyInfo.cs.template" "$(ProjectDir)\Properties\AssemblyInfo.cs"
- mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
-copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
+ if exist "$(ProjectDir)BoxCredentials.orig.cs" (
+ rename "$(ProjectDir)BoxCredentials.cs" "BoxCredentials.private.cs"
+ rename "$(ProjectDir)BoxCredentials.orig.cs" "BoxCredentials.cs"
+) else exit /b -1
+
+mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
+copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\"
mkdir "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
-copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"
+copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"
+
+ "$(SolutionDir)\tools\TortoiseSVN\SubWCRev.exe" "$(ProjectDir)\" "$(ProjectDir)\Properties\AssemblyInfo.cs.template" "$(ProjectDir)\Properties\AssemblyInfo.cs"
+
+if exist "$(ProjectDir)BoxCredentials.private.cs" (
+ rename "$(ProjectDir)BoxCredentials.cs" "BoxCredentials.orig.cs"
+ rename "$(ProjectDir)BoxCredentials.private.cs" "BoxCredentials.cs"
+) else exit /b -1False
@@ -97,8 +102,8 @@ copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languag
DEBUG;TRACEFalseTrue
- None
- false
+ Full
+ trueTRACE
diff --git a/GreenshotImmioPlugin/LanguageKeys.cs b/GreenshotBoxPlugin/LanguageKeys.cs
similarity index 87%
rename from GreenshotImmioPlugin/LanguageKeys.cs
rename to GreenshotBoxPlugin/LanguageKeys.cs
index f1799de38..db2c2516b 100644
--- a/GreenshotImmioPlugin/LanguageKeys.cs
+++ b/GreenshotBoxPlugin/LanguageKeys.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -18,18 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-
-namespace GreenshotImmioPlugin {
+namespace GreenshotBoxPlugin {
public enum LangKey {
upload_menu_item,
settings_title,
- label_url,
label_upload_format,
- OK,
- CANCEL,
upload_success,
upload_failure,
communication_wait,
- configure
+ Configure,
+ label_AfterUpload,
+ label_AfterUploadLinkToClipBoard
}
}
diff --git a/GreenshotBoxPlugin/Languages/language_Boxplugin-en-US.xml b/GreenshotBoxPlugin/Languages/language_Boxplugin-en-US.xml
new file mode 100644
index 000000000..181603529
--- /dev/null
+++ b/GreenshotBoxPlugin/Languages/language_Boxplugin-en-US.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ Link to clipboard
+
+
+ After upload
+
+
+ Configure Box
+
+
+ Upload to Box
+
+
+ Box settings
+
+
+ Successfully uploaded image to Box!
+
+
+ An error occured while uploading to Box:
+
+
+ Image format
+
+
+ Communicating with Box. Please wait...
+
+
+
\ No newline at end of file
diff --git a/GreenshotBoxPlugin/Languages/language_Boxplugin-fr-FR.xml b/GreenshotBoxPlugin/Languages/language_Boxplugin-fr-FR.xml
new file mode 100644
index 000000000..fd8e7a72f
--- /dev/null
+++ b/GreenshotBoxPlugin/Languages/language_Boxplugin-fr-FR.xml
@@ -0,0 +1,14 @@
+
+
+
+ Communication en cours avec le service de stockage en ligne. Veuillez patientez...
+ Configurer Box
+ Après téléversement
+ Copier le lien dans le presse-papier
+ Format image
+ Paramètres du stockage en ligne
+ Une erreur s'est produite lors du téléversement vers le stockage en ligne :
+ Téléverser vers le stockage en ligne
+ Image téléversée aves succès vers le stockage en ligne !
+
+
\ No newline at end of file
diff --git a/GreenshotBoxPlugin/Languages/language_Boxplugin-ru-RU.xml b/GreenshotBoxPlugin/Languages/language_Boxplugin-ru-RU.xml
new file mode 100644
index 000000000..712c01cbc
--- /dev/null
+++ b/GreenshotBoxPlugin/Languages/language_Boxplugin-ru-RU.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ Ссылка в буфер обмена
+
+
+ После загрузки
+
+
+ Настройка Box
+
+
+ Загрузить на Box
+
+
+ Параметры Box
+
+
+ Изображение успешно загружено на Box!
+
+
+ Произошла ошибка при загрузке на Box:
+
+
+ Формат изображения
+
+
+ Обмен данными с Box. Подождите...
+
+
+
\ No newline at end of file
diff --git a/GreenshotBoxPlugin/Languages/language_Boxplugin-uk-UA.xml b/GreenshotBoxPlugin/Languages/language_Boxplugin-uk-UA.xml
new file mode 100644
index 000000000..6bf188bc8
--- /dev/null
+++ b/GreenshotBoxPlugin/Languages/language_Boxplugin-uk-UA.xml
@@ -0,0 +1,14 @@
+
+
+
+ Посилання в буфер обміну
+ Після вивантаження
+ Налаштувати Box
+ Вивантажити на Box
+ Параметри Box
+ Зображення вдало вивантажено на Box!
+ Відбулась помилка під час вивантаження на Box:
+ Формат зображення
+ З’єднання з Box. Будь ласка, зачекайте...
+
+
diff --git a/GreenshotBoxPlugin/Languages/language_Boxplugin-zh-CN.xml b/GreenshotBoxPlugin/Languages/language_Boxplugin-zh-CN.xml
new file mode 100644
index 000000000..1eb7f88f2
--- /dev/null
+++ b/GreenshotBoxPlugin/Languages/language_Boxplugin-zh-CN.xml
@@ -0,0 +1,14 @@
+
+
+
+ 正在连接Box。请稍后...
+ 配置Box
+ 上传之后
+ 复制链接到剪贴板
+ 图片格式
+ Box设置
+ 上传图片到Box时发生错误:
+ 上传到Box
+ 图片已成功上传到Box!
+
+
\ No newline at end of file
diff --git a/GreenshotPhotobucketPlugin/Properties/AssemblyInfo.cs.template b/GreenshotBoxPlugin/Properties/AssemblyInfo.cs.template
similarity index 79%
rename from GreenshotPhotobucketPlugin/Properties/AssemblyInfo.cs.template
rename to GreenshotBoxPlugin/Properties/AssemblyInfo.cs.template
index bd52d0b85..4784236a0 100644
--- a/GreenshotPhotobucketPlugin/Properties/AssemblyInfo.cs.template
+++ b/GreenshotBoxPlugin/Properties/AssemblyInfo.cs.template
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -30,16 +30,16 @@ using Greenshot.Plugin;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("Greenshot-Photobucket-Plugin")]
-[assembly: AssemblyDescription("A plugin to upload images to Photobucket")]
+[assembly: AssemblyTitle("Greenshot-Box-Plugin")]
+[assembly: AssemblyDescription("A plugin to upload images to Box")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Greenshot")]
-[assembly: AssemblyProduct("Photobucket Plugin")]
-[assembly: AssemblyCopyright("Copyright (C) 2007-2012")]
+[assembly: AssemblyCompany("Greenshot & F. Noel")]
+[assembly: AssemblyProduct("Box Plugin")]
+[assembly: AssemblyCopyright("Copyright (C) 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The PluginAttribute describes the "entryType" and if the plugin is configurable
-[assembly: PluginAttribute("GreenshotPhotobucketPlugin.PhotobucketPlugin", true)]
+[assembly: PluginAttribute("GreenshotBoxPlugin.BoxPlugin", true)]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
@@ -51,4 +51,4 @@ using Greenshot.Plugin;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.3.$WCREV$")]
+[assembly: AssemblyVersion("1.0.5.$WCREV$")]
diff --git a/GreenshotBoxPlugin/app.config b/GreenshotBoxPlugin/app.config
new file mode 100644
index 000000000..3e588c04a
--- /dev/null
+++ b/GreenshotBoxPlugin/app.config
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GreenshotConfluencePlugin/Properties/AssemblyInfo.cs.template b/GreenshotConfluencePlugin/Properties/AssemblyInfo.cs.template
index 622cc5d9a..a7c771743 100644
--- a/GreenshotConfluencePlugin/Properties/AssemblyInfo.cs.template
+++ b/GreenshotConfluencePlugin/Properties/AssemblyInfo.cs.template
@@ -51,4 +51,4 @@ using Greenshot.Plugin;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.4.$WCREV$")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.0.5.$WCREV$")]
\ No newline at end of file
diff --git a/GreenshotDropboxPlugin/DropBoxCredentials.cs b/GreenshotDropboxPlugin/DropBoxCredentials.cs
new file mode 100644
index 000000000..b22d73e00
--- /dev/null
+++ b/GreenshotDropboxPlugin/DropBoxCredentials.cs
@@ -0,0 +1,31 @@
+/*
+ * 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 .
+ */
+
+namespace GreenshotDropboxPlugin {
+ ///
+ /// This class is merely a placeholder for the file keeping the API key and secret for dropbox integration.
+ /// Copy this file to DropBoxCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the DropBox plugin then.)
+ ///
+ public static class DropBoxCredentials {
+ public static string CONSUMER_KEY = empty;
+ public static string CONSUMER_SECRET = empty;
+ }
+}
diff --git a/GreenshotDropboxPlugin/DropBoxCredentials.private.cs b/GreenshotDropboxPlugin/DropBoxCredentials.private.cs
new file mode 100644
index 000000000..1be011828
--- /dev/null
+++ b/GreenshotDropboxPlugin/DropBoxCredentials.private.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace GreenshotDropboxPlugin
+{
+ public static class DropBoxCredentials {
+ public static string CONSUMER_KEY = "u7c1rpxht2x5s1r";
+ public static string CONSUMER_SECRET = "apitf6xvdaysaww";
+ }
+}
diff --git a/GreenshotDropboxPlugin/Dropbox.gif b/GreenshotDropboxPlugin/Dropbox.gif
new file mode 100644
index 000000000..e09205da8
Binary files /dev/null and b/GreenshotDropboxPlugin/Dropbox.gif differ
diff --git a/GreenshotPhotobucketPlugin/PhotobucketDestination.cs b/GreenshotDropboxPlugin/DropboxDestination.cs
similarity index 66%
rename from GreenshotPhotobucketPlugin/PhotobucketDestination.cs
rename to GreenshotDropboxPlugin/DropboxDestination.cs
index d363ade98..8dea2a10a 100644
--- a/GreenshotPhotobucketPlugin/PhotobucketDestination.cs
+++ b/GreenshotDropboxPlugin/DropboxDestination.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -18,58 +18,51 @@
* 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;
-using System.Diagnostics;
using System.Drawing;
-using System.IO;
-using System.Windows;
-
+using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
-using Greenshot.IniFile;
+namespace GreenshotDropboxPlugin {
+ class DropboxDestination : AbstractDestination {
+ private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(DropboxDestination));
+ private static DropboxPluginConfiguration config = IniConfig.GetIniSection();
-namespace GreenshotPhotobucketPlugin {
- ///
- /// Description of PhotobucketDestination.
- ///
- public class PhotobucketDestination : AbstractDestination {
- private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketDestination));
- private static PhotobucketConfiguration config = IniConfig.GetIniSection();
- private PhotobucketPlugin plugin = null;
-
- public PhotobucketDestination(PhotobucketPlugin plugin) {
+ private DropboxPlugin plugin = null;
+ public DropboxDestination(DropboxPlugin plugin) {
this.plugin = plugin;
}
public override string Designation {
get {
- return "Photobucket";
+ return "Dropbox";
}
}
public override string Description {
get {
- return Language.GetString("photobucket", LangKey.upload_menu_item);
+ return Language.GetString("dropbox", LangKey.upload_menu_item);
}
}
public override Image DisplayIcon {
get {
- ComponentResourceManager resources = new ComponentResourceManager(typeof(PhotobucketPlugin));
- return (Image)resources.GetObject("Photobucket");
+ ComponentResourceManager resources = new ComponentResourceManager(typeof(DropboxPlugin));
+ return (Image)resources.GetObject("Dropbox");
}
}
-
- public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
+
+ public override ExportInformation ExportCapture(bool manually, ISurface surface, ICaptureDetails captureDetails) {
ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
using (Image image = surface.GetImageForExport()) {
string uploadURL = null;
bool uploaded = plugin.Upload(captureDetails, image, out uploadURL);
if (uploaded) {
- exportInformation.ExportMade = true;
exportInformation.Uri = uploadURL;
+ exportInformation.ExportMade = true;
+ if (config.AfterUploadLinkToClipBoard) {
+ ClipboardHelper.SetClipboardData(uploadURL);
+ }
}
}
ProcessExport(exportInformation, surface);
diff --git a/GreenshotImmioPlugin/ImmioPlugin.cs b/GreenshotDropboxPlugin/DropboxPlugin.cs
similarity index 56%
rename from GreenshotImmioPlugin/ImmioPlugin.cs
rename to GreenshotDropboxPlugin/DropboxPlugin.cs
index ebd9acc72..c3233cc72 100644
--- a/GreenshotImmioPlugin/ImmioPlugin.cs
+++ b/GreenshotDropboxPlugin/DropboxPlugin.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -29,24 +29,25 @@ using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
-namespace GreenshotImmioPlugin {
+namespace GreenshotDropboxPlugin {
///
- /// This is the ImmioPlugin code
+ /// This is the Dropbox base code
///
- public class ImmioPlugin : IGreenshotPlugin {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImmioPlugin));
- private static ImmioConfiguration config;
+ public class DropboxPlugin : IGreenshotPlugin {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(DropboxPlugin));
+ private static DropboxPluginConfiguration config;
public static PluginAttribute Attributes;
private IGreenshotHost host;
private ComponentResourceManager resources;
- public ImmioPlugin() {
+ public DropboxPlugin() {
}
public IEnumerable Destinations() {
- yield return new ImmioDestination(this);
+ yield return new DropboxDestination(this);
}
+
public IEnumerable Processors() {
yield break;
}
@@ -55,29 +56,28 @@ namespace GreenshotImmioPlugin {
/// Implementation of the IGreenshotPlugin.Initialize
///
/// Use the IGreenshotPluginHost interface to register events
- /// Use the ICaptureHost interface to register in the MainContextMenu
/// My own attributes
- /// true if plugin is initialized, false if not (doesn't show)
public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
this.host = (IGreenshotHost)pluginHost;
Attributes = myAttributes;
- // Get configuration
- config = IniConfig.GetIniSection();
- resources = new ComponentResourceManager(typeof(ImmioPlugin));
-
- ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem(Language.GetString("immio", LangKey.configure));
- itemPlugInRoot.Image = (Image)resources.GetObject("Immio");
- itemPlugInRoot.Click += delegate {
- config.ShowConfigDialog();
- };
+ // Register configuration (don't need the configuration itself)
+ config = IniConfig.GetIniSection();
+ resources = new ComponentResourceManager(typeof(DropboxPlugin));
+
+ ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();
+ itemPlugInConfig.Text = Language.GetString("dropbox", LangKey.Configure);
+ itemPlugInConfig.Tag = host;
+ itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
+ itemPlugInConfig.Image = (Image)resources.GetObject("Dropbox");
+
+ PluginUtils.AddToContextMenu(host, itemPlugInConfig);
- PluginUtils.AddToContextMenu(host, itemPlugInRoot);
return true;
}
-
+
public virtual void Shutdown() {
- LOG.Debug("Immio Plugin shutdown.");
+ LOG.Debug("Dropbox Plugin shutdown.");
}
///
@@ -93,44 +93,38 @@ namespace GreenshotImmioPlugin {
///
///
public void Closing(object sender, FormClosingEventArgs e) {
- LOG.Debug("Application closing, de-registering Immio Plugin!");
+ LOG.Debug("Application closing, de-registering Dropbox Plugin!");
Shutdown();
}
-
+
+ public void ConfigMenuClick(object sender, EventArgs eventArgs) {
+ config.ShowConfigDialog();
+ }
+
///
- /// Upload the capture to Immio
+ /// This will be called when the menu item in the Editor is clicked
///
- ///
- ///
- /// out string for the url
- /// true if the upload succeeded
- public bool Upload(ICaptureDetails captureDetails, Image image, out string uploadURL) {
- OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
- uploadURL = null;
+ public bool Upload(ICaptureDetails captureDetails, Image image, out string uploadUrl) {
+ uploadUrl = null;
+ OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, false);
try {
- string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails));
- string url = null;
-
- // Run upload in the background
- new PleaseWaitForm().ShowAndWait(Attributes.Name, Language.GetString("immio", LangKey.communication_wait),
+ string dropboxUrl = null;
+ new PleaseWaitForm().ShowAndWait(Attributes.Name, Language.GetString("dropbox", LangKey.communication_wait),
delegate() {
- url = ImmioUtils.UploadToImmio(image, outputSettings, captureDetails.Title, filename);
+ string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails));
+ dropboxUrl = DropboxUtils.UploadToDropbox(image, outputSettings, filename);
}
);
- uploadURL = url;
-
- IniConfig.Save();
- try {
- ClipboardHelper.SetClipboardData(url);
- } catch (Exception ex) {
- LOG.Error("Can't write to clipboard: ", ex);
+ if (dropboxUrl == null) {
+ return false;
}
+ uploadUrl = dropboxUrl;
return true;
} catch (Exception e) {
LOG.Error(e);
- MessageBox.Show(Language.GetString("immio", LangKey.upload_failure) + " " + e.Message);
+ MessageBox.Show(Language.GetString("dropbox", LangKey.upload_failure) + " " + e.ToString());
+ return false;
}
- return false;
}
}
}
diff --git a/GreenshotPhotobucketPlugin/PhotobucketPlugin.resx b/GreenshotDropboxPlugin/DropboxPlugin.resx
similarity index 80%
rename from GreenshotPhotobucketPlugin/PhotobucketPlugin.resx
rename to GreenshotDropboxPlugin/DropboxPlugin.resx
index 1727301b6..f386b11fa 100644
--- a/GreenshotPhotobucketPlugin/PhotobucketPlugin.resx
+++ b/GreenshotDropboxPlugin/DropboxPlugin.resx
@@ -1,136 +1,124 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
-
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAIsSURBVDhPjZLfT1JhHMbP39DOUcKy0LpptRi57hC6YToTwzIsl26tm35dJl2oQaiX0axs1ECE
- xC1CLHWzBZLVlKy2qDZFsqX/xrl4ep+XaK6rc/GMd9/383nO+x6O0tQdsllcg5vW8/d1a/eYsQiWzsme
- BzbF4hoqByKrGHhSgG98xVDI0qGr1LeM6oe8z2DumEDdmZihkKVDV9FOjejmjpgoiMHknkBte1SW7RXr
- o5emZbjmrMpVf+mKgmFZcOLyczzOfMfL979w494ylta2kZz/hqm5InJrv3Ez9A59wzkZsnToKpozqPMJ
- 4+kiQokCMtl1vMqXUO9+CmtvElMLP+APf5CzTG5DMmTp0FVU511Z8OhFEc7rM3j7ZQcHOytXMLmjUFvC
- uDa6iGCkgPznHcmQ5T5dRXUExBUqBZ2355Fe2kTN6agEqqlpi2D69TpS2ZJkyNKhKwvqPDE59PjmkM6X
- ZQFfaDW17eKFXoiL8rJkyNL5V7DfMymHzVfTyH/aRsO5BExC2h3OuEeGLJ2/BX79wNlJPEx9xViqiIy4
- wuJHUdIVhyqOznDNGffIkKWjOvziCs1+vaErgWMX4/D6ZuHtn8WVwALerPzEzPKWTHZ1S864R4YsHbqi
- 4I5+WHxVvPfu7HGFYRF/JcP1//t06CqafVA/0pOEJo6qtUUNJgLpCFfZ5+gvN/XFcby38tkaCVk6dJXG
- 1qDNbL9V0uwDuiaOZCiCpdPYOmL7A+GxSANdcOqRAAAAAElFTkSuQmCC
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ dropbox.gif;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/GreenshotOfficeCommunicatorPlugin/OfficeCommunicatorConfiguration.cs b/GreenshotDropboxPlugin/DropboxPluginConfiguration.cs
similarity index 53%
rename from GreenshotOfficeCommunicatorPlugin/OfficeCommunicatorConfiguration.cs
rename to GreenshotDropboxPlugin/DropboxPluginConfiguration.cs
index d5b33907e..bde33ff4e 100644
--- a/GreenshotOfficeCommunicatorPlugin/OfficeCommunicatorConfiguration.cs
+++ b/GreenshotDropboxPlugin/DropboxPluginConfiguration.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -18,36 +18,37 @@
* 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.Windows.Forms;
-
-using GreenshotPlugin.Controls;
-using GreenshotPlugin.Core;
using Greenshot.IniFile;
+using GreenshotPlugin.Core;
-namespace GreenshotOfficeCommunicatorPlugin {
+
+namespace GreenshotDropboxPlugin {
///
- /// Description of OfficeCommunicatorConfiguration.
+ /// Description of ImgurConfiguration.
///
- [IniSection("OfficeCommunicator", Description="Greenshot OfficeCommunicator Plugin configuration")]
- public class OfficeCommunicatorConfiguration : IniSection {
- [IniProperty("Destination", Description = "The designation of the destination which is used to export via, the returned URL is used in the message.", DefaultValue = "FileDialog")]
- public string DestinationDesignation;
+ [IniSection("Dropbox", Description = "Greenshot Dropbox Plugin configuration")]
+ public class DropboxPluginConfiguration : IniSection {
+ [IniProperty("UploadFormat", Description="What file type to use for uploading", DefaultValue="png")]
+ public OutputFormat UploadFormat;
+ [IniProperty("UploadJpegQuality", Description="JPEG file save quality in %.", DefaultValue="80")]
+ public int UploadJpegQuality;
+
+ [IniProperty("AfterUploadLinkToClipBoard", Description = "After upload send Dropbox link to clipboard.", DefaultValue = "true")]
+ public bool AfterUploadLinkToClipBoard;
+
+ [IniProperty("DropboxToken", Description = "The Dropbox token", Encrypted = true, ExcludeIfNull = true)]
+ public string DropboxToken;
+ [IniProperty("DropboxTokenSecret", Description = "The Dropbox token secret", Encrypted = true, ExcludeIfNull = true)]
+ public string DropboxTokenSecret;
+
///
- /// A form for username/password
+ /// A form for token
///
/// bool true if OK was pressed, false if cancel
public bool ShowConfigDialog() {
- SettingsForm settingsForm = null;
-
- new PleaseWaitForm().ShowAndWait(OfficeCommunicatorPlugin.Attributes.Name, Language.GetString("officecommunicator", LangKey.communication_wait),
- delegate() {
- settingsForm = new SettingsForm(this);
- }
- );
- DialogResult result = settingsForm.ShowDialog();
+ DialogResult result = new SettingsForm().ShowDialog();
if (result == DialogResult.OK) {
return true;
}
diff --git a/GreenshotDropboxPlugin/DropboxUtils.cs b/GreenshotDropboxPlugin/DropboxUtils.cs
new file mode 100644
index 000000000..e098ab3e3
--- /dev/null
+++ b/GreenshotDropboxPlugin/DropboxUtils.cs
@@ -0,0 +1,80 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
+ *
+ * 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using Greenshot.IniFile;
+using Greenshot.Plugin;
+using GreenshotPlugin.Core;
+
+namespace GreenshotDropboxPlugin {
+ ///
+ /// Description of DropboxUtils.
+ ///
+ public class DropboxUtils {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(DropboxUtils));
+ private static DropboxPluginConfiguration config = IniConfig.GetIniSection();
+
+ private DropboxUtils() {
+ }
+
+ public static string UploadToDropbox(Image image, OutputSettings outputSettings, string filename) {
+ OAuthSession oAuth = new OAuthSession(DropBoxCredentials.CONSUMER_KEY, DropBoxCredentials.CONSUMER_SECRET);
+ oAuth.BrowserSize = new Size(1080, 650);
+ oAuth.CheckVerifier = false;
+ oAuth.AccessTokenUrl = "https://api.dropbox.com/1/oauth/access_token";
+ oAuth.AuthorizeUrl = "https://api.dropbox.com/1/oauth/authorize";
+ oAuth.RequestTokenUrl = "https://api.dropbox.com/1/oauth/request_token";
+ oAuth.LoginTitle = "Dropbox authorization";
+ oAuth.Token = config.DropboxToken;
+ oAuth.TokenSecret = config.DropboxTokenSecret;
+
+ try {
+ ImageContainer imageToUpload = new ImageContainer(image, outputSettings, filename);
+ string uploadResponse = oAuth.MakeOAuthRequest(HTTPMethod.POST, "https://api-content.dropbox.com/1/files_put/sandbox/" + OAuthSession.UrlEncode3986(filename), null, null, imageToUpload);
+ LOG.DebugFormat("Upload response: {0}", uploadResponse);
+ } catch (Exception ex) {
+ LOG.Error("Upload error: ", ex);
+ throw ex;
+ } finally {
+ if (!string.IsNullOrEmpty(oAuth.Token)) {
+ config.DropboxToken = oAuth.Token;
+ }
+ if (!string.IsNullOrEmpty(oAuth.TokenSecret)) {
+ config.DropboxTokenSecret = oAuth.TokenSecret;
+ }
+ }
+
+ // Try to get a URL to the uploaded image
+ try {
+ string responseString = oAuth.MakeOAuthRequest(HTTPMethod.GET, "https://api.dropbox.com/1/shares/sandbox/" + OAuthSession.UrlEncode3986(filename), null, null, null);
+ LOG.DebugFormat("Parsing output: {0}", responseString);
+ IDictionary returnValues = JSONHelper.JsonDecode(responseString);
+ if (returnValues.ContainsKey("url")) {
+ return returnValues["url"] as string;
+ }
+ } catch (Exception ex) {
+ LOG.Error("Can't parse response.", ex);
+ }
+ return null;
+ }
+ }
+}
diff --git a/GreenshotImmioPlugin/Forms/ImmioForm.cs b/GreenshotDropboxPlugin/Forms/DropboxForm.cs
similarity index 78%
rename from GreenshotImmioPlugin/Forms/ImmioForm.cs
rename to GreenshotDropboxPlugin/Forms/DropboxForm.cs
index ed117daf5..faaaae165 100644
--- a/GreenshotImmioPlugin/Forms/ImmioForm.cs
+++ b/GreenshotDropboxPlugin/Forms/DropboxForm.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -19,16 +19,9 @@
* along with this program. If not, see .
*/
using System;
-using System.Windows.Forms;
-using GreenshotPlugin.Core;
using GreenshotPlugin.Controls;
-namespace GreenshotImmioPlugin {
- ///
- /// Description of ImmioForm.
- ///
- public class ImmioForm : GreenshotForm {
- public ImmioForm() : base() {
- }
+namespace GreenshotDropboxPlugin.Forms {
+ public class DropboxForm : GreenshotForm {
}
}
diff --git a/GreenshotPhotobucketPlugin/Forms/SettingsForm.Designer.cs b/GreenshotDropboxPlugin/Forms/SettingsForm.Designer.cs
similarity index 62%
rename from GreenshotPhotobucketPlugin/Forms/SettingsForm.Designer.cs
rename to GreenshotDropboxPlugin/Forms/SettingsForm.Designer.cs
index fb1b23364..89d0711d2 100644
--- a/GreenshotPhotobucketPlugin/Forms/SettingsForm.Designer.cs
+++ b/GreenshotDropboxPlugin/Forms/SettingsForm.Designer.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2011 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/
@@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-namespace GreenshotPhotobucketPlugin {
+namespace GreenshotDropboxPlugin {
partial class SettingsForm {
///
/// Designer variable used to keep track of non-visual components.
@@ -44,115 +44,109 @@ namespace GreenshotPhotobucketPlugin {
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
///
- private void InitializeComponent()
- {
+ private void InitializeComponent() {
this.buttonOK = new GreenshotPlugin.Controls.GreenshotButton();
this.buttonCancel = new GreenshotPlugin.Controls.GreenshotButton();
- this.label_url = new GreenshotPlugin.Controls.GreenshotLabel();
- this.textBoxUrl = new GreenshotPlugin.Controls.GreenshotTextBox();
this.combobox_uploadimageformat = new GreenshotPlugin.Controls.GreenshotComboBox();
this.label_upload_format = new GreenshotPlugin.Controls.GreenshotLabel();
- this.checkbox_usepagelink = new GreenshotPlugin.Controls.GreenshotCheckBox();
+ this.label_AfterUpload = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.checkboxAfterUploadLinkToClipBoard = new GreenshotPlugin.Controls.GreenshotCheckBox();
this.SuspendLayout();
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonOK.LanguageKey = "photobucket.OK";
- this.buttonOK.Location = new System.Drawing.Point(222, 129);
+ this.buttonOK.LanguageKey = "OK";
+ this.buttonOK.Location = new System.Drawing.Point(267, 64);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2;
+ this.buttonOK.Text = "OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.ButtonOKClick);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonCancel.LanguageKey = "photobucket.CANCEL";
- this.buttonCancel.Location = new System.Drawing.Point(303, 129);
+ this.buttonCancel.LanguageKey = "CANCEL";
+ this.buttonCancel.Location = new System.Drawing.Point(348, 64);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 3;
+ this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancelClick);
//
- // label_url
- //
- this.label_url.LanguageKey = "photobucket.label_url";
- this.label_url.Location = new System.Drawing.Point(12, 21);
- this.label_url.Name = "label_url";
- this.label_url.Size = new System.Drawing.Size(84, 20);
- this.label_url.TabIndex = 7;
- //
- // textBoxUrl
- //
- this.textBoxUrl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.textBoxUrl.Location = new System.Drawing.Point(102, 21);
- this.textBoxUrl.Name = "textBoxUrl";
- this.textBoxUrl.PropertyName = "PhotobucketApiUrl";
- this.textBoxUrl.SectionName = "Photobucket";
- this.textBoxUrl.Size = new System.Drawing.Size(276, 20);
- this.textBoxUrl.TabIndex = 6;
- //
// combobox_uploadimageformat
//
+ this.combobox_uploadimageformat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.combobox_uploadimageformat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.combobox_uploadimageformat.FormattingEnabled = true;
- this.combobox_uploadimageformat.Location = new System.Drawing.Point(102, 47);
+ this.combobox_uploadimageformat.Location = new System.Drawing.Point(116, 9);
this.combobox_uploadimageformat.Name = "combobox_uploadimageformat";
this.combobox_uploadimageformat.PropertyName = "UploadFormat";
- this.combobox_uploadimageformat.SectionName = "Photobucket";
- this.combobox_uploadimageformat.Size = new System.Drawing.Size(276, 21);
+ this.combobox_uploadimageformat.SectionName = "Dropbox";
+ this.combobox_uploadimageformat.Size = new System.Drawing.Size(309, 21);
this.combobox_uploadimageformat.TabIndex = 8;
//
// label_upload_format
//
- this.label_upload_format.LanguageKey = "photobucket.label_upload_format";
- this.label_upload_format.Location = new System.Drawing.Point(12, 50);
+ this.label_upload_format.LanguageKey = "dropbox.label_upload_format";
+ this.label_upload_format.Location = new System.Drawing.Point(11, 12);
this.label_upload_format.Name = "label_upload_format";
this.label_upload_format.Size = new System.Drawing.Size(84, 20);
this.label_upload_format.TabIndex = 9;
+ this.label_upload_format.Text = "Image format";
//
- // checkbox_usepagelink
+ // label_AfterUpload
//
- this.checkbox_usepagelink.AutoSize = true;
- this.checkbox_usepagelink.LanguageKey = "photobucket.use_page_link";
- this.checkbox_usepagelink.Location = new System.Drawing.Point(15, 97);
- this.checkbox_usepagelink.Name = "checkbox_usepagelink";
- this.checkbox_usepagelink.PropertyName = "UsePageLink";
- this.checkbox_usepagelink.SectionName = "Photobucket";
- this.checkbox_usepagelink.Size = new System.Drawing.Size(297, 17);
- this.checkbox_usepagelink.TabIndex = 13;
- this.checkbox_usepagelink.UseVisualStyleBackColor = true;
+ this.label_AfterUpload.LanguageKey = "dropbox.label_AfterUpload";
+ this.label_AfterUpload.Location = new System.Drawing.Point(10, 37);
+ this.label_AfterUpload.Name = "label_AfterUpload";
+ this.label_AfterUpload.Size = new System.Drawing.Size(84, 21);
+ this.label_AfterUpload.TabIndex = 22;
+ this.label_AfterUpload.Text = "After upload";
+ //
+ // checkboxAfterUploadLinkToClipBoard
+ //
+ this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
+ this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "dropbox.label_AfterUploadLinkToClipBoard";
+ this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(116, 37);
+ this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";
+ this.checkboxAfterUploadLinkToClipBoard.PropertyName = "AfterUploadLinkToClipBoard";
+ this.checkboxAfterUploadLinkToClipBoard.SectionName = "Dropbox";
+ this.checkboxAfterUploadLinkToClipBoard.Size = new System.Drawing.Size(104, 17);
+ this.checkboxAfterUploadLinkToClipBoard.TabIndex = 24;
+ this.checkboxAfterUploadLinkToClipBoard.Text = "Link to clipboard";
+ this.checkboxAfterUploadLinkToClipBoard.UseVisualStyleBackColor = true;
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.ClientSize = new System.Drawing.Size(387, 168);
- this.Controls.Add(this.checkbox_usepagelink);
+ this.ClientSize = new System.Drawing.Size(432, 96);
+ this.Controls.Add(this.checkboxAfterUploadLinkToClipBoard);
+ this.Controls.Add(this.label_AfterUpload);
this.Controls.Add(this.label_upload_format);
this.Controls.Add(this.combobox_uploadimageformat);
- this.Controls.Add(this.label_url);
- this.Controls.Add(this.textBoxUrl);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.LanguageKey = "photobucket.settings_title";
+ this.LanguageKey = "dropbox.settings_title";
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SettingsForm";
+ this.Text = "Dropbox settings";
this.ResumeLayout(false);
this.PerformLayout();
}
private GreenshotPlugin.Controls.GreenshotComboBox combobox_uploadimageformat;
private GreenshotPlugin.Controls.GreenshotLabel label_upload_format;
- private GreenshotPlugin.Controls.GreenshotTextBox textBoxUrl;
- private GreenshotPlugin.Controls.GreenshotLabel label_url;
private GreenshotPlugin.Controls.GreenshotButton buttonCancel;
private GreenshotPlugin.Controls.GreenshotButton buttonOK;
- private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_usepagelink;
+ private GreenshotPlugin.Controls.GreenshotLabel label_AfterUpload;
+ private GreenshotPlugin.Controls.GreenshotCheckBox checkboxAfterUploadLinkToClipBoard;
}
}
diff --git a/GreenshotOfficeCommunicatorPlugin/Forms/SettingsForm.cs b/GreenshotDropboxPlugin/Forms/SettingsForm.cs
similarity index 76%
rename from GreenshotOfficeCommunicatorPlugin/Forms/SettingsForm.cs
rename to GreenshotDropboxPlugin/Forms/SettingsForm.cs
index 5cf2826b1..1c02aa711 100644
--- a/GreenshotOfficeCommunicatorPlugin/Forms/SettingsForm.cs
+++ b/GreenshotDropboxPlugin/Forms/SettingsForm.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -20,22 +20,26 @@
*/
using System;
using System.Windows.Forms;
+using GreenshotDropboxPlugin.Forms;
using GreenshotPlugin.Core;
-using GreenshotPlugin.Controls;
+using Greenshot.IniFile;
-namespace GreenshotOfficeCommunicatorPlugin {
+namespace GreenshotDropboxPlugin {
///
/// Description of PasswordRequestForm.
///
- public partial class SettingsForm : OfficeCommunicatorForm {
- public SettingsForm(OfficeCommunicatorConfiguration config) : base() {
+ public partial class SettingsForm : DropboxForm {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(SettingsForm));
+ private static DropboxPluginConfiguration config = IniConfig.GetIniSection();
+
+ public SettingsForm() {
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon();
}
-
+
void ButtonOKClick(object sender, EventArgs e) {
this.DialogResult = DialogResult.OK;
}
diff --git a/GreenshotDropboxPlugin/GreenshotDropboxPlugin.csproj b/GreenshotDropboxPlugin/GreenshotDropboxPlugin.csproj
new file mode 100644
index 000000000..395cb230f
--- /dev/null
+++ b/GreenshotDropboxPlugin/GreenshotDropboxPlugin.csproj
@@ -0,0 +1,108 @@
+
+
+
+
+ {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12}
+ Library
+ GreenshotDropboxPlugin
+ GreenshotDropboxPlugin
+ v2.0
+ Properties
+ False
+ False
+ 4
+ false
+ Always
+ 3.5
+
+
+
+
+
+ False
+ ..\lib\log4net.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form
+
+
+ SettingsForm.cs
+
+
+
+
+ DropboxPlugin.cs
+
+
+
+
+
+
+
+
+ {5B924697-4DCD-4F98-85F1-105CB84B7341}
+ GreenshotPlugin
+
+
+
+ if exist "$(ProjectDir)DropBoxCredentials.orig.cs" (
+ rename "$(ProjectDir)DropBoxCredentials.cs" "DropBoxCredentials.private.cs"
+ rename "$(ProjectDir)DropBoxCredentials.orig.cs" "DropBoxCredentials.cs"
+) else exit /b -1
+
+mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
+copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
+copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\"
+mkdir "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
+copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"
+
+ "$(SolutionDir)\tools\TortoiseSVN\SubWCRev.exe" "$(ProjectDir)\" "$(ProjectDir)\Properties\AssemblyInfo.cs.template" "$(ProjectDir)\Properties\AssemblyInfo.cs"
+
+if exist "$(ProjectDir)DropBoxCredentials.private.cs" (
+ rename "$(ProjectDir)DropBoxCredentials.cs" "DropBoxCredentials.orig.cs"
+ rename "$(ProjectDir)DropBoxCredentials.private.cs" "DropBoxCredentials.cs"
+) else exit /b -1
+
+
+ False
+ Off
+ 4194304
+ x86
+ 4096
+
+
+ False
+ Off
+ 4194304
+ AnyCPU
+ 4096
+
+
+ DEBUG;TRACE
+ False
+ True
+ Full
+ true
+
+
+ TRACE
+ True
+ False
+ None
+ false
+
+
\ No newline at end of file
diff --git a/GreenshotPhotobucketPlugin/LanguageKeys.cs b/GreenshotDropboxPlugin/LanguageKeys.cs
similarity index 82%
rename from GreenshotPhotobucketPlugin/LanguageKeys.cs
rename to GreenshotDropboxPlugin/LanguageKeys.cs
index 82debdf6d..38bfa6505 100644
--- a/GreenshotPhotobucketPlugin/LanguageKeys.cs
+++ b/GreenshotDropboxPlugin/LanguageKeys.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -18,25 +18,16 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-using System;
-
-namespace GreenshotPhotobucketPlugin {
+namespace GreenshotDropboxPlugin {
public enum LangKey {
upload_menu_item,
settings_title,
- label_url,
label_upload_format,
- label_clear,
- OK,
- CANCEL,
upload_success,
upload_failure,
communication_wait,
- delete_question,
- clear_question,
- delete_title,
- use_page_link,
- history,
- configure
+ Configure,
+ label_AfterUpload,
+ label_AfterUploadLinkToClipBoard
}
}
diff --git a/GreenshotDropboxPlugin/Languages/language_dropboxplugin-en-US.xml b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-en-US.xml
new file mode 100644
index 000000000..682135288
--- /dev/null
+++ b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-en-US.xml
@@ -0,0 +1,35 @@
+
+
+
+
+ Link to clipboard
+
+
+ Open history
+
+
+ After upload
+
+
+ Configure Dropbox
+
+
+ Upload to Dropbox
+
+
+ Dropbox settings
+
+
+ Successfully uploaded image to Dropbox!
+
+
+ An error occured while uploading to Dropbox:
+
+
+ Image format
+
+
+ Communicating with Dropbox. Please wait...
+
+
+
\ No newline at end of file
diff --git a/GreenshotDropboxPlugin/Languages/language_dropboxplugin-fr-FR.xml b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-fr-FR.xml
new file mode 100644
index 000000000..9f50c56d7
--- /dev/null
+++ b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-fr-FR.xml
@@ -0,0 +1,14 @@
+
+
+
+ Communication en cours avec Dropbox. Veuillez patientez...
+ Configurer Dropbox
+ Après téléversement
+ Copier le lien dans le presse-papier
+ Format image
+ Paramètres Dropbox
+ Une erreur s'est produite lors du téléversement vers Dropbox :
+ Téléverser vers Dropbox
+ Image téléversée aves succès vers Dropbox !
+
+
\ No newline at end of file
diff --git a/GreenshotDropboxPlugin/Languages/language_dropboxplugin-ru-RU.xml b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-ru-RU.xml
new file mode 100644
index 000000000..c63760cae
--- /dev/null
+++ b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-ru-RU.xml
@@ -0,0 +1,35 @@
+
+
+
+
+Ссылку в буфер обмена
+
+
+Открыть историию
+
+После загрузки
+
+ Настройка Dropbox
+
+
+
+Добавить в Dropbox
+
+
+
+Настройки Dropbox
+
+
+
+Изображение успешно загружено на Dropbox!
+
+
+
+Произошла ошибка при загрузке на Dropbox:
+
+
+
+Формат изображения
+ Обмен информацией с Dropbox. Подождите...
+
+
\ No newline at end of file
diff --git a/GreenshotDropboxPlugin/Languages/language_dropboxplugin-uk-UA.xml b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-uk-UA.xml
new file mode 100644
index 000000000..ee63423e9
--- /dev/null
+++ b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-uk-UA.xml
@@ -0,0 +1,14 @@
+
+
+
+ Посилання в буфер обміну
+ Після вивантаження
+ Налаштувати Dropbox
+ Вивантажити на Dropbox
+ Параметри Dropbox
+ Зображення вдало вивантажено на Dropbox!
+ Відбулась помилка при вивантаженні зображення на Dropbox:
+ Формат зображення
+ З’єднання з Dropbox. Будь ласка, зачекайте...
+
+
diff --git a/GreenshotDropboxPlugin/Languages/language_dropboxplugin-zh-CN.xml b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-zh-CN.xml
new file mode 100644
index 000000000..eacbbdd4c
--- /dev/null
+++ b/GreenshotDropboxPlugin/Languages/language_dropboxplugin-zh-CN.xml
@@ -0,0 +1,14 @@
+
+
+
+ 正在连接Dropbox。请稍后...
+ 配置Dropbox
+ 上传之后
+ 复制链接到剪贴板
+ 图片格式
+ Dropbox设置
+ 在上传到Dropbox时发生错误:
+ 上传到Dropbox
+ 图片已成功上传到了Dropbox!
+
+
\ No newline at end of file
diff --git a/GreenshotOfficeCommunicatorPlugin/Properties/AssemblyInfo.cs.template b/GreenshotDropboxPlugin/Properties/AssemblyInfo.cs.template
similarity index 78%
rename from GreenshotOfficeCommunicatorPlugin/Properties/AssemblyInfo.cs.template
rename to GreenshotDropboxPlugin/Properties/AssemblyInfo.cs.template
index e67db7f4e..f38f7c889 100644
--- a/GreenshotOfficeCommunicatorPlugin/Properties/AssemblyInfo.cs.template
+++ b/GreenshotDropboxPlugin/Properties/AssemblyInfo.cs.template
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -30,16 +30,16 @@ using Greenshot.Plugin;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("Greenshot-OfficeCommunicator-Plugin")]
-[assembly: AssemblyDescription("A plugin to upload images to office communicator")]
+[assembly: AssemblyTitle("Greenshot-Dropbox-Plugin")]
+[assembly: AssemblyDescription("A plugin to upload images to Dropbox")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Greenshot")]
-[assembly: AssemblyProduct("OfficeCommunicator Plugin")]
-[assembly: AssemblyCopyright("Copyright (C) 2007-2012")]
+[assembly: AssemblyCompany("Greenshot & F. Noel")]
+[assembly: AssemblyProduct("Dropbox Plugin")]
+[assembly: AssemblyCopyright("Copyright (C) 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The PluginAttribute describes the "entryType" and if the plugin is configurable
-[assembly: PluginAttribute("GreenshotOfficeCommunicatorPlugin.OfficeCommunicatorPlugin", true)]
+[assembly: PluginAttribute("GreenshotDropboxPlugin.DropboxPlugin", true)]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
@@ -51,4 +51,4 @@ using Greenshot.Plugin;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.3.$WCREV$")]
+[assembly: AssemblyVersion("1.0.5.$WCREV$")]
diff --git a/GreenshotExternalCommandPlugin/Properties/AssemblyInfo.cs.template b/GreenshotExternalCommandPlugin/Properties/AssemblyInfo.cs.template
index e07958dcf..6e99cd4b6 100644
--- a/GreenshotExternalCommandPlugin/Properties/AssemblyInfo.cs.template
+++ b/GreenshotExternalCommandPlugin/Properties/AssemblyInfo.cs.template
@@ -50,4 +50,4 @@ using Greenshot.Plugin;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.4.$WCREV$")]
+[assembly: AssemblyVersion("1.0.5.$WCREV$")]
diff --git a/GreenshotPhotobucketPlugin/PhotobucketConfiguration.cs b/GreenshotFlickrPlugin/FlickrConfiguration.cs
similarity index 50%
rename from GreenshotPhotobucketPlugin/PhotobucketConfiguration.cs
rename to GreenshotFlickrPlugin/FlickrConfiguration.cs
index 7a327bc30..7424e6778 100644
--- a/GreenshotPhotobucketPlugin/PhotobucketConfiguration.cs
+++ b/GreenshotFlickrPlugin/FlickrConfiguration.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -18,53 +18,56 @@
* 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.Windows.Forms;
-
-using GreenshotPlugin.Controls;
-using GreenshotPlugin.Core;
using Greenshot.IniFile;
+using GreenshotPlugin.Core;
-namespace GreenshotPhotobucketPlugin {
+namespace GreenshotFlickrPlugin {
+ public enum SafetyLevel {
+ Safe = 1,
+ Moderate = 2,
+ Restricted = 3
+ }
///
- /// Description of PhotobucketConfiguration.
+ /// Description of FlickrConfiguration.
///
- [IniSection("Photobucket", Description="Greenshot Photobucket Plugin configuration")]
- public class PhotobucketConfiguration : IniSection {
+ [IniSection("Flickr", Description = "Greenshot Flickr Plugin configuration")]
+ public class FlickrConfiguration : IniSection {
+ [IniProperty("flickrIsPublic", Description = "IsPublic.", DefaultValue = "true")]
+ public bool IsPublic;
+
+ [IniProperty("flickrIsFamily", Description = "IsFamily.", DefaultValue = "true")]
+ public bool IsFamily;
+
+ [IniProperty("flickrIsFriend", Description = "IsFriend.", DefaultValue = "true")]
+ public bool IsFriend;
+
+ [IniProperty("SafetyLevel", Description = "Safety level", DefaultValue = "Safe")]
+ public SafetyLevel SafetyLevel;
+
+ [IniProperty("HiddenFromSearch", Description = "Hidden from search", DefaultValue = "false")]
+ public bool HiddenFromSearch;
+
[IniProperty("UploadFormat", Description="What file type to use for uploading", DefaultValue="png")]
public OutputFormat UploadFormat;
+
[IniProperty("UploadJpegQuality", Description="JPEG file save quality in %.", DefaultValue="80")]
public int UploadJpegQuality;
- [IniProperty("UploadReduceColors", Description="Reduce color amount of the uploaded image to 256", DefaultValue="False")]
- public bool UploadReduceColors;
- [IniProperty("UsePageLink", Description = "Use pagelink instead of direct link on the clipboard", DefaultValue = "False")]
- public bool UsePageLink;
- [IniProperty("Token", Description = "The Photobucket token", Encrypted=true, ExcludeIfNull=true)]
- public string Token;
- [IniProperty("TokenSecret", Description = "The Photobucket token secret", Encrypted=true, ExcludeIfNull=true)]
- public string TokenSecret;
- [IniProperty("SubDomain", Description = "The Photobucket api subdomain", Encrypted = true, ExcludeIfNull = true)]
- public string SubDomain;
-
- public int Credits {
- get;
- set;
- }
- ///
- /// A form for username/password
+ [IniProperty("AfterUploadLinkToClipBoard", Description = "After upload send flickr link to clipboard.", DefaultValue = "true")]
+ public bool AfterUploadLinkToClipBoard;
+
+ [IniProperty("FlickrToken", Description = "The Flickr token", Encrypted = true, ExcludeIfNull = true)]
+ public string FlickrToken;
+ [IniProperty("FlickrTokenSecret", Description = "The Flickr token secret", Encrypted = true, ExcludeIfNull = true)]
+ public string FlickrTokenSecret;
+
+ ///
+ /// A form for token
///
/// bool true if OK was pressed, false if cancel
public bool ShowConfigDialog() {
- SettingsForm settingsForm = null;
-
- new PleaseWaitForm().ShowAndWait(PhotobucketPlugin.Attributes.Name, Language.GetString("photobucket", LangKey.communication_wait),
- delegate() {
- settingsForm = new SettingsForm(this);
- }
- );
- DialogResult result = settingsForm.ShowDialog();
+ DialogResult result = new SettingsForm(this).ShowDialog();
if (result == DialogResult.OK) {
return true;
}
diff --git a/GreenshotFlickrPlugin/FlickrCredentials.cs b/GreenshotFlickrPlugin/FlickrCredentials.cs
new file mode 100644
index 000000000..8cbbac87c
--- /dev/null
+++ b/GreenshotFlickrPlugin/FlickrCredentials.cs
@@ -0,0 +1,31 @@
+/*
+ * 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 .
+ */
+
+namespace GreenshotFlickrPlugin {
+ ///
+ /// This class is merely a placeholder for the file keeping the API key and secret for dropbox integration.
+ /// Copy this file to FlickrCredentials.private.cs and fill in valid credentials. (Or empty strings, but of course you won't be able to use the DropBox plugin then.)
+ ///
+ public static class FlickrCredentials {
+ public static string ConsumerKey = empty;
+ public static string ConsumerSecret = empty;
+ }
+}
diff --git a/GreenshotFlickrPlugin/FlickrCredentials.private.cs b/GreenshotFlickrPlugin/FlickrCredentials.private.cs
new file mode 100644
index 000000000..6d4b25296
--- /dev/null
+++ b/GreenshotFlickrPlugin/FlickrCredentials.private.cs
@@ -0,0 +1,8 @@
+using System;
+
+namespace GreenshotFlickrPlugin {
+ public static class FlickrCredentials {
+ public static string ConsumerKey = "f967e5148945cb3c4e149cc5be97796a";
+ public static string ConsumerSecret = "4180a21a1d2f8666";
+ }
+}
diff --git a/GreenshotFlickrPlugin/FlickrDestination.cs b/GreenshotFlickrPlugin/FlickrDestination.cs
new file mode 100644
index 000000000..609c962cb
--- /dev/null
+++ b/GreenshotFlickrPlugin/FlickrDestination.cs
@@ -0,0 +1,64 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
+ *
+ * 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 .
+ */
+using System.ComponentModel;
+using System.Drawing;
+using Greenshot.IniFile;
+using Greenshot.Plugin;
+using GreenshotPlugin.Core;
+
+namespace GreenshotFlickrPlugin {
+ public class FlickrDestination : AbstractDestination {
+ private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(FlickrDestination));
+ private static FlickrConfiguration config = IniConfig.GetIniSection();
+ private FlickrPlugin plugin = null;
+ public FlickrDestination(FlickrPlugin plugin) {
+ this.plugin = plugin;
+ }
+
+ public override string Designation {
+ get {
+ return "Flickr";
+ }
+ }
+
+ public override string Description {
+ get {
+ return Language.GetString("flickr", LangKey.upload_menu_item);
+ }
+ }
+
+ public override Image DisplayIcon {
+ get {
+ ComponentResourceManager resources = new ComponentResourceManager(typeof(FlickrPlugin));
+ return (Image)resources.GetObject("flickr");
+ }
+ }
+
+ public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
+ ExportInformation exportInformation = new ExportInformation(this.Designation, this.Description);
+ using (Image image = surface.GetImageForExport()) {
+ plugin.Upload(captureDetails, image, exportInformation);
+ }
+ ProcessExport(exportInformation, surface);
+ return exportInformation;
+ }
+ }
+}
diff --git a/GreenshotPhotobucketPlugin/PhotobucketPlugin.cs b/GreenshotFlickrPlugin/FlickrPlugin.cs
similarity index 50%
rename from GreenshotPhotobucketPlugin/PhotobucketPlugin.cs
rename to GreenshotFlickrPlugin/FlickrPlugin.cs
index 98b106f90..b5090b715 100644
--- a/GreenshotPhotobucketPlugin/PhotobucketPlugin.cs
+++ b/GreenshotFlickrPlugin/FlickrPlugin.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -24,31 +24,31 @@ using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
-using System.Threading;
-
+using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
-using Greenshot.IniFile;
-namespace GreenshotPhotobucketPlugin {
+namespace GreenshotFlickrPlugin
+{
///
- /// This is the GreenshotPhotobucketPlugin base code
+ /// This is the Flickr base code
///
- public class PhotobucketPlugin : IGreenshotPlugin {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketPlugin));
- private static PhotobucketConfiguration config;
+ public class FlickrPlugin : IGreenshotPlugin {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(FlickrPlugin));
+ private static FlickrConfiguration config;
public static PluginAttribute Attributes;
private IGreenshotHost host;
private ComponentResourceManager resources;
- public PhotobucketPlugin() {
+ public FlickrPlugin() {
}
public IEnumerable Destinations() {
- yield return new PhotobucketDestination(this);
+ yield return new FlickrDestination(this);
}
+
public IEnumerable Processors() {
yield break;
}
@@ -57,31 +57,29 @@ namespace GreenshotPhotobucketPlugin {
/// Implementation of the IGreenshotPlugin.Initialize
///
/// Use the IGreenshotPluginHost interface to register events
- /// Use the ICaptureHost interface to register in the MainContextMenu
/// My own attributes
- /// true if plugin is initialized, false if not (doesn't show)
public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
this.host = (IGreenshotHost)pluginHost;
Attributes = myAttributes;
- // Get configuration
- config = IniConfig.GetIniSection();
- resources = new ComponentResourceManager(typeof(PhotobucketPlugin));
-
- ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem("Photobucket " + Language.GetString("photobucket", LangKey.configure));
+
+ // Register configuration (don't need the configuration itself)
+ config = IniConfig.GetIniSection();
+ resources = new ComponentResourceManager(typeof(FlickrPlugin));
+
+ ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();
+ itemPlugInConfig.Text = Language.GetString("flickr", LangKey.Configure);
itemPlugInConfig.Tag = host;
- itemPlugInConfig.Click += delegate {
- config.ShowConfigDialog();
- };
- itemPlugInConfig.Image = (Image)resources.GetObject("Photobucket");
+ itemPlugInConfig.Image = (Image)resources.GetObject("flickr");
+ itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
PluginUtils.AddToContextMenu(host, itemPlugInConfig);
return true;
}
-
+
public virtual void Shutdown() {
- LOG.Debug("Photobucket Plugin shutdown.");
+ LOG.Debug("Flickr Plugin shutdown.");
}
///
@@ -97,50 +95,38 @@ namespace GreenshotPhotobucketPlugin {
///
///
public void Closing(object sender, FormClosingEventArgs e) {
- LOG.Debug("Application closing, de-registering Photobucket Plugin!");
+ LOG.Debug("Application closing, de-registering Flickr Plugin!");
Shutdown();
}
-
- ///
- /// Upload the capture to Photobucket
- ///
- ///
- ///
- /// out string for the url
- /// true if the upload succeeded
- public bool Upload(ICaptureDetails captureDetails, Image image, out string uploadURL) {
- OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
+
+ public void ConfigMenuClick(object sender, EventArgs eventArgs) {
+ config.ShowConfigDialog();
+ }
+
+ public void Upload(ICaptureDetails captureDetails, Image image, ExportInformation exportInformation) {
+ OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, false);
try {
- string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails));
- PhotobucketInfo photobucketInfo = null;
-
- // Run upload in the background
- new PleaseWaitForm().ShowAndWait(Attributes.Name, Language.GetString("photobucket", LangKey.communication_wait),
+ string flickrUrl = null;
+ new PleaseWaitForm().ShowAndWait(Attributes.Name, Language.GetString("flickr", LangKey.communication_wait),
delegate() {
- photobucketInfo = PhotobucketUtils.UploadToPhotobucket(image, outputSettings, captureDetails.Title, filename);
+ string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails));
+ flickrUrl = FlickrUtils.UploadToFlickr(image, outputSettings, captureDetails.Title, filename);
}
);
- // This causes an exeption if the upload failed :)
- LOG.DebugFormat("Uploaded to Photobucket page: " + photobucketInfo.Page);
- uploadURL = null;
- try {
- if (config.UsePageLink) {
- uploadURL = photobucketInfo.Page;
- Clipboard.SetText(photobucketInfo.Page);
- } else {
- uploadURL = photobucketInfo.Original;
- Clipboard.SetText(photobucketInfo.Original);
- }
- } catch (Exception ex) {
- LOG.Error("Can't write to clipboard: ", ex);
+
+ if (flickrUrl == null) {
+ exportInformation.ExportMade = false;
+ return;
+ }
+ exportInformation.ExportMade = true;
+ exportInformation.Uri = flickrUrl;
+
+ if (config.AfterUploadLinkToClipBoard) {
+ ClipboardHelper.SetClipboardData(flickrUrl);
}
- return true;
} catch (Exception e) {
- LOG.Error(e);
- MessageBox.Show(Language.GetString("photobucket", LangKey.upload_failure) + " " + e.Message);
+ MessageBox.Show(Language.GetString("flickr", LangKey.upload_failure) + " " + e.Message);
}
- uploadURL = null;
- return false;
}
}
}
diff --git a/GreenshotFlickrPlugin/FlickrPlugin.resx b/GreenshotFlickrPlugin/FlickrPlugin.resx
new file mode 100644
index 000000000..d4a65b3e2
--- /dev/null
+++ b/GreenshotFlickrPlugin/FlickrPlugin.resx
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ flickr.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/GreenshotFlickrPlugin/FlickrUtils.cs b/GreenshotFlickrPlugin/FlickrUtils.cs
new file mode 100644
index 000000000..0119e7bde
--- /dev/null
+++ b/GreenshotFlickrPlugin/FlickrUtils.cs
@@ -0,0 +1,129 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
+ *
+ * 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 .
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Xml;
+using Greenshot.IniFile;
+using Greenshot.Plugin;
+using GreenshotPlugin.Core;
+
+namespace GreenshotFlickrPlugin {
+ ///
+ /// Description of FlickrUtils.
+ ///
+ public class FlickrUtils {
+ private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(FlickrUtils));
+ private static FlickrConfiguration config = IniConfig.GetIniSection();
+
+ private FlickrUtils() {
+ }
+
+
+ ///
+ /// Do the actual upload to Flickr
+ /// For more details on the available parameters, see: http://flickrnet.codeplex.com
+ ///
+ /// byte[] with image data
+ /// url to image
+ public static string UploadToFlickr(Image image, OutputSettings outputSettings, string title, string filename) {
+ OAuthSession oAuth = new OAuthSession(FlickrCredentials.ConsumerKey, FlickrCredentials.ConsumerSecret);
+ oAuth.BrowserSize = new Size(520, 800);
+ oAuth.CheckVerifier = false;
+ oAuth.AccessTokenUrl = "http://api.flickr.com/services/oauth/access_token";
+ oAuth.AuthorizeUrl = "http://api.flickr.com/services/oauth/authorize";
+ oAuth.RequestTokenUrl = "http://api.flickr.com/services/oauth/request_token";
+ oAuth.LoginTitle = "Flickr authorization";
+ oAuth.Token = config.FlickrToken;
+ oAuth.TokenSecret = config.FlickrTokenSecret;
+ if (string.IsNullOrEmpty(oAuth.Token)) {
+ if (!oAuth.Authorize()) {
+ return null;
+ }
+ if (!string.IsNullOrEmpty(oAuth.Token)) {
+ config.FlickrToken = oAuth.Token;
+ }
+ if (!string.IsNullOrEmpty(oAuth.TokenSecret)) {
+ config.FlickrTokenSecret = oAuth.TokenSecret;
+ }
+ IniConfig.Save();
+ }
+ try {
+ IDictionary signedParameters = new Dictionary();
+ signedParameters.Add("content_type","2"); // Screenshot
+ signedParameters.Add("tags","Greenshot");
+ signedParameters.Add("is_public", config.IsPublic?"1":"0");
+ signedParameters.Add("is_friend", config.IsFriend?"1":"0");
+ signedParameters.Add("is_family", config.IsFamily?"1":"0");
+ signedParameters.Add("safety_level", string.Format("{0}", (int)config.SafetyLevel));
+ signedParameters.Add("hidden", config.HiddenFromSearch?"1":"2");
+ IDictionary otherParameters = new Dictionary();
+ otherParameters.Add("photo", new ImageContainer(image, outputSettings, filename));
+ string response = oAuth.MakeOAuthRequest(HTTPMethod.POST, "http://api.flickr.com/services/upload/", signedParameters, otherParameters, null);
+ string photoId = GetPhotoId(response);
+
+ // Get Photo Info
+ signedParameters = new Dictionary();
+ signedParameters.Add("photo_id", photoId);
+ string photoInfo = oAuth.MakeOAuthRequest(HTTPMethod.POST, "http://api.flickr.com/services/rest/?method=flickr.photos.getInfo", signedParameters, null, null);
+ return GetUrl(photoInfo);
+ } catch (Exception ex) {
+ LOG.Error("Upload error: ", ex);
+ throw ex;
+ } finally {
+ if (!string.IsNullOrEmpty(oAuth.Token)) {
+ config.FlickrToken = oAuth.Token;
+ }
+ if (!string.IsNullOrEmpty(oAuth.TokenSecret)) {
+ config.FlickrTokenSecret = oAuth.TokenSecret;
+ }
+ }
+ }
+
+ private static string GetUrl(string response) {
+ try {
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(response);
+ XmlNodeList nodes = doc.GetElementsByTagName("url");
+ if(nodes.Count > 0) {
+ return nodes.Item(0).InnerText;
+ }
+ } catch (Exception ex) {
+ LOG.Error("Error parsing Flickr Response.", ex);
+ }
+ return null;
+ }
+
+ private static string GetPhotoId(string response) {
+ try {
+ XmlDocument doc = new XmlDocument();
+ doc.LoadXml(response);
+ XmlNodeList nodes = doc.GetElementsByTagName("photoid");
+ if(nodes.Count > 0) {
+ return nodes.Item(0).InnerText;
+ }
+ } catch (Exception ex) {
+ LOG.Error("Error parsing Flickr Response.", ex);
+ }
+ return null;
+ }
+ }
+}
diff --git a/GreenshotPhotobucketPlugin/Forms/PhotobucketForm.cs b/GreenshotFlickrPlugin/Forms/FlickrForm.cs
similarity index 76%
rename from GreenshotPhotobucketPlugin/Forms/PhotobucketForm.cs
rename to GreenshotFlickrPlugin/Forms/FlickrForm.cs
index 5a2d509bc..da4ef5a13 100644
--- a/GreenshotPhotobucketPlugin/Forms/PhotobucketForm.cs
+++ b/GreenshotFlickrPlugin/Forms/FlickrForm.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -19,13 +19,9 @@
* along with this program. If not, see .
*/
using System;
+using GreenshotPlugin.Controls;
-namespace GreenshotPhotobucketPlugin {
- ///
- /// This class is needed for design-time resolving of the language files
- ///
- public class PhotobucketForm : GreenshotPlugin.Controls.GreenshotForm {
- public PhotobucketForm() : base() {
- }
+namespace GreenshotFlickrPlugin.Forms {
+ public class FlickrForm : GreenshotForm {
}
-}
+}
\ No newline at end of file
diff --git a/GreenshotFlickrPlugin/Forms/SettingsForm.Designer.cs b/GreenshotFlickrPlugin/Forms/SettingsForm.Designer.cs
new file mode 100644
index 000000000..b5f8d1b2b
--- /dev/null
+++ b/GreenshotFlickrPlugin/Forms/SettingsForm.Designer.cs
@@ -0,0 +1,244 @@
+/*
+ * Greenshot - a free and open source screenshot tool
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
+ *
+ * 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 .
+ */
+namespace GreenshotFlickrPlugin {
+ partial class SettingsForm {
+ ///
+ /// Designer variable used to keep track of non-visual components.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Disposes resources used by the form.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing) {
+ if (components != null) {
+ components.Dispose();
+ }
+ }
+ base.Dispose(disposing);
+ }
+
+ ///
+ /// This method is required for Windows Forms designer support.
+ /// Do not change the method contents inside the source code editor. The Forms designer might
+ /// not be able to load this method if it was changed manually.
+ ///
+ private void InitializeComponent()
+ {
+ this.buttonOK = new GreenshotPlugin.Controls.GreenshotButton();
+ this.buttonCancel = new GreenshotPlugin.Controls.GreenshotButton();
+ this.combobox_uploadimageformat = new GreenshotPlugin.Controls.GreenshotComboBox();
+ this.label_upload_format = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.checkBoxPublic = new GreenshotPlugin.Controls.GreenshotCheckBox();
+ this.checkBoxFamily = new GreenshotPlugin.Controls.GreenshotCheckBox();
+ this.checkBoxFriend = new GreenshotPlugin.Controls.GreenshotCheckBox();
+ this.label_SafetyLevel = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.combobox_safetyLevel = new GreenshotPlugin.Controls.GreenshotComboBox();
+ this.label_AfterUpload = new GreenshotPlugin.Controls.GreenshotLabel();
+ this.checkboxAfterUploadLinkToClipBoard = new GreenshotPlugin.Controls.GreenshotCheckBox();
+ this.checkBox_hiddenfromsearch = new GreenshotPlugin.Controls.GreenshotCheckBox();
+ this.SuspendLayout();
+ //
+ // buttonOK
+ //
+ this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonOK.LanguageKey = "OK";
+ this.buttonOK.Location = new System.Drawing.Point(270, 151);
+ this.buttonOK.Name = "buttonOK";
+ this.buttonOK.Size = new System.Drawing.Size(75, 23);
+ this.buttonOK.TabIndex = 18;
+ this.buttonOK.Text = "OK";
+ this.buttonOK.UseVisualStyleBackColor = true;
+ this.buttonOK.Click += new System.EventHandler(this.ButtonOKClick);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonCancel.LanguageKey = "CANCEL";
+ this.buttonCancel.Location = new System.Drawing.Point(351, 151);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(75, 23);
+ this.buttonCancel.TabIndex = 19;
+ this.buttonCancel.Text = "Cancel";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ this.buttonCancel.Click += new System.EventHandler(this.ButtonCancelClick);
+ //
+ // combobox_uploadimageformat
+ //
+ this.combobox_uploadimageformat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.combobox_uploadimageformat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.combobox_uploadimageformat.FormattingEnabled = true;
+ this.combobox_uploadimageformat.Location = new System.Drawing.Point(174, 6);
+ this.combobox_uploadimageformat.Name = "combobox_uploadimageformat";
+ this.combobox_uploadimageformat.PropertyName = "UploadFormat";
+ this.combobox_uploadimageformat.SectionName = "Flickr";
+ this.combobox_uploadimageformat.Size = new System.Drawing.Size(251, 21);
+ this.combobox_uploadimageformat.TabIndex = 4;
+ //
+ // label_upload_format
+ //
+ this.label_upload_format.LanguageKey = "flickr.label_upload_format";
+ this.label_upload_format.Location = new System.Drawing.Point(11, 9);
+ this.label_upload_format.Name = "label_upload_format";
+ this.label_upload_format.Size = new System.Drawing.Size(157, 20);
+ this.label_upload_format.TabIndex = 3;
+ this.label_upload_format.Text = "Image format";
+ //
+ // checkBoxPublic
+ //
+ this.checkBoxPublic.AutoSize = true;
+ this.checkBoxPublic.LanguageKey = "flickr.public";
+ this.checkBoxPublic.Location = new System.Drawing.Point(174, 88);
+ this.checkBoxPublic.Name = "checkBoxPublic";
+ this.checkBoxPublic.PropertyName = "IsPublic";
+ this.checkBoxPublic.SectionName = "Flickr";
+ this.checkBoxPublic.Size = new System.Drawing.Size(55, 17);
+ this.checkBoxPublic.TabIndex = 11;
+ this.checkBoxPublic.Text = "Public";
+ this.checkBoxPublic.UseVisualStyleBackColor = true;
+ //
+ // checkBoxFamily
+ //
+ this.checkBoxFamily.AutoSize = true;
+ this.checkBoxFamily.LanguageKey = "flickr.family";
+ this.checkBoxFamily.Location = new System.Drawing.Point(265, 88);
+ this.checkBoxFamily.Name = "checkBoxFamily";
+ this.checkBoxFamily.PropertyName = "IsFamily";
+ this.checkBoxFamily.SectionName = "Flickr";
+ this.checkBoxFamily.Size = new System.Drawing.Size(55, 17);
+ this.checkBoxFamily.TabIndex = 12;
+ this.checkBoxFamily.Text = "Family";
+ this.checkBoxFamily.UseVisualStyleBackColor = true;
+ //
+ // checkBoxFriend
+ //
+ this.checkBoxFriend.AutoSize = true;
+ this.checkBoxFriend.LanguageKey = "flickr.friend";
+ this.checkBoxFriend.Location = new System.Drawing.Point(350, 88);
+ this.checkBoxFriend.Name = "checkBoxFriend";
+ this.checkBoxFriend.PropertyName = "IsFriend";
+ this.checkBoxFriend.SectionName = "Flickr";
+ this.checkBoxFriend.Size = new System.Drawing.Size(52, 17);
+ this.checkBoxFriend.TabIndex = 13;
+ this.checkBoxFriend.Text = "Fiend";
+ this.checkBoxFriend.UseVisualStyleBackColor = true;
+ //
+ // label_SafetyLevel
+ //
+ this.label_SafetyLevel.LanguageKey = "flickr.label_SafetyLevel";
+ this.label_SafetyLevel.Location = new System.Drawing.Point(11, 36);
+ this.label_SafetyLevel.Name = "label_SafetyLevel";
+ this.label_SafetyLevel.Size = new System.Drawing.Size(157, 21);
+ this.label_SafetyLevel.TabIndex = 7;
+ this.label_SafetyLevel.Text = "Safety level";
+ //
+ // combobox_safetyLevel
+ //
+ this.combobox_safetyLevel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.combobox_safetyLevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.combobox_safetyLevel.FormattingEnabled = true;
+ this.combobox_safetyLevel.Location = new System.Drawing.Point(174, 33);
+ this.combobox_safetyLevel.Name = "combobox_safetyLevel";
+ this.combobox_safetyLevel.PropertyName = "SafetyLevel";
+ this.combobox_safetyLevel.SectionName = "Flickr";
+ this.combobox_safetyLevel.Size = new System.Drawing.Size(251, 21);
+ this.combobox_safetyLevel.TabIndex = 8;
+ //
+ // label_AfterUpload
+ //
+ this.label_AfterUpload.LanguageKey = "flickr.label_AfterUpload";
+ this.label_AfterUpload.Location = new System.Drawing.Point(12, 117);
+ this.label_AfterUpload.Name = "label_AfterUpload";
+ this.label_AfterUpload.Size = new System.Drawing.Size(155, 21);
+ this.label_AfterUpload.TabIndex = 14;
+ this.label_AfterUpload.Text = "After upload";
+ //
+ // checkboxAfterUploadLinkToClipBoard
+ //
+ this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
+ this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "flickr.label_AfterUploadLinkToClipBoard";
+ this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(173, 116);
+ this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";
+ this.checkboxAfterUploadLinkToClipBoard.PropertyName = "AfterUploadLinkToClipBoard";
+ this.checkboxAfterUploadLinkToClipBoard.SectionName = "Flickr";
+ this.checkboxAfterUploadLinkToClipBoard.Size = new System.Drawing.Size(104, 17);
+ this.checkboxAfterUploadLinkToClipBoard.TabIndex = 16;
+ this.checkboxAfterUploadLinkToClipBoard.Text = "Link to clipboard";
+ this.checkboxAfterUploadLinkToClipBoard.UseVisualStyleBackColor = true;
+ //
+ // checkBox_hiddenfromsearch
+ //
+ this.checkBox_hiddenfromsearch.AutoSize = true;
+ this.checkBox_hiddenfromsearch.LanguageKey = "flickr.label_HiddenFromSearch";
+ this.checkBox_hiddenfromsearch.Location = new System.Drawing.Point(174, 60);
+ this.checkBox_hiddenfromsearch.Name = "checkBox_hiddenfromsearch";
+ this.checkBox_hiddenfromsearch.PropertyName = "HiddenFromSearch";
+ this.checkBox_hiddenfromsearch.SectionName = "Flickr";
+ this.checkBox_hiddenfromsearch.Size = new System.Drawing.Size(118, 17);
+ this.checkBox_hiddenfromsearch.TabIndex = 20;
+ this.checkBox_hiddenfromsearch.Text = "Hidden from search";
+ this.checkBox_hiddenfromsearch.UseVisualStyleBackColor = true;
+ //
+ // SettingsForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
+ this.ClientSize = new System.Drawing.Size(432, 186);
+ this.Controls.Add(this.checkBox_hiddenfromsearch);
+ this.Controls.Add(this.checkboxAfterUploadLinkToClipBoard);
+ this.Controls.Add(this.label_AfterUpload);
+ this.Controls.Add(this.label_SafetyLevel);
+ this.Controls.Add(this.combobox_safetyLevel);
+ this.Controls.Add(this.checkBoxFriend);
+ this.Controls.Add(this.checkBoxFamily);
+ this.Controls.Add(this.checkBoxPublic);
+ this.Controls.Add(this.label_upload_format);
+ this.Controls.Add(this.combobox_uploadimageformat);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.buttonOK);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.LanguageKey = "flickr.settings_title";
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "SettingsForm";
+ this.Text = "Flickr settings";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+ }
+ private GreenshotPlugin.Controls.GreenshotCheckBox checkBox_hiddenfromsearch;
+ private GreenshotPlugin.Controls.GreenshotComboBox combobox_uploadimageformat;
+ private GreenshotPlugin.Controls.GreenshotLabel label_upload_format;
+ private GreenshotPlugin.Controls.GreenshotButton buttonCancel;
+ private GreenshotPlugin.Controls.GreenshotButton buttonOK;
+ private GreenshotPlugin.Controls.GreenshotCheckBox checkBoxPublic;
+ private GreenshotPlugin.Controls.GreenshotCheckBox checkBoxFamily;
+ private GreenshotPlugin.Controls.GreenshotCheckBox checkBoxFriend;
+ private GreenshotPlugin.Controls.GreenshotLabel label_SafetyLevel;
+ private GreenshotPlugin.Controls.GreenshotComboBox combobox_safetyLevel;
+ private GreenshotPlugin.Controls.GreenshotLabel label_AfterUpload;
+ private GreenshotPlugin.Controls.GreenshotCheckBox checkboxAfterUploadLinkToClipBoard;
+ }
+}
diff --git a/GreenshotImmioPlugin/Forms/SettingsForm.cs b/GreenshotFlickrPlugin/Forms/SettingsForm.cs
similarity index 82%
rename from GreenshotImmioPlugin/Forms/SettingsForm.cs
rename to GreenshotFlickrPlugin/Forms/SettingsForm.cs
index b8d3e3236..7da2a02af 100644
--- a/GreenshotImmioPlugin/Forms/SettingsForm.cs
+++ b/GreenshotFlickrPlugin/Forms/SettingsForm.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -19,16 +19,20 @@
* along with this program. If not, see .
*/
using System;
+using System.Drawing;
using System.Windows.Forms;
-using GreenshotPlugin.Core;
-using GreenshotPlugin.Controls;
-namespace GreenshotImmioPlugin {
+using GreenshotFlickrPlugin.Forms;
+using GreenshotPlugin.Core;
+
+namespace GreenshotFlickrPlugin {
///
/// Description of PasswordRequestForm.
///
- public partial class SettingsForm : ImmioForm {
- public SettingsForm(ImmioConfiguration config) : base() {
+ public partial class SettingsForm : FlickrForm {
+ private string flickrFrob = string.Empty;
+
+ public SettingsForm(FlickrConfiguration config) {
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
diff --git a/GreenshotImmioPlugin/GreenshotImmioPlugin.csproj b/GreenshotFlickrPlugin/GreenshotFlickrPlugin.csproj
similarity index 64%
rename from GreenshotImmioPlugin/GreenshotImmioPlugin.csproj
rename to GreenshotFlickrPlugin/GreenshotFlickrPlugin.csproj
index 4c4a8c046..d94e10010 100644
--- a/GreenshotImmioPlugin/GreenshotImmioPlugin.csproj
+++ b/GreenshotFlickrPlugin/GreenshotFlickrPlugin.csproj
@@ -2,10 +2,10 @@
- {B7B30064-1034-4C53-AB7C-17A007360C19}
+ {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}Library
- GreenshotImmioPlugin
- GreenshotImmioPlugin
+ GreenshotFlickrPlugin
+ GreenshotFlickrPluginv2.0PropertiesFalse
@@ -13,16 +13,12 @@
4falseAlways
-
-
- 3.5
-
- ..\Greenshot\Lib\log4net.dll
+ ..\lib\log4net.dll
@@ -30,56 +26,56 @@
-
+
+
+
+ Form
+ FormSettingsForm.cs
-
-
-
-
+
+
+
-
- Never
+
+ Always
+ Designer
-
-
- ImmioPlugin.cs
+
+ FlickrPlugin.cs
-
+
+
+
+ {5B924697-4DCD-4F98-85F1-105CB84B7341}GreenshotPlugin
- "$(SolutionDir)\tools\TortoiseSVN\SubWCRev.exe" "$(ProjectDir)\" "$(ProjectDir)\Properties\AssemblyInfo.cs.template" "$(ProjectDir)\Properties\AssemblyInfo.cs"
-
- mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
+ if exist "$(ProjectDir)FlickrCredentials.orig.cs" (
+ rename "$(ProjectDir)FlickrCredentials.cs" "FlickrCredentials.private.cs"
+ rename "$(ProjectDir)FlickrCredentials.orig.cs" "FlickrCredentials.cs"
+) else exit /b -1
+
+mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\"
mkdir "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
-copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"
-
-
-
- True
- False
- Full
- true
- TRACE
-
-
- False
- Off
- 4194304
- AnyCPU
- 4096
+copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"
+ "$(SolutionDir)\tools\TortoiseSVN\SubWCRev.exe" "$(ProjectDir)\" "$(ProjectDir)\Properties\AssemblyInfo.cs.template" "$(ProjectDir)\Properties\AssemblyInfo.cs"
+
+if exist "$(ProjectDir)FlickrCredentials.private.cs" (
+ rename "$(ProjectDir)FlickrCredentials.cs" "FlickrCredentials.orig.cs"
+ rename "$(ProjectDir)FlickrCredentials.private.cs" "FlickrCredentials.cs"
+) else exit /b -1False
@@ -88,11 +84,25 @@ copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languag
x864096
+
+ False
+ Off
+ 4194304
+ AnyCPU
+ 4096
+
+ DEBUG;TRACEFalseTrueFulltrue
- DEBUG;TRACE
+
+
+ TRACE
+ True
+ False
+ None
+ false
\ No newline at end of file
diff --git a/GreenshotOfficeCommunicatorPlugin/LanguageKeys.cs b/GreenshotFlickrPlugin/LanguageKeys.cs
similarity index 81%
rename from GreenshotOfficeCommunicatorPlugin/LanguageKeys.cs
rename to GreenshotFlickrPlugin/LanguageKeys.cs
index 8dc67c329..6f3fd2b92 100644
--- a/GreenshotOfficeCommunicatorPlugin/LanguageKeys.cs
+++ b/GreenshotFlickrPlugin/LanguageKeys.cs
@@ -1,6 +1,6 @@
/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -18,25 +18,18 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-using System;
-
-namespace GreenshotOfficeCommunicatorPlugin {
+namespace GreenshotFlickrPlugin {
public enum LangKey {
upload_menu_item,
settings_title,
- label_url,
label_upload_format,
- label_clear,
- OK,
- CANCEL,
upload_success,
upload_failure,
communication_wait,
- delete_question,
- clear_question,
- delete_title,
- use_page_link,
- history,
- configure
+ Configure,
+ label_HiddenFromSearch,
+ label_SafetyLevel,
+ label_AfterUpload,
+ label_AfterUploadLinkToClipBoard
}
}
diff --git a/GreenshotFlickrPlugin/Languages/language_flickrplugin-en-US.xml b/GreenshotFlickrPlugin/Languages/language_flickrplugin-en-US.xml
new file mode 100644
index 000000000..448920b39
--- /dev/null
+++ b/GreenshotFlickrPlugin/Languages/language_flickrplugin-en-US.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ Hidden form search
+
+
+ Safety level
+
+
+ Link to clipboard
+
+
+ After upload
+
+
+ Configure Flickr
+
+
+ Upload to Flickr
+
+
+ Flickr settings
+
+
+ Successfully uploaded image to Flickr!
+
+
+ An error occured while uploading to Flickr:
+
+
+ Image format
+
+
+ Communicating with Flickr. Please wait...
+
+
+ Public
+
+
+ Family
+
+
+ Fiend
+
+
+
\ No newline at end of file
diff --git a/GreenshotFlickrPlugin/Languages/language_flickrplugin-fr-FR.xml b/GreenshotFlickrPlugin/Languages/language_flickrplugin-fr-FR.xml
new file mode 100644
index 000000000..c464fc191
--- /dev/null
+++ b/GreenshotFlickrPlugin/Languages/language_flickrplugin-fr-FR.xml
@@ -0,0 +1,19 @@
+
+
+
+ Communication en cours avec Flickr. Veuillez patientez...
+ Configurer Flickr
+ Famille
+ Ami
+ Après téléversement
+ Copier le lien dans le presse-papier
+ Caché dans les recherches
+ Niveau de sécurité
+ Format image
+ Publique
+ Paramètres Flickr
+ Une erreur s'est produite lors du téléversement vers Flickr :
+ Téléverser vers Flickr
+ Image téléversée aves succès vers Flickr !
+
+
\ No newline at end of file
diff --git a/GreenshotFlickrPlugin/Languages/language_flickrplugin-it-IT.xml b/GreenshotFlickrPlugin/Languages/language_flickrplugin-it-IT.xml
new file mode 100644
index 000000000..88347e287
--- /dev/null
+++ b/GreenshotFlickrPlugin/Languages/language_flickrplugin-it-IT.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ Visibilità
+
+
+ Liv. sicurezza
+
+
+ Collegamento agli appunti
+
+
+ Dopo il carico
+
+
+ Configurazione Flickr
+
+
+ Carica su Flickr
+
+
+ Impostazioni di Flickr
+
+
+ Immagine caricata correttamente su Flickr!
+
+
+ Si è verificato un errore durante il caricamento su Flickr:
+
+
+ Formato immagine
+
+
+ Comunicazione con Flickr. Attendere prego...
+
+
+ Pubblica
+
+
+ Famiglia
+
+
+ Amici
+
+
+
\ No newline at end of file
diff --git a/GreenshotFlickrPlugin/Languages/language_flickrplugin-ru-RU.xml b/GreenshotFlickrPlugin/Languages/language_flickrplugin-ru-RU.xml
new file mode 100644
index 000000000..11a82f1b4
--- /dev/null
+++ b/GreenshotFlickrPlugin/Languages/language_flickrplugin-ru-RU.xml
@@ -0,0 +1,40 @@
+
+
+
+
+ Поиск скрытых форм
+
+ Уровень безопасности
+
+ Ссылка в буфер обмена
+
+ После загрузки
+
+ Настройка Flickr
+
+
+ Загрузить на Flickr
+
+
+ Параметры Flickr
+
+
+ Изображение успешно загружено на Flickr!
+
+
+ Произошла ошибка при загрузке на Flickr:
+
+
+ Формат изображения
+
+ Общение с Flickr. Подождите...
+
+
+ Общество
+
+ Семья
+
+ Друг
+
+
+
\ No newline at end of file
diff --git a/GreenshotFlickrPlugin/Languages/language_flickrplugin-uk-UA.xml b/GreenshotFlickrPlugin/Languages/language_flickrplugin-uk-UA.xml
new file mode 100644
index 000000000..01a72f6b6
--- /dev/null
+++ b/GreenshotFlickrPlugin/Languages/language_flickrplugin-uk-UA.xml
@@ -0,0 +1,19 @@
+
+
+
+ Приховати з пошуку
+ Рівень безпеки
+ Посилання в буфер обміну
+ Після вивантаження
+ Налаштувати Flickr
+ Вивантажити на Flickr
+ Параметри Flickr
+ Зображення вдало вивантажено на Flickr!
+ Відбулась помилка при вивантаженні зображення на Flickr:
+ Формат зображення
+ З’єднання з Flickr. Будь ласка, зачекайте...
+ Загальне
+ Родина
+ Друзі
+
+
diff --git a/GreenshotFlickrPlugin/Languages/language_flickrplugin-zh-CN.xml b/GreenshotFlickrPlugin/Languages/language_flickrplugin-zh-CN.xml
new file mode 100644
index 000000000..6c3e41a0c
--- /dev/null
+++ b/GreenshotFlickrPlugin/Languages/language_flickrplugin-zh-CN.xml
@@ -0,0 +1,19 @@
+
+
+
+ 正在连接到Flickr。请稍后...
+ 配置Flickr
+ 家庭
+ 朋友
+ 上传之后
+ 复制链接到剪贴板
+ 从搜索结果中隐藏
+ 安全级别
+ 图片格式
+ 公开
+ Flickr设置
+ 上除到Flickr时发生错误!
+ 上传到Flickr
+ 图片已成功上传到了Flickr!
+
+
\ No newline at end of file
diff --git a/GreenshotNetworkImportPlugin/Properties/AssemblyInfo.cs.template b/GreenshotFlickrPlugin/Properties/AssemblyInfo.cs.template
similarity index 73%
rename from GreenshotNetworkImportPlugin/Properties/AssemblyInfo.cs.template
rename to GreenshotFlickrPlugin/Properties/AssemblyInfo.cs.template
index f8dbc4b26..5efcf88fb 100644
--- a/GreenshotNetworkImportPlugin/Properties/AssemblyInfo.cs.template
+++ b/GreenshotFlickrPlugin/Properties/AssemblyInfo.cs.template
@@ -1,6 +1,6 @@
-/*
+/*
* Greenshot - a free and open source screenshot tool
- * Copyright (C) 2007-2011 Thomas Braun, Jens Klingen, Robin Krom
+ * Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom, Francis Noel
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
@@ -30,15 +30,16 @@ using Greenshot.Plugin;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("GreenshotNetworkImportPlugin")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyTitle("Greenshot-Flickr-Plugin")]
+[assembly: AssemblyDescription("A plugin to upload images to Flickr")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Greenshot")]
-[assembly: AssemblyProduct("Network import Plugin")]
-[assembly: AssemblyCopyright("Copyright (C) 2007-2011")]
+[assembly: AssemblyCompany("Greenshot & F. Noel")]
+[assembly: AssemblyProduct("Flickr Plugin")]
+[assembly: AssemblyCopyright("Copyright (C) 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: PluginAttribute("GreenshotNetworkImportPlugin.NetworkImportPlugin", false)]
+// The PluginAttribute describes the "entryType" and if the plugin is configurable
+[assembly: PluginAttribute("GreenshotFlickrPlugin.FlickrPlugin", true)]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
@@ -50,4 +51,4 @@ using Greenshot.Plugin;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.$WCREV$")]
+[assembly: AssemblyVersion("1.0.5.$WCREV$")]
diff --git a/GreenshotFlickrPlugin/flickr.png b/GreenshotFlickrPlugin/flickr.png
new file mode 100644
index 000000000..578575f9a
Binary files /dev/null and b/GreenshotFlickrPlugin/flickr.png differ
diff --git a/GreenshotImgurPlugin/Properties/AssemblyInfo.cs.template b/GreenshotImgurPlugin/Properties/AssemblyInfo.cs.template
index b8b7c0ae1..a4aee095e 100644
--- a/GreenshotImgurPlugin/Properties/AssemblyInfo.cs.template
+++ b/GreenshotImgurPlugin/Properties/AssemblyInfo.cs.template
@@ -51,4 +51,4 @@ using Greenshot.Plugin;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.4.$WCREV$")]
+[assembly: AssemblyVersion("1.0.5.$WCREV$")]
diff --git a/GreenshotImmioPlugin/ImmioUtils.cs b/GreenshotImmioPlugin/ImmioUtils.cs
deleted file mode 100644
index e3bd659d9..000000000
--- a/GreenshotImmioPlugin/ImmioUtils.cs
+++ /dev/null
@@ -1,65 +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 .
- */
-using System.Collections.Generic;
-using System.Drawing;
-using System.Net;
-using Greenshot.IniFile;
-using Greenshot.Plugin;
-using GreenshotPlugin.Core;
-
-namespace GreenshotImmioPlugin {
- ///
- /// Description of ImmioUtils.
- ///
- public class ImmioUtils {
- private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImmioUtils));
- private static ImmioConfiguration config = IniConfig.GetIniSection();
-
- private ImmioUtils() {
- }
-
- ///
- /// Do the actual upload to Immio
- ///
- /// Image to upload
- /// OutputSettings for the image file format
- /// Title
- /// Filename
- /// ImmioInfo with details
- public static string UploadToImmio(Image image, OutputSettings outputSettings, string title, string filename) {
-
- string responseString = null;
- HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest("http://imm.io/store/");
- webRequest.Method = "POST";
- webRequest.ServicePoint.Expect100Continue = false;
-
- IDictionary uploadParameters = new Dictionary();
- uploadParameters.Add("name", filename);
- uploadParameters.Add("image", new ImageContainer(image, outputSettings, null));
- NetworkHelper.WriteMultipartFormData(webRequest, uploadParameters);
-
- responseString = NetworkHelper.GetResponse(webRequest);
-
- IDictionary parsedResponse = JSONHelper.JsonDecode(responseString);
- return (string)parsedResponse["uri"];
- }
- }
-}
diff --git a/GreenshotJiraPlugin/Properties/AssemblyInfo.cs.template b/GreenshotJiraPlugin/Properties/AssemblyInfo.cs.template
index dfebd3150..cabc03a13 100644
--- a/GreenshotJiraPlugin/Properties/AssemblyInfo.cs.template
+++ b/GreenshotJiraPlugin/Properties/AssemblyInfo.cs.template
@@ -51,4 +51,4 @@ using Greenshot.Plugin;
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.4.$WCREV$")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.0.5.$WCREV$")]
\ No newline at end of file
diff --git a/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/background.html b/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/background.html
deleted file mode 100644
index f2ed0af1d..000000000
--- a/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/background.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/background.js b/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/background.js
deleted file mode 100644
index dd22a4c93..000000000
--- a/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/background.js
+++ /dev/null
@@ -1,29 +0,0 @@
-function sendCaptureToGreenshot(dataURL) {
- window.console.info('Sending data...');
- $.ajax({
- cache: false,
- type: "POST",
- contentType: "image/png;base64",
- dataType: "text",
- processData: false,
- data: dataURL,
- url: 'http://localhost:11234',
- success : function (text) {
- window.console.info('Got: ' + text);
- },
- error : function () {
- alert("Couldn't send capture, please check if Greenshot is running!");
- }
- });
-}
-
-function capture() {
- window.console.info('Starting capture');
- try {
- chrome.tabs.captureVisibleTab(null, {format:'png'}, captureTaken);
- } catch(exception) {
- alert( exception.toString());
- }
-}
-
-chrome.browserAction.onClicked.addListener(function(tab) {capture();});
diff --git a/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/greenshot.png b/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/greenshot.png
deleted file mode 100644
index 2087c5b13..000000000
Binary files a/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/greenshot.png and /dev/null differ
diff --git a/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/jquery-1.7.1.min.js b/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/jquery-1.7.1.min.js
deleted file mode 100644
index 198b3ff07..000000000
--- a/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/jquery-1.7.1.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/*! jQuery v1.7.1 jquery.com | jquery.org/license */
-(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="