aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/CommandParser.cs
diff options
context:
space:
mode:
authorwilliam341 <[email protected]>2017-06-18 16:43:30 -0700
committerGitHub <[email protected]>2017-06-18 16:43:30 -0700
commitba80dcf3f80018cbb041b62ad8a40268427d1311 (patch)
treef0bd18b2355d34c07c744c3cd82a4725a799eecd /ShiftOS_TheReturn/CommandParser.cs
parent771c20cfb3a703e0f1550fdcf9eb07b78298c944 (diff)
parent12acff8742f4c64976bfabee1b70dc515190fc7c (diff)
downloadshiftos_thereturn-ba80dcf3f80018cbb041b62ad8a40268427d1311.tar.gz
shiftos_thereturn-ba80dcf3f80018cbb041b62ad8a40268427d1311.tar.bz2
shiftos_thereturn-ba80dcf3f80018cbb041b62ad8a40268427d1311.zip
Merge pull request #2 from shiftos-game/master
wew
Diffstat (limited to 'ShiftOS_TheReturn/CommandParser.cs')
-rw-r--r--ShiftOS_TheReturn/CommandParser.cs29
1 files changed, 19 insertions, 10 deletions
diff --git a/ShiftOS_TheReturn/CommandParser.cs b/ShiftOS_TheReturn/CommandParser.cs
index 868d27a..da1073f 100644
--- a/ShiftOS_TheReturn/CommandParser.cs
+++ b/ShiftOS_TheReturn/CommandParser.cs
@@ -85,10 +85,9 @@ namespace ShiftOS.Engine
/// </summary>
/// <param name="cdd">The command string to parse.</param>
/// <returns>The parsed command, ready to be invoked.</returns>
- public KeyValuePair<KeyValuePair<string, string>, Dictionary<string, string>> ParseCommand(string cdd)
+ public KeyValuePair<string, Dictionary<string, string>> ParseCommand(string cdd)
{
string command = "";
- string ns = "";
Dictionary<string, string> arguments = new Dictionary<string, string>();
string text = cdd;
@@ -142,12 +141,7 @@ namespace ShiftOS.Engine
if (part is CommandFormatMarker)
{
- if (part is CommandFormatNamespace)
- {
- ns = res;
- help = -1;
- }
- else if (part is CommandFormatCommand)
+ if (part is CommandFormatCommand)
{
command = res;
help = -1;
@@ -197,7 +191,7 @@ namespace ShiftOS.Engine
if (command == "+FALSE+")
{
//lblExampleCommand.Text = "Syntax Error";
- return new KeyValuePair<KeyValuePair<string, string>, Dictionary<string, string>>();
+ return new KeyValuePair<string, Dictionary<string, string>>();
}
else
{
@@ -210,9 +204,24 @@ namespace ShiftOS.Engine
argvs += "}";
lblExampleCommand.Text = command + argvs;*/
- return new KeyValuePair<KeyValuePair<string, string>, Dictionary<string, string>>(new KeyValuePair<string, string>(ns, command), arguments);
+ return new KeyValuePair<string, Dictionary<string, string>>(command, arguments);
}
}
+
+ internal static CommandParser GenerateSample()
+ {
+ var parser = new CommandParser();
+ parser.AddPart(new CommandFormatCommand());
+ parser.AddPart(new CommandFormatText(" --"));
+ parser.AddPart(new CommandFormatArgument());
+ parser.AddPart(new CommandFormatText(" "));
+ parser.AddPart(new CommandFormatValue());
+ parser.AddPart(new CommandFormatText(" --"));
+ parser.AddPart(new CommandFormatArgument());
+ parser.AddPart(new CommandFormatText(" "));
+ parser.AddPart(new CommandFormatValue());
+ return parser;
+ }
}
public class CFValue