TC-45 New TestClient command selectobjects - will return a list of objects on a specific parcel owned by the specifed owner

TC-44 New TestClient command ownerprims to display prim counts
TC-43 Overhaul TestClient help menu system

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2000 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
Jim Radford
2008-07-25 08:55:36 +00:00
parent 8802153778
commit 6f11b53860
85 changed files with 328 additions and 40 deletions

View File

@@ -11,18 +11,59 @@ namespace OpenMetaverse.TestClient
public HelpCommand(TestClient testClient)
{
Name = "help";
Description = "Lists available commands.";
Description = "Lists available commands. usage: help [command] to display information on commands";
Category = CommandCategory.TestClient;
}
public override string Execute(string[] args, UUID fromAgentID)
{
if (args.Length > 0)
{
if (Client.Commands.ContainsKey(args[0]))
return Client.Commands[args[0]].Description;
else
return "Command " + args[0] + " Does not exist. \"help\" to display all available commands.";
}
StringBuilder result = new StringBuilder();
result.AppendFormat("\n\nHELP\nClient accept teleport lures from master and group members.\n");
SortedDictionary<CommandCategory, List<Command>> CommandTree = new SortedDictionary<CommandCategory, List<Command>>();
CommandCategory cc;
foreach (Command c in Client.Commands.Values)
{
result.AppendFormat(" * {0} - {1}\n", c.Name, c.Description);
if (c.Category.Equals(null))
cc = CommandCategory.Unknown;
else
cc = c.Category;
if (CommandTree.ContainsKey(cc))
CommandTree[cc].Add(c);
else
{
List<Command> l = new List<Command>();
l.Add(c);
CommandTree.Add(cc, l);
}
}
foreach (KeyValuePair<CommandCategory, List<Command>> kvp in CommandTree)
{
result.AppendFormat(System.Environment.NewLine + "* {0} Related Commands:" + System.Environment.NewLine, kvp.Key.ToString());
int colMax = 0;
for (int i = 0; i < kvp.Value.Count; i++)
{
if (colMax >= 120)
{
result.AppendLine();
colMax = 0;
}
result.AppendFormat(" {0,-15}", kvp.Value[i].Name);
colMax += 15;
}
result.AppendLine();
}
result.AppendLine(System.Environment.NewLine + "Help [command] for usage/information");
return result.ToString();
}
}