Initial Flickr Plugin code

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@698 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2010-07-25 13:34:21 +00:00
commit 4698bb01b6
11 changed files with 758 additions and 0 deletions

View file

@ -0,0 +1,162 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Windows.Forms;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using Microsoft.Win32;
namespace GreenshotFlickrPlugin {
/// <summary>
/// OCR Plugin Greenshot
/// </summary>
public class FlickrPlugin : IGreenshotPlugin {
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(FlickrPlugin));
private const string CONFIG_FILENAME = "flickr-config.properties";
private ILanguage lang = Language.GetInstance();
private IGreenshotPluginHost host;
private ICaptureHost captureHost = null;
private PluginAttribute myAttributes;
private Properties config = new Properties();
public FlickrPlugin() { }
/// <summary>
/// Implementation of the IGreenshotPlugin.Initialize
/// </summary>
/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
/// <param name="pluginAttribute">My own attributes</param>
public void Initialize(IGreenshotPluginHost host, ICaptureHost captureHost, PluginAttribute myAttributes) {
LOG.Debug("Initialize called of " + myAttributes.Name);
this.host = (IGreenshotPluginHost)host;
this.captureHost = captureHost;
this.myAttributes = myAttributes;
host.OnImageEditorOpen += new OnImageEditorOpenHandler(ImageEditorOpened);
// Make sure the MODI-DLLs are found by adding a resolver
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(MyAssemblyResolver);
LoadConfig();
}
/// <summary>
/// Implementation of the OnImageEditorOpen event
/// Using the ImageEditor interface to register in the plugin menu
/// </summary>
private void ImageEditorOpened(object sender, ImageEditorOpenEventArgs eventArgs) {
ToolStripMenuItem toolStripMenuItem = eventArgs.ImageEditor.GetPluginMenuItem();
ToolStripMenuItem item = new ToolStripMenuItem();
item.Text = "Upload to Flickr";
item.Tag = eventArgs.ImageEditor;
item.Click += new System.EventHandler(EditMenuClick);
toolStripMenuItem.DropDownItems.Add(item);
}
/// <summary>
/// Implementation of the IGreenshotPlugin.Shutdown
/// </summary>
public void Shutdown() {
LOG.Debug("Shutdown of " + myAttributes.Name);
host.OnImageEditorOpen -= new OnImageEditorOpenHandler(ImageEditorOpened);
}
/// <summary>
/// Implementation of the IPlugin.Configure
/// </summary>
public virtual void Configure() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("This plugin doesn't have a configuration screen.");
stringBuilder.AppendLine("Configuration is stored at: " + Path.Combine(host.ConfigurationPath, CONFIG_FILENAME));
MessageBox.Show(stringBuilder.ToString());
}
/// <summary>
/// This method helps to resolve the MODI DLL files
/// </summary>
/// <param name="sender">object which is starting the resolve</param>
/// <param name="args">ResolveEventArgs describing the Assembly that needs to be found</param>
/// <returns></returns>
private Assembly MyAssemblyResolver(object sender, ResolveEventArgs args) {
string dllPath = Path.GetDirectoryName(myAttributes.DllFile);
string dllFilename = args.Name.Substring(0, args.Name.IndexOf(",")) + ".dll";
LOG.Debug("Resolving: " + dllFilename);
if (dllFilename.StartsWith("Flickr")) {
return Assembly.LoadFile(Path.Combine(dllPath, dllFilename));
}
return null;
}
private void LoadConfig() {
string filename = Path.Combine(host.ConfigurationPath, CONFIG_FILENAME);
if (File.Exists(filename)) {
LOG.Debug("Loading configuration from: " + filename);
config = Properties.read(filename);
}
bool changed = false;
if (config == null) {
config = new Properties();
changed = true;
}
if (changed) {
SaveConfig();
}
}
private void SaveConfig() {
string filename = Path.Combine(host.ConfigurationPath, CONFIG_FILENAME);
LOG.Debug("Saving configuration to: " + filename);
config.write(filename, "# The configuration file for the Greenshot Flickr Plugin");
}
/// <summary>
/// This will be called when the menu item in the Editor is clicked
/// </summary>
public void EditMenuClick(object sender, EventArgs eventArgs) {
ToolStripMenuItem item = (ToolStripMenuItem)sender;
IImageEditor imageEditor = (IImageEditor)item.Tag;
FlickrUploadForm uploader = new FlickrUploadForm();
DialogResult result = uploader.ShowDialog();
if (result == DialogResult.OK) {
using (MemoryStream stream = new MemoryStream()) {
imageEditor.SaveToStream(stream, "PNG", 100);
stream.Seek(0, SeekOrigin.Begin);
try {
uploader.upload(stream);
MessageBox.Show(lang.GetString(LangKey.upload_success));
} catch(Exception e) {
MessageBox.Show(lang.GetString(LangKey.upload_failure) + " " + e.Message);
}
}
}
}
}
}

View file

@ -0,0 +1,111 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 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 {
partial class FlickrUploadForm {
/// <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.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(13, 13);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Auth";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.AuthMeButton_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(13, 43);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Complete Auth";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.CompleteAuthButton_Click);
//
// cancelButton
//
this.cancelButton.Location = new System.Drawing.Point(197, 229);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.CancelButtonClick);
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(116, 229);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 3;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.OkButtonClick);
//
// FlickrUploadForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 264);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "FlickrUploadForm";
this.Text = "FlickrUploadForm";
this.ResumeLayout(false);
}
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
}
}

View file

@ -0,0 +1,99 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using FlickrNet;
namespace GreenshotFlickrPlugin {
/// <summary>
/// Description of FlickrUploadForm.
/// </summary>
public partial class FlickrUploadForm : Form {
// Store the Frob in a private variable
private string tempFrob;
private string ApiKey = "f967e5148945cb3c4e149cc5be97796a";
private string SharedSecret = "4180a21a1d2f8666";
private Flickr flickr;
public FlickrUploadForm() {
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
// Create Flickr instance
flickr = new Flickr(ApiKey, SharedSecret);
}
protected void AuthMeButton_Click(object sender, EventArgs e) {
// Get Frob
tempFrob = flickr.AuthGetFrob();
// Calculate the URL at Flickr to redirect the user to
string flickrUrl = flickr.AuthCalcUrl(tempFrob, AuthLevel.Write);
// The following line will load the URL in the users default browser.
System.Diagnostics.Process.Start(flickrUrl);
}
protected void CompleteAuthButton_Click(object sender, EventArgs e) {
try {
// use the temporary Frob to get the authentication
Auth auth = flickr.AuthGetToken(tempFrob);
// Store this Token for later usage,
// or set your Flickr instance to use it.
Console.WriteLine("User authenticated successfully");
Console.WriteLine("Authentication token is " + auth.Token);
flickr.AuthToken = auth.Token;
Console.WriteLine("User id is " + auth.User);
} catch(FlickrException ex) {
// If user did not authenticat your application
// then a FlickrException will be thrown.
Console.WriteLine("User did not authenticate you");
Console.WriteLine(ex.ToString());
}
}
public void upload(Stream buffer) {
string file = "test.png";
string title = "Test Photo";
string description = "This is the description of the photo";
string tags = "tag1,tag2,tag3";
string photoId = flickr.UploadPicture(buffer, file, title, description, tags, false, false, false, ContentType.Screenshot, SafetyLevel.Restricted, HiddenFromSearch.Hidden);
flickr.PhotosSetMeta(photoId, "New Title", "New Description");
// Get list of users sets
PhotosetCollection sets = flickr.PhotosetsGetList();
// Get the first set in the collection
Photoset set = sets[0];
// Add the photo to that set
flickr.PhotosetsAddPhoto(set.PhotosetId, photoId);
}
void OkButtonClick(object sender, EventArgs e) {
DialogResult = DialogResult.OK;
}
void CancelButtonClick(object sender, EventArgs e) {
DialogResult = DialogResult.Cancel;
}
}
}

View file

@ -0,0 +1,120 @@
<?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>
</root>

View file

@ -0,0 +1,94 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{56828D7F-F227-41EC-8873-CC32A23A1783}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<RootNamespace>GreenshotFlickrPlugin</RootNamespace>
<AssemblyName>GreenshotFlickrPlugin</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<SourceAnalysisOverrideSettingsFile>C:\Users\Robin\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="FlickrNet">
<HintPath>Lib\FlickrNet.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\Greenshot\Lib\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="FlickrPlugin.cs" />
<Compile Include="Forms\FlickrUploadForm.cs" />
<Compile Include="Forms\FlickrUploadForm.Designer.cs">
<DependentUpon>FlickrUploadForm.cs</DependentUpon>
</Compile>
<Compile Include="Language.cs" />
<Compile Include="LanguageKeys.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<None Include="Languages\language_flickrplugin-de-DE.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Languages\language_flickrplugin-en-US.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Languages\language_flickrplugin-nl-NL.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Lib\FlickrNet.dll" />
<None Include="Properties\AssemblyInfo.cs.template" />
<EmbeddedResource Include="Forms\FlickrUploadForm.resx">
<DependentUpon>FlickrUploadForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Lib" />
<Folder Include="Languages" />
<Folder Include="Forms" />
<ProjectReference Include="..\GreenshotPlugin\GreenshotPlugin.csproj">
<Project>{5B924697-4DCD-4F98-85F1-105CB84B7341}</Project>
<Name>GreenshotPlugin</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<PreBuildEvent>"$(SolutionDir)\tools\TortoiseSVN\SubWCRev.exe" "$(ProjectDir)\" "$(ProjectDir)\Properties\AssemblyInfo.cs.template" "$(ProjectDir)\Properties\AssemblyInfo.cs"</PreBuildEvent>
<PostBuildEvent>mkdir "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)"
copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp"
copy "$(ProjectDir)bin\$(Configuration)\FlickrNet.dll" "$(SolutionDir)bin\$(Configuration)\Plugins\$(ProjectName)\*"
mkdir "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
copy "$(ProjectDir)bin\$(Configuration)\Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,47 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Diagnostics;
using System.Globalization;
using System.Resources;
using System.Threading;
using GreenshotPlugin.Core;
namespace GreenshotFlickrPlugin {
/// <summary>
/// Wrapper for the language container for the Jira plugin.
/// </summary>
public class Language : LanguageContainer, ILanguage {
private static ILanguage uniqueInstance;
private const string LANGUAGE_FILENAME_PATTERN = @"language_flickrplugin-*.xml";
public static ILanguage GetInstance() {
if(uniqueInstance == null) {
uniqueInstance = new LanguageContainer();
uniqueInstance.LanguageFilePattern = LANGUAGE_FILENAME_PATTERN;
uniqueInstance.Load();
uniqueInstance.SetLanguage(Thread.CurrentThread.CurrentUICulture.Name);
}
return uniqueInstance;
}
}
}

View file

@ -0,0 +1,29 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
namespace GreenshotFlickrPlugin {
public enum LangKey {
login_error,
upload_success,
upload_failure
}
}

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="Deutsch" ietf="de-DE" version="0.8.0">
<resources>
<resource name="login_error">
Es gab ein Problem während dem Login: {0}
</resource>
<resource name="upload_success">
Ein erfolg beim Hochladen zum Flickr!
</resource>
<resource name="upload_failure">
Es gab einen Fehler beim Hochladen zum Flickr:
</resource>
</resources>
</language>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="English" ietf="en-US" version="0.8.0">
<resources>
<resource name="login_error">
There was a problem during the login: {0}
</resource>
<resource name="upload_success">
Successfully uploaded image to Flickr!
</resource>
<resource name="upload_failure">
An error occured while uploading to Flickr:
</resource>
</resources>
</language>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="Nederlands" ietf="nl-NL" version="0.8.0">
<resources>
<resource name="login_error">
Tijden de login is een fout opgetreden: {0}
</resource>
<resource name="upload_success">
Het uploaden naar Flickr is geslaagt!
</resource>
<resource name="upload_failure">
Tijdens het uploaden naar Flickr is een fout opgetreden:
</resource>
</resources>
</language>

View file

@ -0,0 +1,54 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2010 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/>.
*/
#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("GreenshotFlickrPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GreenshotFlickrPlugin")]
[assembly: AssemblyCopyright("Copyright 2010")]
[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.0.$WCREV$")]