mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-04 04:06:05 +13:00
Added duplicate name check for custom uploader arguments and headers
This commit is contained in:
parent
c105cead67
commit
e32ea341fa
1 changed files with 32 additions and 16 deletions
|
@ -3322,17 +3322,25 @@ private void btnCustomUploaderArgAdd_Click(object sender, EventArgs e)
|
|||
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
string value = txtCustomUploaderArgValue.Text;
|
||||
lvCustomUploaderArguments.Items.Add(name).SubItems.Add(value);
|
||||
txtCustomUploaderArgName.Text = "";
|
||||
txtCustomUploaderArgValue.Text = "";
|
||||
txtCustomUploaderArgName.Focus();
|
||||
|
||||
CustomUploaderItem uploader = CustomUploaderGetSelected();
|
||||
if (uploader != null)
|
||||
{
|
||||
if (uploader.Arguments == null) uploader.Arguments = new Dictionary<string, string>();
|
||||
uploader.Arguments.Add(name, value);
|
||||
if (uploader.Arguments.ContainsKey(name))
|
||||
{
|
||||
// TODO: Translate
|
||||
MessageBox.Show("An argument with the same name already exists.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
string value = txtCustomUploaderArgValue.Text;
|
||||
lvCustomUploaderArguments.Items.Add(name).SubItems.Add(value);
|
||||
if (uploader.Arguments == null) uploader.Arguments = new Dictionary<string, string>();
|
||||
uploader.Arguments.Add(name, value);
|
||||
}
|
||||
|
||||
txtCustomUploaderArgName.Text = "";
|
||||
txtCustomUploaderArgValue.Text = "";
|
||||
txtCustomUploaderArgName.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3386,17 +3394,25 @@ private void btnCustomUploaderHeaderAdd_Click(object sender, EventArgs e)
|
|||
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
string value = txtCustomUploaderHeaderValue.Text;
|
||||
lvCustomUploaderHeaders.Items.Add(name).SubItems.Add(value);
|
||||
txtCustomUploaderHeaderName.Text = "";
|
||||
txtCustomUploaderHeaderValue.Text = "";
|
||||
txtCustomUploaderHeaderName.Focus();
|
||||
|
||||
CustomUploaderItem uploader = CustomUploaderGetSelected();
|
||||
if (uploader != null)
|
||||
{
|
||||
if (uploader.Headers == null) uploader.Headers = new Dictionary<string, string>();
|
||||
uploader.Headers.Add(name, value);
|
||||
if (uploader.Headers.ContainsKey(name))
|
||||
{
|
||||
// TODO: Translate
|
||||
MessageBox.Show("A header with the same name already exists.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
string value = txtCustomUploaderHeaderValue.Text;
|
||||
lvCustomUploaderHeaders.Items.Add(name).SubItems.Add(value);
|
||||
if (uploader.Headers == null) uploader.Headers = new Dictionary<string, string>();
|
||||
uploader.Headers.Add(name, value);
|
||||
}
|
||||
|
||||
txtCustomUploaderHeaderName.Text = "";
|
||||
txtCustomUploaderHeaderValue.Text = "";
|
||||
txtCustomUploaderHeaderName.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue