Initial code for a possible Photobucket plug-in

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2023 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-09-11 16:44:11 +00:00
parent 73ffe9579a
commit a907eca010
20 changed files with 1450 additions and 0 deletions

View 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/>.
*/
using System;
namespace GreenshotPhotobucketPlugin {
/// <summary>
/// This class is needed for design-time resolving of the language files
/// </summary>
public class PhotobucketForm : GreenshotPlugin.Controls.GreenshotForm {
public PhotobucketForm() : base() {
}
}
}

View file

@ -0,0 +1,158 @@
/*
* 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 GreenshotPhotobucketPlugin {
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.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.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.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2;
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.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 3;
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.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.combobox_uploadimageformat.FormattingEnabled = true;
this.combobox_uploadimageformat.Location = new System.Drawing.Point(102, 47);
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.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.Name = "label_upload_format";
this.label_upload_format.Size = new System.Drawing.Size(84, 20);
this.label_upload_format.TabIndex = 9;
//
// checkbox_usepagelink
//
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;
//
// 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.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.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.GreenshotTextBox textBoxUrl;
private GreenshotPlugin.Controls.GreenshotLabel label_url;
private GreenshotPlugin.Controls.GreenshotButton buttonCancel;
private GreenshotPlugin.Controls.GreenshotButton buttonOK;
private GreenshotPlugin.Controls.GreenshotCheckBox checkbox_usepagelink;
}
}

View file

@ -0,0 +1,47 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Windows.Forms;
using GreenshotPlugin.Core;
using GreenshotPlugin.Controls;
namespace GreenshotPhotobucketPlugin {
/// <summary>
/// Description of PasswordRequestForm.
/// </summary>
public partial class SettingsForm : PhotobucketForm {
public SettingsForm(PhotobucketConfiguration config) : base() {
//
// 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;
}
}
}

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{9C0ECC4C-7807-4111-916A-4F57BB29788A}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<RootNamespace>GreenshotPhotobucketPlugin</RootNamespace>
<AssemblyName>GreenshotPhotobucketPlugin</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>
<TargetFrameworkProfile />
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>x86</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<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>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\Greenshot\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="Forms\PhotobucketForm.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="PhotobucketDestination.cs" />
<Compile Include="PhotobucketInfo.cs" />
<Compile Include="PhotobucketPlugin.cs" />
<Compile Include="PhotobucketConfiguration.cs" />
<Compile Include="PhotobucketUtils.cs" />
<Compile Include="LanguageKeys.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<None Include="Languages\language_Photobucketplugin-de-DE.xml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Include="Languages\language_Photobucketplugin-en-US.xml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Include="Languages\language_Photobucketplugin-fr_FR.xml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Include="Languages\language_Photobucketplugin-nl-NL.xml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Include="Languages\language_Photobucketplugin-zh-CN.xml" />
<None Include="Properties\AssemblyInfo.cs.template" />
<EmbeddedResource Include="PhotobucketPlugin.resx">
<DependentUpon>PhotobucketPlugin.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<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"
mkdir "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)"
copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)bin\$(Configuration)\Languages\Plugins\$(ProjectName)\"</PostBuildEvent>
</PropertyGroup>
</Project>

View file

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

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="Deutsch" ietf="de-DE" version="1.0.0">
<resources>
<resource name="upload_menu_item">
Zu Photobucket hochladen
</resource>
<resource name="settings_title">
Photobucket Einstellungen
</resource>
<resource name="label_url">
Url
</resource>
<resource name="OK">
OK
</resource>
<resource name="CANCEL">
Cancel
</resource>
<resource name="upload_success">
Das Hochladen zu Photobucket war erfolgreich.
</resource>
<resource name="upload_failure">
Es gab einen Fehler beim Hochladen zu Photobucket:
</resource>
<resource name="label_upload_format">
Bildformat
</resource>
<resource name="communication_wait">
Übermittle Daten zu Photobucket. Bitte warten...
</resource>
<resource name="delete_question">
Sind Sie sicher das sie das Bild {0} von Photobucket löschen möchte?
</resource>
<resource name="clear_question">
Sind Sie sicher das sie den lokalen Photobucket Verlauf löschen möchte?
</resource>
<resource name="delete_title">
Photobucket {0} löschen
</resource>
<resource name="use_page_link">
Benutze der Seite-URL statt Bild-URL im Zwischenablage
</resource>
<resource name="history">
Verlauf
</resource>
<resource name="configure">
Einstellungen
</resource>
</resources>
</language>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="English" ietf="en-US" version="1.0.0">
<resources>
<resource name="upload_menu_item">
Upload to Photobucket
</resource>
<resource name="settings_title">
Photobucket settings
</resource>
<resource name="label_url">
Url
</resource>
<resource name="OK">
OK
</resource>
<resource name="CANCEL">
Cancel
</resource>
<resource name="upload_success">
Successfully uploaded image to Photobucket!
</resource>
<resource name="upload_failure">
An error occured while uploading to Photobucket:
</resource>
<resource name="label_upload_format">
Image format
</resource>
<resource name="communication_wait">
Communicating with Photobucket. Please wait...
</resource>
<resource name="delete_question">
Are you sure you want to delete the image {0} from Photobucket?
</resource>
<resource name="clear_question">
Are you sure you want to delete the local Photobucket history?
</resource>
<resource name="delete_title">
Delete Photobucket {0}
</resource>
<resource name="anonymous_access">
Use anonymous access
</resource>
<resource name="use_page_link">
Use page link instead of image link on clipboard
</resource>
<resource name="history">
History
</resource>
<resource name="configure">
Configure
</resource>
</resources>
</language>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="Français" ietf="fr-FR" version="0.8.0">
<resources>
<resource name="upload_menu_item">
Téléverser vers Photobucket
</resource>
<resource name="settings_title">
Paramètres Photobucket
</resource>
<resource name="label_url">
URL
</resource>
<resource name="label_use_proxy">
Utiliser proxy
</resource>
<resource name="OK">
OK
</resource>
<resource name="CANCEL">
Annuler
</resource>
<resource name="upload_success">
L'image a été téléversée vers Photobucket avec succès !
</resource>
<resource name="upload_failure">
Une erreur est survenue lors du téléversement vers Photobucket:
</resource>
<resource name="label_upload_format">
Format d'image
</resource>
<resource name="upload_wait">
Téléversement vers Photobucket, veuillez patienter...
</resource>
<resource name="history">
Histoire
</resource>
<resource name="configure">
Configurer
</resource>
</resources>
</language>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="Italiano" ietf="it-IT" version="1.0.0">
<resources>
<resource name="upload_menu_item">
Carica su Imgur
</resource>
<resource name="settings_title">
Impostazioni Imgur
</resource>
<resource name="label_url">
Url
</resource>
<resource name="OK">
OK
</resource>
<resource name="CANCEL">
Annulla
</resource>
<resource name="upload_success">
Immagine caricata correttamente su Imgur!
</resource>
<resource name="upload_failure">
Si è verificato un problema durante il collegamento:
</resource>
<resource name="label_upload_format">
Formato immagine
</resource>
<resource name="communication_wait">
Comunicazione con Imgur. Attendere prego...
</resource>
<resource name="delete_question">
Sei sicuro si voler eliminare l'immagine {0} da Imgur?
</resource>
<resource name="clear_question">
Sei sicuro si voler eliminare la cronologia locale di Imgur?
</resource>
<resource name="delete_title">
Elimina Imgur {0}
</resource>
<resource name="use_page_link">
Usa il collegamento alla pagina invece di quello all'immagine su appunti
</resource>
<resource name="history">
Cronologia
</resource>
<resource name="configure">
Configurazione
</resource>
</resources>
</language>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="Nederlands" ietf="nl-NL" version="1.0.0">
<resources>
<resource name="upload_menu_item">
Naar Photobucket uploaden
</resource>
<resource name="settings_title">
Photobucket instellingen
</resource>
<resource name="label_url">
Url
</resource>
<resource name="OK">
OK
</resource>
<resource name="CANCEL">
Afbreken
</resource>
<resource name="upload_success">
Het uploaden naar Photobucket is geslaagt!
</resource>
<resource name="upload_failure">
Tijdens het uploaden naar Photobucket is een fout opgetreden:
</resource>
<resource name="label_upload_format">
Beeld formaat
</resource>
<resource name="communication_wait">
Data overdraging naar Photobucket, wachten AUB...
</resource>
<resource name="delete_question">
Weet U zeker dat U het beeld {0} van Photobucket verwijderen wilt?
</resource>
<resource name="clear_question">
Weet U zeker dat U de locale Photobucket historie verwijderen wilt?
</resource>
<resource name="delete_title">
Photobucket {0} verwijderen
</resource>
<resource name="use_page_link">
Kopieer de pagina link in plaats van de beeld link in het klembord
</resource>
<resource name="history">
Verloop
</resource>
<resource name="configure">
Instellingen
</resource>
</resources>
</language>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="Русский" ietf="ru-RU" version="1.0.0">
<resources>
<resource name="upload_menu_item">
Загрузить на Imgur
</resource>
<resource name="settings_title">
Imgur параметры
</resource>
<resource name="label_url">
Url
</resource>
<resource name="OK">
OK
</resource>
<resource name="CANCEL">
Отмена
</resource>
<resource name="upload_success">
Изображение успешно загружено на Imgur!
</resource>
<resource name="upload_failure">
Произошла ошибка при загрузке на Imgur:
</resource>
<resource name="label_upload_format">
Формат изображения
</resource>
<resource name="communication_wait">
Общение с Imgur. Подождите...
</resource>
<resource name="delete_question">
Вы действительно хотите удалить изображение {0} из Imgur?
</resource>
<resource name="clear_question">
Вы действительно хотите удалить местную историю Imgur?
</resource>
<resource name="delete_title">
Удалить Imgur {0}
</resource>
<resource name="use_page_link">
Использовать ссылку страницы, вместо ссылки изображения в буфере обмена
</resource>
<resource name="history">
История
</resource>
<resource name="configure">
Настройка
</resource>
</resources>
</language>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="Українська" ietf="uk-UA" version="1.0.0">
<resources>
<resource name="upload_menu_item">Вивантажити на Imgur</resource>
<resource name="settings_title">Параметри Imgur</resource>
<resource name="label_url">Посилання</resource>
<resource name="OK">Гаразд</resource>
<resource name="CANCEL">Скасувати</resource>
<resource name="upload_success">Зображення вдало вивантажено на Imgur!</resource>
<resource name="upload_failure">Відбулась помилка при вивантаженні зображення на Imgur:</resource>
<resource name="label_upload_format">Формат зображення</resource>
<resource name="communication_wait">З’єднання з Imgur. Будь ласка, зачекайте...</resource>
<resource name="delete_question">Чи дійсно Ви хочете видалити зображення {0} з Imgur?</resource>
<resource name="clear_question">Чи дійсно Ви хочете видалити локальну історію Imgur?</resource>
<resource name="delete_title">Видалити Imgur {0}</resource>
<resource name="use_page_link">Використовувати посилання на сторінку замість посилання на зображення</resource>
<resource name="history">Історія</resource>
<resource name="configure">Налаштувати</resource>
</resources>
</language>

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<language description="简体中文" ietf="zh-CN" version="1.0.0">
<resources>
<resource name="upload_menu_item">
上传到 Photobucket
</resource>
<resource name="settings_title">
Photobucket 设置
</resource>
<resource name="label_url">
Url
</resource>
<resource name="OK">
确定
</resource>
<resource name="CANCEL">
取消
</resource>
<resource name="upload_success">
已成功上传图片到 Photobucket
</resource>
<resource name="upload_failure">
上传到 Photobucket 时出现错误:
</resource>
<resource name="label_upload_format">
图片格式
</resource>
<resource name="communication_wait">
连接到 Photobucket请稍候...
</resource>
<resource name="delete_question">
您是否确定要从 Photobucket 删除图片 {0} ?
</resource>
<resource name="delete_title">
删除 Photobucket {0}
</resource>
</resources>
</language>

View file

@ -0,0 +1,75 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using Greenshot.IniFile;
namespace GreenshotPhotobucketPlugin {
/// <summary>
/// Description of PhotobucketConfiguration.
/// </summary>
[IniSection("Photobucket", Description="Greenshot Photobucket Plugin configuration")]
public class PhotobucketConfiguration : IniSection {
[IniProperty("PhotobucketApiUrl", Description = "Url to Photobucket system.", DefaultValue = "http://api.photobucket.com")]
public string PhotobucketApiUrl;
[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("PhotobucketToken", Description = "The Photobucket token", Encrypted=true, ExcludeIfNull=true)]
public string PhotobucketToken;
[IniProperty("PhotobucketTokenSecret", Description = "The Photobucket token secret", Encrypted=true, ExcludeIfNull=true)]
public string PhotobucketTokenSecret;
public int Credits {
get;
set;
}
/// <summary>
/// A form for username/password
/// </summary>
/// <returns>bool true if OK was pressed, false if cancel</returns>
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();
if (result == DialogResult.OK) {
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,78 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using Greenshot.IniFile;
namespace GreenshotPhotobucketPlugin {
/// <summary>
/// Description of PhotobucketDestination.
/// </summary>
public class PhotobucketDestination : AbstractDestination {
private static log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketDestination));
private static PhotobucketConfiguration config = IniConfig.GetIniSection<PhotobucketConfiguration>();
private PhotobucketPlugin plugin = null;
public PhotobucketDestination(PhotobucketPlugin plugin) {
this.plugin = plugin;
}
public override string Designation {
get {
return "Photobucket";
}
}
public override string Description {
get {
return Language.GetString("photobucket", LangKey.upload_menu_item);
}
}
public override Image DisplayIcon {
get {
ComponentResourceManager resources = new ComponentResourceManager(typeof(PhotobucketPlugin));
return (Image)resources.GetObject("Photobucket");
}
}
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
using (Image image = surface.GetImageForExport()) {
string uploadURL = null;
bool uploaded = plugin.Upload(captureDetails, image, out uploadURL);
if (uploaded) {
surface.UploadURL = uploadURL;
surface.SendMessageEvent(this, SurfaceMessageTyp.UploadedUrl, Language.GetFormattedString("exported_to", Designation));
surface.Modified = false;
}
return uploaded;
}
}
}
}

View file

@ -0,0 +1,98 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Drawing;
using System.Xml;
namespace GreenshotPhotobucketPlugin
{
/// <summary>
/// Description of PhotobucketInfo.
/// </summary>
public class PhotobucketInfo : IDisposable {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketInfo));
private string original;
public string Original {
get {return original;}
set {original = value;}
}
private string page;
public string Page {
get {return page;}
set {page = value;}
}
private string thumbnail;
public string Thumbnail {
get {return thumbnail;}
set {thumbnail = value;}
}
public PhotobucketInfo() {
}
/// <summary>
/// The public accessible Dispose
/// Will call the GarbageCollector to SuppressFinalize, preventing being cleaned twice
/// </summary>
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// This Dispose is called from the Dispose and the Destructor.
/// When disposing==true all non-managed resources should be freed too!
/// </summary>
/// <param name="disposing"></param>
protected virtual void Dispose(bool disposing) {
if (disposing) {
}
}
public static PhotobucketInfo ParseResponse(string response) {
LOG.Debug(response);
PhotobucketInfo PhotobucketInfo = new PhotobucketInfo();
try {
XmlDocument doc = new XmlDocument();
doc.LoadXml(response);
XmlNodeList nodes;
nodes = doc.GetElementsByTagName("url");
if(nodes.Count > 0) {
PhotobucketInfo.Original = nodes.Item(0).InnerText;
}
nodes = doc.GetElementsByTagName("browseurl");
if(nodes.Count > 0) {
PhotobucketInfo.Page = nodes.Item(0).InnerText;
}
nodes = doc.GetElementsByTagName("thumb");
if(nodes.Count > 0) {
PhotobucketInfo.Thumbnail = nodes.Item(0).InnerText;
}
} catch(Exception e) {
LOG.ErrorFormat("Could not parse Photobucket response due to error {0}, response was: {1}", e.Message, response);
}
return PhotobucketInfo;
}
}
}

View file

@ -0,0 +1,150 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Threading;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using Greenshot.IniFile;
namespace GreenshotPhotobucketPlugin {
/// <summary>
/// This is the GreenshotPhotobucketPlugin base code
/// </summary>
public class PhotobucketPlugin : IGreenshotPlugin {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketPlugin));
private static PhotobucketConfiguration config;
public static PluginAttribute Attributes;
private IGreenshotHost host;
private ComponentResourceManager resources;
public PhotobucketPlugin() {
}
public IEnumerable<IDestination> Destinations() {
yield return new PhotobucketDestination(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="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
/// <param name="pluginAttribute">My own attributes</param>
/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
this.host = (IGreenshotHost)pluginHost;
Attributes = myAttributes;
// Get configuration
config = IniConfig.GetIniSection<PhotobucketConfiguration>();
resources = new ComponentResourceManager(typeof(PhotobucketPlugin));
ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Photobucket");
itemPlugInRoot.Image = (Image)resources.GetObject("Photobucket");
ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem(Language.GetString("photobucket", LangKey.configure));
itemPlugInConfig.Tag = host;
itemPlugInConfig.Click += delegate {
config.ShowConfigDialog();
};
itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
return true;
}
public virtual void Shutdown() {
LOG.Debug("Photobucket 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 Photobucket Plugin!");
Shutdown();
}
/// <summary>
/// Upload the capture to Photobucket
/// </summary>
/// <param name="captureDetails"></param>
/// <param name="image"></param>
/// <param name="uploadURL">out string for the url</param>
/// <returns>true if the upload succeeded</returns>
public bool Upload(ICaptureDetails captureDetails, Image image, out string uploadURL) {
OutputSettings outputSettings = new OutputSettings(config.UploadFormat, config.UploadJpegQuality, config.UploadReduceColors);
using (MemoryStream stream = new MemoryStream()) {
host.SaveToStream(image, stream, outputSettings);
try {
string filename = Path.GetFileName(host.GetFilename(config.UploadFormat, captureDetails));
PhotobucketInfo PhotobucketInfo = null;
// Run upload in the background
new PleaseWaitForm().ShowAndWait(Attributes.Name, Language.GetString("photobucket", LangKey.communication_wait),
delegate() {
PhotobucketInfo = PhotobucketUtils.UploadToPhotobucket(stream.GetBuffer(), (int)stream.Length, captureDetails.Title, filename);
}
);
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);
}
return true;
} catch (Exception e) {
LOG.Error(e);
MessageBox.Show(Language.GetString("photobucket", LangKey.upload_failure) + " " + e.Message);
}
}
uploadURL = null;
return false;
}
}
}

View file

@ -0,0 +1,129 @@
<?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.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="Photobucket" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAFJJREFUOE9jFBIS
/M9ACQAZQAlmwKXZL0f6f+cxFTAGsXGpw2kATDOMJtkAmAt6TpHpAmLDBacXGhsb/sMAiE2yF+C6oYxR
A/4PxUCkOB0QmxIB9tCMsK3wUGgAAAAASUVORK5CYII=
</value>
</data>
</root>

View file

@ -0,0 +1,128 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2012 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
using GreenshotPlugin.Core;
using Greenshot.IniFile;
namespace GreenshotPhotobucketPlugin {
/// <summary>
/// Description of PhotobucketUtils.
/// </summary>
public class PhotobucketUtils {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(PhotobucketUtils));
private static PhotobucketConfiguration config = IniConfig.GetIniSection<PhotobucketConfiguration>();
private PhotobucketUtils() {
}
/// <summary>
/// A wrapper around the EscapeDataString, as the limit is 32766 characters
/// See: http://msdn.microsoft.com/en-us/library/system.uri.escapedatastring%28v=vs.110%29.aspx
/// </summary>
/// <param name="dataString"></param>
/// <returns>escaped data string</returns>
private static StringBuilder EscapeDataStringToStringBuilder(string dataString) {
StringBuilder result = new StringBuilder();
int currentLocation = 0;
while (currentLocation < dataString.Length) {
string process = dataString.Substring(currentLocation,Math.Min(16384, dataString.Length-currentLocation));
result.Append(Uri.EscapeDataString(process));
currentLocation = currentLocation + 16384;
}
return result;
}
private static string EscapeText(string text) {
string[] UriRfc3986CharsToEscape = new[] { "!", "*", "'", "(", ")" };
LOG.DebugFormat("Text size {0}", text.Length);
StringBuilder escaped = EscapeDataStringToStringBuilder(text);
for (int i = 0; i < UriRfc3986CharsToEscape.Length; i++) {
escaped.Replace(UriRfc3986CharsToEscape[i], Uri.HexEscape(UriRfc3986CharsToEscape[i][0]));
}
return escaped.ToString();
}
/// <summary>
/// Do the actual upload to Photobucket
/// For more details on the available parameters, see: http://api.Photobucket.com/resources_anon
/// </summary>
/// <param name="imageData">byte[] with image data</param>
/// <returns>PhotobucketResponse</returns>
public static PhotobucketInfo UploadToPhotobucket(byte[] imageData, int dataLength, string title, string filename) {
StringBuilder uploadRequest = new StringBuilder();
uploadRequest.Append("identifier=greenshot");
// add type
uploadRequest.Append("&type=base64");
// Add image
uploadRequest.Append("&uploadfile=");
uploadRequest.Append(EscapeText(System.Convert.ToBase64String(imageData, 0, dataLength)));
// add title
if (title != null) {
uploadRequest.Append("&title=");
uploadRequest.Append(EscapeText(title));
}
// add filename
if (filename != null) {
uploadRequest.Append("&filename=");
uploadRequest.Append(EscapeText(filename));
}
string url = config.PhotobucketApiUrl + "/album/greenshot/upload";
string responseString;
OAuthHelper oAuth = new OAuthHelper();
oAuth.CallbackUrl = "http://getgreenshot.org";
oAuth.AccessTokenUrl = "http://api.photobucket.com/login/access";
oAuth.AuthorizeUrl = " http://photobucket.com/apilogin/login";
oAuth.RequestTokenUrl = "http://api.photobucket.com/login/request";
oAuth.ConsumerKey = "fill-in";
oAuth.ConsumerSecret = "fill-in";
oAuth.UserAgent = "Greenshot";
if (string.IsNullOrEmpty(config.PhotobucketToken)) {
LOG.Debug("Creating Photobucket Token");
oAuth.getRequestToken();
if (string.IsNullOrEmpty(oAuth.authorizeToken("Photobucket authorization"))) {
return null;
}
string accessToken = oAuth.getAccessToken();
config.PhotobucketToken = oAuth.Token;
config.PhotobucketTokenSecret = oAuth.TokenSecret;
} else {
LOG.Debug("Using stored Photobucket Token");
oAuth.Token = config.PhotobucketToken;
oAuth.TokenSecret = config.PhotobucketTokenSecret;
}
responseString = oAuth.oAuthWebRequest(OAuthHelper.Method.POST, url, uploadRequest.ToString());
LOG.Info(responseString);
PhotobucketInfo PhotobucketInfo = PhotobucketInfo.ParseResponse(responseString);
LOG.Debug("Upload to Photobucket was finished");
return PhotobucketInfo;
}
}
}

View file

@ -0,0 +1,54 @@
/*
* 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/>.
*/
#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-Photobucket-Plugin")]
[assembly: AssemblyDescription("A plugin to upload images to Photobucket")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Greenshot")]
[assembly: AssemblyProduct("Photobucket Plugin")]
[assembly: AssemblyCopyright("Copyright (C) 2007-2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The PluginAttribute describes the "entryType" and if the plugin is configurable
[assembly: PluginAttribute("GreenshotPhotobucketPlugin.PhotobucketPlugin", 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.2.$WCREV$")]