mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 18:57:28 -07:00
Preparations for RC5, removed all the non 1.0 plug-ins out and the 1.0 in.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2184 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
f421d468b6
commit
3358352303
131 changed files with 3209 additions and 3186 deletions
77
GreenshotFlickrPlugin/FlickrConfiguration.cs
Normal file
77
GreenshotFlickrPlugin/FlickrConfiguration.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System.Windows.Forms;
|
||||
using Greenshot.IniFile;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace GreenshotFlickrPlugin {
|
||||
public enum SafetyLevel {
|
||||
Safe = 1,
|
||||
Moderate = 2,
|
||||
Restricted = 3
|
||||
}
|
||||
/// <summary>
|
||||
/// Description of FlickrConfiguration.
|
||||
/// </summary>
|
||||
[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("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;
|
||||
|
||||
/// <summary>
|
||||
/// A form for token
|
||||
/// </summary>
|
||||
/// <returns>bool true if OK was pressed, false if cancel</returns>
|
||||
public bool ShowConfigDialog() {
|
||||
DialogResult result = new SettingsForm(this).ShowDialog();
|
||||
if (result == DialogResult.OK) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
31
GreenshotFlickrPlugin/FlickrCredentials.cs
Normal file
31
GreenshotFlickrPlugin/FlickrCredentials.cs
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotFlickrPlugin {
|
||||
/// <summary>
|
||||
/// 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.)
|
||||
/// </summary>
|
||||
public static class FlickrCredentials {
|
||||
public static string ConsumerKey = empty;
|
||||
public static string ConsumerSecret = empty;
|
||||
}
|
||||
}
|
8
GreenshotFlickrPlugin/FlickrCredentials.private.cs
Normal file
8
GreenshotFlickrPlugin/FlickrCredentials.private.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace GreenshotFlickrPlugin {
|
||||
public static class FlickrCredentials {
|
||||
public static string ConsumerKey = "f967e5148945cb3c4e149cc5be97796a";
|
||||
public static string ConsumerSecret = "4180a21a1d2f8666";
|
||||
}
|
||||
}
|
64
GreenshotFlickrPlugin/FlickrDestination.cs
Normal file
64
GreenshotFlickrPlugin/FlickrDestination.cs
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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<FlickrConfiguration>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
132
GreenshotFlickrPlugin/FlickrPlugin.cs
Normal file
132
GreenshotFlickrPlugin/FlickrPlugin.cs
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Greenshot.IniFile;
|
||||
using Greenshot.Plugin;
|
||||
using GreenshotPlugin.Controls;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace GreenshotFlickrPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the Flickr base code
|
||||
/// </summary>
|
||||
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 FlickrPlugin() {
|
||||
}
|
||||
|
||||
public IEnumerable<IDestination> Destinations() {
|
||||
yield return new FlickrDestination(this);
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<IProcessor> Processors() {
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the IGreenshotPlugin.Initialize
|
||||
/// </summary>
|
||||
/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
|
||||
/// <param name="pluginAttribute">My own attributes</param>
|
||||
public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
|
||||
this.host = (IGreenshotHost)pluginHost;
|
||||
Attributes = myAttributes;
|
||||
|
||||
|
||||
// Register configuration (don't need the configuration itself)
|
||||
config = IniConfig.GetIniSection<FlickrConfiguration>();
|
||||
resources = new ComponentResourceManager(typeof(FlickrPlugin));
|
||||
|
||||
ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();
|
||||
itemPlugInConfig.Text = Language.GetString("flickr", LangKey.Configure);
|
||||
itemPlugInConfig.Tag = host;
|
||||
itemPlugInConfig.Image = (Image)resources.GetObject("flickr");
|
||||
itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
|
||||
|
||||
PluginUtils.AddToContextMenu(host, itemPlugInConfig);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Shutdown() {
|
||||
LOG.Debug("Flickr Plugin shutdown.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the IPlugin.Configure
|
||||
/// </summary>
|
||||
public virtual void Configure() {
|
||||
config.ShowConfigDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will be called when Greenshot is shutting down
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
public void Closing(object sender, FormClosingEventArgs e) {
|
||||
LOG.Debug("Application closing, de-registering Flickr Plugin!");
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
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 flickrUrl = null;
|
||||
new PleaseWaitForm().ShowAndWait(Attributes.Name, Language.GetString("flickr", LangKey.communication_wait),
|
||||
delegate() {
|
||||
string filename = Path.GetFileName(FilenameHelper.GetFilename(config.UploadFormat, captureDetails));
|
||||
flickrUrl = FlickrUtils.UploadToFlickr(image, outputSettings, captureDetails.Title, filename);
|
||||
}
|
||||
);
|
||||
|
||||
if (flickrUrl == null) {
|
||||
exportInformation.ExportMade = false;
|
||||
return;
|
||||
}
|
||||
exportInformation.ExportMade = true;
|
||||
exportInformation.Uri = flickrUrl;
|
||||
|
||||
if (config.AfterUploadLinkToClipBoard) {
|
||||
ClipboardHelper.SetClipboardData(flickrUrl);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
MessageBox.Show(Language.GetString("flickr", LangKey.upload_failure) + " " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
124
GreenshotFlickrPlugin/FlickrPlugin.resx
Normal file
124
GreenshotFlickrPlugin/FlickrPlugin.resx
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="flickr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>flickr.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
129
GreenshotFlickrPlugin/FlickrUtils.cs
Normal file
129
GreenshotFlickrPlugin/FlickrUtils.cs
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Xml;
|
||||
using Greenshot.IniFile;
|
||||
using Greenshot.Plugin;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace GreenshotFlickrPlugin {
|
||||
/// <summary>
|
||||
/// Description of FlickrUtils.
|
||||
/// </summary>
|
||||
public class FlickrUtils {
|
||||
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(FlickrUtils));
|
||||
private static FlickrConfiguration config = IniConfig.GetIniSection<FlickrConfiguration>();
|
||||
|
||||
private FlickrUtils() {
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Do the actual upload to Flickr
|
||||
/// For more details on the available parameters, see: http://flickrnet.codeplex.com
|
||||
/// </summary>
|
||||
/// <param name="imageData">byte[] with image data</param>
|
||||
/// <returns>url to image</returns>
|
||||
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<string, object> signedParameters = new Dictionary<string, object>();
|
||||
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<string, object> otherParameters = new Dictionary<string, object>();
|
||||
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<string, object>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
27
GreenshotFlickrPlugin/Forms/FlickrForm.cs
Normal file
27
GreenshotFlickrPlugin/Forms/FlickrForm.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
using GreenshotPlugin.Controls;
|
||||
|
||||
namespace GreenshotFlickrPlugin.Forms {
|
||||
public class FlickrForm : GreenshotForm {
|
||||
}
|
||||
}
|
244
GreenshotFlickrPlugin/Forms/SettingsForm.Designer.cs
generated
Normal file
244
GreenshotFlickrPlugin/Forms/SettingsForm.Designer.cs
generated
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
namespace GreenshotFlickrPlugin {
|
||||
partial class SettingsForm {
|
||||
/// <summary>
|
||||
/// Designer variable used to keep track of non-visual components.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Disposes resources used by the form.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing) {
|
||||
if (components != null) {
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
51
GreenshotFlickrPlugin/Forms/SettingsForm.cs
Normal file
51
GreenshotFlickrPlugin/Forms/SettingsForm.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using GreenshotFlickrPlugin.Forms;
|
||||
using GreenshotPlugin.Core;
|
||||
|
||||
namespace GreenshotFlickrPlugin {
|
||||
/// <summary>
|
||||
/// Description of PasswordRequestForm.
|
||||
/// </summary>
|
||||
public partial class SettingsForm : FlickrForm {
|
||||
private string flickrFrob = string.Empty;
|
||||
|
||||
public SettingsForm(FlickrConfiguration 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;
|
||||
}
|
||||
|
||||
void ButtonCancelClick(object sender, System.EventArgs e) {
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
}
|
108
GreenshotFlickrPlugin/GreenshotFlickrPlugin.csproj
Normal file
108
GreenshotFlickrPlugin/GreenshotFlickrPlugin.csproj
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\CommonProject.properties" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>GreenshotFlickrPlugin</RootNamespace>
|
||||
<AssemblyName>GreenshotFlickrPlugin</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<NoStdLib>False</NoStdLib>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\lib\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FlickrCredentials.cs" />
|
||||
<Compile Include="FlickrDestination.cs" />
|
||||
<Compile Include="Forms\FlickrForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\SettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\SettingsForm.Designer.cs">
|
||||
<DependentUpon>SettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FlickrPlugin.cs" />
|
||||
<Compile Include="FlickrConfiguration.cs" />
|
||||
<Compile Include="FlickrUtils.cs" />
|
||||
<Compile Include="LanguageKeys.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<None Include="Languages\language_flickrplugin-en-US.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<EmbeddedResource Include="FlickrPlugin.resx">
|
||||
<DependentUpon>FlickrPlugin.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="flickr.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Greenshot\GreenshotPlugin\GreenshotPlugin.csproj">
|
||||
<Project>{5B924697-4DCD-4F98-85F1-105CB84B7341}</Project>
|
||||
<Name>GreenshotPlugin</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>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)\"</PostBuildEvent>
|
||||
<PreBuildEvent>"$(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 -1</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<BaseAddress>4194304</BaseAddress>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<Optimize>False</Optimize>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<DebugType>Full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>True</Optimize>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
</Project>
|
35
GreenshotFlickrPlugin/LanguageKeys.cs
Normal file
35
GreenshotFlickrPlugin/LanguageKeys.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
namespace GreenshotFlickrPlugin {
|
||||
public enum LangKey {
|
||||
upload_menu_item,
|
||||
settings_title,
|
||||
label_upload_format,
|
||||
upload_success,
|
||||
upload_failure,
|
||||
communication_wait,
|
||||
Configure,
|
||||
label_HiddenFromSearch,
|
||||
label_SafetyLevel,
|
||||
label_AfterUpload,
|
||||
label_AfterUploadLinkToClipBoard
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<language description="English" ietf="en-US" version="1.0.0">
|
||||
<resources>
|
||||
<resource name="label_HiddenFromSearch">
|
||||
Hidden form search
|
||||
</resource>
|
||||
<resource name="label_SafetyLevel">
|
||||
Safety level
|
||||
</resource>
|
||||
<resource name="label_AfterUploadLinkToClipBoard">
|
||||
Link to clipboard
|
||||
</resource>
|
||||
<resource name="label_AfterUpload">
|
||||
After upload
|
||||
</resource>
|
||||
<resource name="Configure">
|
||||
Configure Flickr
|
||||
</resource>
|
||||
<resource name="upload_menu_item">
|
||||
Upload to Flickr
|
||||
</resource>
|
||||
<resource name="settings_title">
|
||||
Flickr settings
|
||||
</resource>
|
||||
<resource name="upload_success">
|
||||
Successfully uploaded image to Flickr!
|
||||
</resource>
|
||||
<resource name="upload_failure">
|
||||
An error occured while uploading to Flickr:
|
||||
</resource>
|
||||
<resource name="label_upload_format">
|
||||
Image format
|
||||
</resource>
|
||||
<resource name="communication_wait">
|
||||
Communicating with Flickr. Please wait...
|
||||
</resource>
|
||||
<resource name="public">
|
||||
Public
|
||||
</resource>
|
||||
<resource name="family">
|
||||
Family
|
||||
</resource>
|
||||
<resource name="friend">
|
||||
Fiend
|
||||
</resource>
|
||||
</resources>
|
||||
</language>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<language description="Français" ietf="fr-FR" version="1.0.0" languagegroup="">
|
||||
<resources>
|
||||
<resource name="communication_wait">Communication en cours avec Flickr. Veuillez patientez...</resource>
|
||||
<resource name="Configure">Configurer Flickr</resource>
|
||||
<resource name="family">Famille</resource>
|
||||
<resource name="friend">Ami</resource>
|
||||
<resource name="label_AfterUpload">Après téléversement</resource>
|
||||
<resource name="label_AfterUploadLinkToClipBoard">Copier le lien dans le presse-papier</resource>
|
||||
<resource name="label_HiddenFromSearch">Caché dans les recherches</resource>
|
||||
<resource name="label_SafetyLevel">Niveau de sécurité</resource>
|
||||
<resource name="label_upload_format">Format image</resource>
|
||||
<resource name="public">Publique</resource>
|
||||
<resource name="settings_title">Paramètres Flickr</resource>
|
||||
<resource name="upload_failure">Une erreur s'est produite lors du téléversement vers Flickr :</resource>
|
||||
<resource name="upload_menu_item">Téléverser vers Flickr</resource>
|
||||
<resource name="upload_success">Image téléversée aves succès vers Flickr !</resource>
|
||||
</resources>
|
||||
</language>
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<language description="Italiano" ietf="it-IT" version="1.0.0">
|
||||
<resources>
|
||||
<resource name="label_HiddenFromSearch">
|
||||
Visibilità
|
||||
</resource>
|
||||
<resource name="label_SafetyLevel">
|
||||
Liv. sicurezza
|
||||
</resource>
|
||||
<resource name="label_AfterUploadLinkToClipBoard">
|
||||
Collegamento agli appunti
|
||||
</resource>
|
||||
<resource name="label_AfterUpload">
|
||||
Dopo il carico
|
||||
</resource>
|
||||
<resource name="Configure">
|
||||
Configurazione Flickr
|
||||
</resource>
|
||||
<resource name="upload_menu_item">
|
||||
Carica su Flickr
|
||||
</resource>
|
||||
<resource name="settings_title">
|
||||
Impostazioni di Flickr
|
||||
</resource>
|
||||
<resource name="upload_success">
|
||||
Immagine caricata correttamente su Flickr!
|
||||
</resource>
|
||||
<resource name="upload_failure">
|
||||
Si è verificato un errore durante il caricamento su Flickr:
|
||||
</resource>
|
||||
<resource name="label_upload_format">
|
||||
Formato immagine
|
||||
</resource>
|
||||
<resource name="communication_wait">
|
||||
Comunicazione con Flickr. Attendere prego...
|
||||
</resource>
|
||||
<resource name="public">
|
||||
Pubblica
|
||||
</resource>
|
||||
<resource name="family">
|
||||
Famiglia
|
||||
</resource>
|
||||
<resource name="friend">
|
||||
Amici
|
||||
</resource>
|
||||
</resources>
|
||||
</language>
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<language description="Русский" ietf="ru-RU" version="1.0.0">
|
||||
<resources>
|
||||
<resource name="label_HiddenFromSearch">
|
||||
Поиск скрытых форм </resource>
|
||||
<resource name="label_SafetyLevel">
|
||||
Уровень безопасности </resource>
|
||||
<resource name="label_AfterUploadLinkToClipBoard">
|
||||
Ссылка в буфер обмена </resource>
|
||||
<resource name="label_AfterUpload">
|
||||
После загрузки </resource>
|
||||
<resource name="Configure">
|
||||
Настройка Flickr
|
||||
</resource>
|
||||
<resource name="upload_menu_item">
|
||||
Загрузить на Flickr
|
||||
</resource>
|
||||
<resource name="settings_title">
|
||||
Параметры Flickr
|
||||
</resource>
|
||||
<resource name="upload_success">
|
||||
Изображение успешно загружено на Flickr!
|
||||
</resource>
|
||||
<resource name="upload_failure">
|
||||
Произошла ошибка при загрузке на Flickr:
|
||||
</resource>
|
||||
<resource name="label_upload_format">
|
||||
Формат изображения </resource>
|
||||
<resource name="communication_wait">
|
||||
Общение с Flickr. Подождите...
|
||||
</resource>
|
||||
<resource name="public">
|
||||
Общество </resource>
|
||||
<resource name="family">
|
||||
Семья </resource>
|
||||
<resource name="friend">
|
||||
Друг
|
||||
</resource>
|
||||
</resources>
|
||||
</language>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<language description="Українська" ietf="uk-UA" version="1.0.0">
|
||||
<resources>
|
||||
<resource name="label_HiddenFromSearch">Приховати з пошуку</resource>
|
||||
<resource name="label_SafetyLevel">Рівень безпеки</resource>
|
||||
<resource name="label_AfterUploadLinkToClipBoard">Посилання в буфер обміну</resource>
|
||||
<resource name="label_AfterUpload">Після вивантаження</resource>
|
||||
<resource name="Configure">Налаштувати Flickr</resource>
|
||||
<resource name="upload_menu_item">Вивантажити на Flickr</resource>
|
||||
<resource name="settings_title">Параметри Flickr</resource>
|
||||
<resource name="upload_success">Зображення вдало вивантажено на Flickr!</resource>
|
||||
<resource name="upload_failure">Відбулась помилка при вивантаженні зображення на Flickr:</resource>
|
||||
<resource name="label_upload_format">Формат зображення</resource>
|
||||
<resource name="communication_wait">З’єднання з Flickr. Будь ласка, зачекайте...</resource>
|
||||
<resource name="public">Загальне</resource>
|
||||
<resource name="family">Родина</resource>
|
||||
<resource name="friend">Друзі</resource>
|
||||
</resources>
|
||||
</language>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<language description="简体中文" ietf="zh-CN" version="1.0.3" languagegroup="a">
|
||||
<resources>
|
||||
<resource name="communication_wait">正在连接到Flickr。请稍后...</resource>
|
||||
<resource name="Configure">配置Flickr</resource>
|
||||
<resource name="family">家庭</resource>
|
||||
<resource name="friend">朋友</resource>
|
||||
<resource name="label_AfterUpload">上传之后</resource>
|
||||
<resource name="label_AfterUploadLinkToClipBoard">复制链接到剪贴板</resource>
|
||||
<resource name="label_HiddenFromSearch">从搜索结果中隐藏</resource>
|
||||
<resource name="label_SafetyLevel">安全级别</resource>
|
||||
<resource name="label_upload_format">图片格式</resource>
|
||||
<resource name="public">公开</resource>
|
||||
<resource name="settings_title">Flickr设置</resource>
|
||||
<resource name="upload_failure">上除到Flickr时发生错误!</resource>
|
||||
<resource name="upload_menu_item">上传到Flickr</resource>
|
||||
<resource name="upload_success">图片已成功上传到了Flickr!</resource>
|
||||
</resources>
|
||||
</language>
|
54
GreenshotFlickrPlugin/Properties/AssemblyInfo.cs.template
Normal file
54
GreenshotFlickrPlugin/Properties/AssemblyInfo.cs.template
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#region Using directives
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Greenshot.Plugin;
|
||||
|
||||
#endregion
|
||||
|
||||
// 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-Flickr-Plugin")]
|
||||
[assembly: AssemblyDescription("A plugin to upload images to Flickr")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Greenshot & F. Noel")]
|
||||
[assembly: AssemblyProduct("Flickr Plugin")]
|
||||
[assembly: AssemblyCopyright("Copyright (C) 2012")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
// 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.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// 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.5.$WCREV$")]
|
BIN
GreenshotFlickrPlugin/flickr.png
Normal file
BIN
GreenshotFlickrPlugin/flickr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 776 B |
Loading…
Add table
Add a link
Reference in a new issue