Resolved a bug in CommandLineParser,
which caused servers started with a single argumentless flag to not parse the flag. Closes #1411
This commit is contained in:
parent
0bb704a845
commit
42c7a2b030
1 changed files with 6 additions and 2 deletions
|
|
@ -165,10 +165,14 @@ namespace TShockAPI.CLI
|
||||||
{
|
{
|
||||||
_source = source;
|
_source = source;
|
||||||
|
|
||||||
for (int i = 0; i < source.Length - 1; i++)
|
for (int i = 0; i < (source.Length - 1 == 0 ? 1 : source.Length - 1); i++)
|
||||||
{
|
{
|
||||||
string flag = source[i].ToLowerInvariant();
|
string flag = source[i].ToLowerInvariant();
|
||||||
string argument = source[i + 1];
|
string argument = null;
|
||||||
|
if (i + 1 < source.Length)
|
||||||
|
{
|
||||||
|
argument = source[i + 1];
|
||||||
|
}
|
||||||
|
|
||||||
FlagSet flags = _flags.FirstOrDefault(f => f.Contains(flag));
|
FlagSet flags = _flags.FirstOrDefault(f => f.Contains(flag));
|
||||||
if (flags == null)
|
if (flags == null)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue