diff options
| author | Michael <[email protected]> | 2017-08-03 09:46:48 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-08-03 09:46:48 -0400 |
| commit | 8fe8026de505e8ba7c4aaf4e454d91c7db94d430 (patch) | |
| tree | fe2c016c112679cde8a001ebe70ae34c339de5d9 /ShiftOS_TheReturn | |
| parent | bec3c8424f2612a6b58244ae2462a17455da8303 (diff) | |
| parent | 80f7d54de91246197607ee4d3829bf6a54d63bca (diff) | |
| download | shiftos_thereturn-8fe8026de505e8ba7c4aaf4e454d91c7db94d430.tar.gz shiftos_thereturn-8fe8026de505e8ba7c4aaf4e454d91c7db94d430.tar.bz2 shiftos_thereturn-8fe8026de505e8ba7c4aaf4e454d91c7db94d430.zip | |
Merge remote-tracking branch 'origin/monogame' into monogame
# Conflicts:
# ShiftOS.Frontend/Apps/ChatClient.cs
Diffstat (limited to 'ShiftOS_TheReturn')
| -rw-r--r-- | ShiftOS_TheReturn/CommandParser.cs | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/ShiftOS_TheReturn/CommandParser.cs b/ShiftOS_TheReturn/CommandParser.cs index 8f25668..f234aca 100644 --- a/ShiftOS_TheReturn/CommandParser.cs +++ b/ShiftOS_TheReturn/CommandParser.cs @@ -85,16 +85,22 @@ namespace ShiftOS.Engine int commandPos; int firstValuePos = -1; int lastValuePos = -1; - + int firstTextPart = -1; for (int ii = 0; ii < parts.Count; ii++) { CommandFormat part = parts[ii]; + if(part is CommandFormatText) + { + if(firstTextPart < 0) + firstTextPart = ii; + } if (part is CommandFormatMarker) { if (part is CommandFormatCommand) { commandPos = ii; } + else if (part is CommandFormatValue) { if (firstValuePos > -1) @@ -110,40 +116,44 @@ namespace ShiftOS.Engine int help = -1; bool id_found = false; string id_text = ""; - while (position < text.Length) { if (i >= parts.Count) { - position = text.Length; - command = "+FALSE+"; - i = 0; + i = 1; } - CommandFormat part = parts[i]; + var part = parts[i]; string inp = text.Substring(position); + string res = part.CheckValidity(inp); - if(part is CommandFormatText) + if (part is CommandFormatText) { if (res == "+FALSE+") { -#if SUPERMOSQUITO_DIAGNOSIS - if (!inp.Remove(0, 1).Contains(" ")) + if (id_found == false) { - - - if (id_found == false) + id_found = true; + currentArgument = "id"; + if (!arguments.ContainsKey("id")) + { + arguments.Add("id", ""); + i = firstValuePos; + position++; + continue; + } + else { - id_found = true; - id_text = inp.Remove(0, 1); - res = ""; - arguments.Add("id", id_text); - + Console.WriteLine("Duplicate command-line argument detected: id"); + command = "+FALSE+"; + position = text.Length; + } + } -#endif } + } // ok so: |
