Merge branch 'master' of github.com:ShareX/ShareX

This commit is contained in:
Gregoire Pailler 2013-12-03 00:19:29 +01:00
commit ee9af500dd
5 changed files with 120 additions and 27 deletions

View file

@ -323,6 +323,7 @@ private void btnSettingsExport_Click(object sender, EventArgs e)
{ {
string json = ImageEffectManager.ExportEffects(imageEffects); string json = ImageEffectManager.ExportEffects(imageEffects);
ClipboardHelpers.CopyText(json); ClipboardHelpers.CopyText(json);
MessageBox.Show("Image effects copied to your clipboard.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
} }

View file

@ -323,6 +323,8 @@ private void InitializeComponent()
this.txtRapidSharePremiumUserName = new System.Windows.Forms.TextBox(); this.txtRapidSharePremiumUserName = new System.Windows.Forms.TextBox();
this.ttHelpTip = new System.Windows.Forms.ToolTip(this.components); this.ttHelpTip = new System.Windows.Forms.ToolTip(this.components);
this.actRapidShareAccountType = new UploadersLib.GUI.AccountTypeControl(); this.actRapidShareAccountType = new UploadersLib.GUI.AccountTypeControl();
this.btnCustomUploaderExport = new System.Windows.Forms.Button();
this.btnCustomUploaderImport = new System.Windows.Forms.Button();
this.tcUploaders.SuspendLayout(); this.tcUploaders.SuspendLayout();
this.tpImageUploaders.SuspendLayout(); this.tpImageUploaders.SuspendLayout();
this.tcImageUploaders.SuspendLayout(); this.tcImageUploaders.SuspendLayout();
@ -3045,7 +3047,9 @@ private void InitializeComponent()
// //
// gbCustomUploaders // gbCustomUploaders
// //
this.gbCustomUploaders.Controls.Add(this.btnCustomUploaderImport);
this.gbCustomUploaders.Controls.Add(this.lbCustomUploaderList); this.gbCustomUploaders.Controls.Add(this.lbCustomUploaderList);
this.gbCustomUploaders.Controls.Add(this.btnCustomUploaderExport);
this.gbCustomUploaders.Controls.Add(this.btnCustomUploaderRemove); this.gbCustomUploaders.Controls.Add(this.btnCustomUploaderRemove);
this.gbCustomUploaders.Controls.Add(this.btnCustomUploaderClear); this.gbCustomUploaders.Controls.Add(this.btnCustomUploaderClear);
this.gbCustomUploaders.Controls.Add(this.btnCustomUploaderUpdate); this.gbCustomUploaders.Controls.Add(this.btnCustomUploaderUpdate);
@ -3084,7 +3088,7 @@ private void InitializeComponent()
this.btnCustomUploaderClear.Name = "btnCustomUploaderClear"; this.btnCustomUploaderClear.Name = "btnCustomUploaderClear";
this.btnCustomUploaderClear.Size = new System.Drawing.Size(88, 24); this.btnCustomUploaderClear.Size = new System.Drawing.Size(88, 24);
this.btnCustomUploaderClear.TabIndex = 5; this.btnCustomUploaderClear.TabIndex = 5;
this.btnCustomUploaderClear.Text = "Clear fields ->"; this.btnCustomUploaderClear.Text = "Clear fields -->";
this.btnCustomUploaderClear.UseVisualStyleBackColor = true; this.btnCustomUploaderClear.UseVisualStyleBackColor = true;
this.btnCustomUploaderClear.Click += new System.EventHandler(this.btnCustomUploaderClear_Click); this.btnCustomUploaderClear.Click += new System.EventHandler(this.btnCustomUploaderClear_Click);
// //
@ -3459,6 +3463,26 @@ private void InitializeComponent()
this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29); this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29);
this.actRapidShareAccountType.TabIndex = 16; this.actRapidShareAccountType.TabIndex = 16;
// //
// btnCustomUploaderExport
//
this.btnCustomUploaderExport.Location = new System.Drawing.Point(8, 328);
this.btnCustomUploaderExport.Name = "btnCustomUploaderExport";
this.btnCustomUploaderExport.Size = new System.Drawing.Size(64, 23);
this.btnCustomUploaderExport.TabIndex = 34;
this.btnCustomUploaderExport.Text = "Export";
this.btnCustomUploaderExport.UseVisualStyleBackColor = true;
this.btnCustomUploaderExport.Click += new System.EventHandler(this.btnCustomUploaderExport_Click);
//
// btnCustomUploaderImport
//
this.btnCustomUploaderImport.Location = new System.Drawing.Point(80, 328);
this.btnCustomUploaderImport.Name = "btnCustomUploaderImport";
this.btnCustomUploaderImport.Size = new System.Drawing.Size(64, 23);
this.btnCustomUploaderImport.TabIndex = 35;
this.btnCustomUploaderImport.Text = "Import";
this.btnCustomUploaderImport.UseVisualStyleBackColor = true;
this.btnCustomUploaderImport.Click += new System.EventHandler(this.btnCustomUploaderImport_Click);
//
// UploadersConfigForm // UploadersConfigForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -3859,5 +3883,7 @@ private void InitializeComponent()
private System.Windows.Forms.TabPage tpGist; private System.Windows.Forms.TabPage tpGist;
private GUI.AccountTypeControl atcGistAccountType; private GUI.AccountTypeControl atcGistAccountType;
private GUI.OAuth2Control oAuth2Gist; private GUI.OAuth2Control oAuth2Gist;
private System.Windows.Forms.Button btnCustomUploaderImport;
private System.Windows.Forms.Button btnCustomUploaderExport;
} }
} }

View file

@ -817,6 +817,16 @@ private void lbCustomUploaderList_SelectedIndexChanged(object sender, EventArgs
} }
} }
private void btnCustomUploaderExport_Click(object sender, EventArgs e)
{
ExportCustomUploader();
}
private void btnCustomUploaderImport_Click(object sender, EventArgs e)
{
ImportCustomUploader();
}
private void cbCustomUploaderRequestType_SelectedIndexChanged(object sender, EventArgs e) private void cbCustomUploaderRequestType_SelectedIndexChanged(object sender, EventArgs e)
{ {
txtCustomUploaderFileForm.Enabled = (CustomUploaderRequestType)cbCustomUploaderRequestType.SelectedIndex == CustomUploaderRequestType.POST; txtCustomUploaderFileForm.Enabled = (CustomUploaderRequestType)cbCustomUploaderRequestType.SelectedIndex == CustomUploaderRequestType.POST;

View file

@ -117,6 +117,33 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="ttHelpTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="label1.ToolTip" xml:space="preserve">
<value>If URL textbox is empty then 'Response text' or 'Redirection URL' will be automatically used.
Regex usage for get regex result: $n$
'n' must be index number from 'Regex from response' list.
Example for get second regex result from list: $2$
Regex groups usage: $n,n$ or $n,name$
Second 'n' here must be group number or group name.
Example: $3,1$ or $2,thumbnail_result$</value>
</data>
<data name="lblCustomUploaderRequestTypeHelp.ToolTip" xml:space="preserve">
<value>For image uploader &amp; file uploader: The 'POST' request type is required along with the 'File form name'.
For text uploader or url shortener: 'POST' with no 'File Form Name' or 'GET' will replace an argument with
value '%input' or '$input$' with the text or URL.
For text uploader: Specifying 'POST' request type and a 'File Form Name' will upload the input as a file
(useful for very long inputs).
For example, if the argument name is 'pastebin_text' then a value of '%input' will be automatically
replaced with the text you're going to upload. Same thing applies for url shortener; '%input'
will be replaced with the url in the argument.</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pbDropboxLogo.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pbDropboxLogo.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
@ -237,28 +264,4 @@
<metadata name="ttHelpTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="ttHelpTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<data name="label1.ToolTip" xml:space="preserve">
<value>If URL textbox is empty then 'Response text' or 'Redirection URL' will be automatically used.
Regex usage for get regex result: $n$
'n' must be index number from 'Regex from response' list.
Example for get second regex result from list: $2$
Regex groups usage: $n,n$ or $n,name$
Second 'n' here must be group number or group name.
Example: $3,1$ or $2,thumbnail_result$</value>
</data>
<data name="lblCustomUploaderRequestTypeHelp.ToolTip" xml:space="preserve">
<value>For image uploader &amp; file uploader: The 'POST' request type is required along with the 'File form name'.
For text uploader or url shortener: 'POST' with no 'File Form Name' or 'GET' will replace an argument with
value '%input' or '$input$' with the text or URL.
For text uploader: Specifying 'POST' request type and a 'File Form Name' will upload the input as a file
(useful for very long inputs).
For example, if the argument name is 'pastebin_text' then a value of '%input' will be automatically
replaced with the text you're going to upload. Same thing applies for url shortener; '%input'
will be replaced with the url in the argument.</value>
</data>
</root> </root>

View file

@ -24,6 +24,7 @@
#endregion License Information (GPL v3) #endregion License Information (GPL v3)
using HelpersLib; using HelpersLib;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -1183,11 +1184,11 @@ private void UpdateCustomUploader()
{ {
int index = lbCustomUploaderList.SelectedIndex; int index = lbCustomUploaderList.SelectedIndex;
if (index != -1) if (index >= 0)
{ {
CustomUploaderItem customUploader = GetCustomUploaderFromFields(); CustomUploaderItem customUploader = GetCustomUploaderFromFields();
if (!string.IsNullOrEmpty(customUploader.Name)) if (customUploader != null && !string.IsNullOrEmpty(customUploader.Name))
{ {
Config.CustomUploadersList[index] = customUploader; Config.CustomUploadersList[index] = customUploader;
lbCustomUploaderList.Items[index] = customUploader.Name; lbCustomUploaderList.Items[index] = customUploader.Name;
@ -1196,6 +1197,58 @@ private void UpdateCustomUploader()
} }
} }
private void ExportCustomUploader()
{
int index = lbCustomUploaderList.SelectedIndex;
if (index >= 0)
{
CustomUploaderItem customUploader = GetCustomUploaderFromFields();
if (customUploader != null && !string.IsNullOrEmpty(customUploader.Name))
{
try
{
string json = JsonConvert.SerializeObject(customUploader, Formatting.Indented);
ClipboardHelpers.CopyText(json);
MessageBox.Show("Selected custom uploader copied to your clipboard.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception e)
{
DebugHelper.WriteException(e);
}
}
}
}
private void ImportCustomUploader()
{
if (Clipboard.ContainsText())
{
string json = Clipboard.GetText();
if (!string.IsNullOrEmpty(json))
{
try
{
CustomUploaderItem customUploader = JsonConvert.DeserializeObject<CustomUploaderItem>(json);
if (customUploader != null && !string.IsNullOrEmpty(customUploader.Name))
{
Config.CustomUploadersList.Add(customUploader);
lbCustomUploaderList.Items.Add(customUploader.Name);
lbCustomUploaderList.SelectedIndex = lbCustomUploaderList.Items.Count - 1;
PrepareCustomUploaderList();
}
}
catch (Exception e)
{
DebugHelper.WriteException(e);
}
}
}
}
private void CustomUploaderClear() private void CustomUploaderClear()
{ {
LoadCustomUploader(new CustomUploaderItem()); LoadCustomUploader(new CustomUploaderItem());