mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-15 19:36:38 +12:00
Added duplicate name check for custom uploader arguments and headers
This commit is contained in:
parent
c105cead67
commit
e32ea341fa
|
@ -3322,18 +3322,26 @@ private void btnCustomUploaderArgAdd_Click(object sender, EventArgs e)
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(name))
|
if (!string.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
string value = txtCustomUploaderArgValue.Text;
|
|
||||||
lvCustomUploaderArguments.Items.Add(name).SubItems.Add(value);
|
|
||||||
txtCustomUploaderArgName.Text = "";
|
|
||||||
txtCustomUploaderArgValue.Text = "";
|
|
||||||
txtCustomUploaderArgName.Focus();
|
|
||||||
|
|
||||||
CustomUploaderItem uploader = CustomUploaderGetSelected();
|
CustomUploaderItem uploader = CustomUploaderGetSelected();
|
||||||
if (uploader != null)
|
if (uploader != null)
|
||||||
{
|
{
|
||||||
|
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>();
|
if (uploader.Arguments == null) uploader.Arguments = new Dictionary<string, string>();
|
||||||
uploader.Arguments.Add(name, value);
|
uploader.Arguments.Add(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txtCustomUploaderArgName.Text = "";
|
||||||
|
txtCustomUploaderArgValue.Text = "";
|
||||||
|
txtCustomUploaderArgName.Focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3386,18 +3394,26 @@ private void btnCustomUploaderHeaderAdd_Click(object sender, EventArgs e)
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(name))
|
if (!string.IsNullOrEmpty(name))
|
||||||
{
|
{
|
||||||
string value = txtCustomUploaderHeaderValue.Text;
|
|
||||||
lvCustomUploaderHeaders.Items.Add(name).SubItems.Add(value);
|
|
||||||
txtCustomUploaderHeaderName.Text = "";
|
|
||||||
txtCustomUploaderHeaderValue.Text = "";
|
|
||||||
txtCustomUploaderHeaderName.Focus();
|
|
||||||
|
|
||||||
CustomUploaderItem uploader = CustomUploaderGetSelected();
|
CustomUploaderItem uploader = CustomUploaderGetSelected();
|
||||||
if (uploader != null)
|
if (uploader != null)
|
||||||
{
|
{
|
||||||
|
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>();
|
if (uploader.Headers == null) uploader.Headers = new Dictionary<string, string>();
|
||||||
uploader.Headers.Add(name, value);
|
uploader.Headers.Add(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
txtCustomUploaderHeaderName.Text = "";
|
||||||
|
txtCustomUploaderHeaderValue.Text = "";
|
||||||
|
txtCustomUploaderHeaderName.Focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue