Adding special handling for help and script commands to TestClient, you can now run them without any logged in bots

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2286 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2008-10-09 17:42:18 +00:00
parent af97cb2d48
commit 96f66d4b13
2 changed files with 25 additions and 6 deletions

View File

@@ -198,6 +198,9 @@ namespace OpenMetaverse.TestClient
string[] tokens = cmd.Trim().Split(new char[] { ' ', '\t' });
string firstToken = tokens[0].ToLower();
string[] args = new string[tokens.Length - 1];
Array.Copy(tokens, 1, args, 0, args.Length);
if (tokens.Length == 0)
return;
@@ -205,8 +208,7 @@ namespace OpenMetaverse.TestClient
{
// Special login case: Only call it once, and allow it with
// no logged in avatars
string[] args = new string[tokens.Length - 1];
Array.Copy(tokens, 1, args, 0, args.Length);
Login(args);
}
else if (firstToken == "quit")
@@ -214,6 +216,19 @@ namespace OpenMetaverse.TestClient
Quit();
Logger.Log("All clients logged out and program finished running.", Helpers.LogLevel.Info);
}
else if (firstToken == "help")
{
// No reason to pass this to all bots, and we also want to allow it when there are no bots
HelpCommand command = new HelpCommand(null);
command.Client = new TestClient(this);
Console.WriteLine(command.Execute(args, UUID.Zero));
}
else if (firstToken == "script")
{
// No reason to pass this to all bots, and we also want to allow it when there are no bots
ScriptCommand command = new ScriptCommand(null);
Logger.Log(command.Execute(args, UUID.Zero), Helpers.LogLevel.Info);
}
else
{
// Make an immutable copy of the Clients dictionary to safely iterate over