mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-29 08:51:36 +13:00
Added $input$ and $input:default value$ syntax to custom uploader parser
This commit is contained in:
parent
472f885b41
commit
ab6d3af1ad
1 changed files with 22 additions and 0 deletions
|
@ -31,6 +31,7 @@ You should have received a copy of the GNU General Public License
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace ShareX.UploadersLib
|
||||
|
@ -152,6 +153,14 @@ private string ParseSyntax(string syntax)
|
|||
{
|
||||
return ParseSyntaxSelect(syntax.Substring(7));
|
||||
}
|
||||
else if (syntax.Equals("input", StringComparison.InvariantCultureIgnoreCase)) // Example: $input$
|
||||
{
|
||||
return ParseSyntaxInput();
|
||||
}
|
||||
else if (syntax.StartsWith("input:", StringComparison.InvariantCultureIgnoreCase)) // Example: $input:default value$
|
||||
{
|
||||
return ParseSyntaxInput(syntax.Substring(6));
|
||||
}
|
||||
|
||||
// Invalid syntax
|
||||
return null;
|
||||
|
@ -271,5 +280,18 @@ private string ParseSyntaxSelect(string syntax)
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string ParseSyntaxInput(string defaultValue = null)
|
||||
{
|
||||
using (InputBox inputBox = new InputBox("ShareX - Input", defaultValue))
|
||||
{
|
||||
if (inputBox.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
return inputBox.InputText;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue