mirror of
https://github.com/TechplexEngineer/plexview.git
synced 2026-07-31 04:07:24 +00:00
Initial commit
I wish I could figure out how to have PlexVie be out of the LibOMV tree but its just not working die to a DLL not found exception about libopenjpeg. (Yes the dll is in the bin folder) This will do for now
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class HelpCommand: Command
|
||||
{
|
||||
public HelpCommand(TestClient testClient)
|
||||
{
|
||||
Name = "help";
|
||||
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();
|
||||
SortedDictionary<CommandCategory, List<Command>> CommandTree = new SortedDictionary<CommandCategory, List<Command>>();
|
||||
|
||||
CommandCategory cc;
|
||||
foreach (Command c in Client.Commands.Values)
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user