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:
@@ -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
|
||||
|
||||
@@ -137,6 +137,9 @@ namespace OpenMetaverse.TestClient
|
||||
return;
|
||||
|
||||
string firstToken = tokens[0].ToLower();
|
||||
|
||||
string[] args = new string[tokens.Length - 1];
|
||||
Array.Copy(tokens, 1, args, 0, args.Length);
|
||||
|
||||
// "all balance" will send the balance command to all currently logged in bots
|
||||
if (firstToken == "all" && tokens.Length > 1)
|
||||
@@ -153,8 +156,6 @@ 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);
|
||||
ClientManager.Login(args);
|
||||
}
|
||||
else if (firstToken == "quit")
|
||||
@@ -162,10 +163,13 @@ namespace OpenMetaverse.TestClient
|
||||
ClientManager.Quit();
|
||||
Logger.Log("All clients logged out and program finished running.", Helpers.LogLevel.Info);
|
||||
}
|
||||
else if (firstToken == "script")
|
||||
{
|
||||
// Execute only once
|
||||
Commands[firstToken].Execute(args, fromAgentID);
|
||||
}
|
||||
else if (Commands.ContainsKey(firstToken))
|
||||
{
|
||||
string[] args = new string[tokens.Length - 1];
|
||||
Array.Copy(tokens, 1, args, 0, args.Length);
|
||||
string response = Commands[firstToken].Execute(args, fromAgentID);
|
||||
|
||||
if (!String.IsNullOrEmpty(response))
|
||||
|
||||
Reference in New Issue
Block a user