Moving examples, mapgenerator, and VisualParamGenerator to Programs folder (SVN is seriously ruined still, don't check out yet)
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1961 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class GroupsCommand : Command
|
||||
{
|
||||
ManualResetEvent GetCurrentGroupsEvent = new ManualResetEvent(false);
|
||||
Dictionary<LLUUID, Group> groups = new Dictionary<LLUUID, Group>();
|
||||
|
||||
public GroupsCommand(TestClient testClient)
|
||||
{
|
||||
testClient.Groups.OnCurrentGroups += new GroupManager.CurrentGroupsCallback(Groups_OnCurrentGroups);
|
||||
|
||||
Name = "groups";
|
||||
Description = "List avatar groups. Usage: groups";
|
||||
}
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
if (groups.Count == 0)
|
||||
{
|
||||
Client.Groups.RequestCurrentGroups();
|
||||
GetCurrentGroupsEvent.WaitOne(10000, false);
|
||||
}
|
||||
if (groups.Count > 0)
|
||||
{
|
||||
return getGroupsString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "No groups";
|
||||
}
|
||||
}
|
||||
|
||||
void Groups_OnCurrentGroups(Dictionary<LLUUID, Group> pGroups)
|
||||
{
|
||||
groups = pGroups;
|
||||
GetCurrentGroupsEvent.Set();
|
||||
}
|
||||
string getGroupsString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (Group group in groups.Values)
|
||||
{
|
||||
sb.AppendLine(group.Name + " " + group.ID);
|
||||
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user