LIBOMV-686 Implements new event patterns based on the Microsoft Framework Design Guidelines in DirectoryManager
* Completes Full documentation of DirectoryManager class * Cleaned up Search Methods in DirectoryManager to be more developer friendly * Adds Several TestClient commands related to DirectoryManager: searchgroups, searchland, searchpeople * Adds a StructToString method to helpers to simplify parsing and printing Structs for debugging purposes * Many other code cleanups * BREAKING - this is a major shift in the way events are internally handled, Take a look at the newly added TestClient commands for example code that implement this pattern. git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3139 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -18,6 +18,7 @@ namespace OpenMetaverse.TestClient.Commands
|
||||
|
||||
public override string Execute(string[] args, UUID fromAgentID)
|
||||
{
|
||||
// process command line arguments
|
||||
if (args.Length < 1)
|
||||
return "Usage: searchevents [search text]";
|
||||
|
||||
@@ -25,9 +26,12 @@ namespace OpenMetaverse.TestClient.Commands
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
searchText += args[i] + " ";
|
||||
searchText = searchText.TrimEnd();
|
||||
waitQuery.Reset();
|
||||
|
||||
Client.Directory.OnEventsReply += new DirectoryManager.EventReplyCallback(Directory_OnEventsReply);
|
||||
waitQuery.Reset();
|
||||
|
||||
Client.Directory.DirEventsReply += Directory_DirEvents;
|
||||
|
||||
// send the request to the directory manager
|
||||
Client.Directory.StartEventsSearch(searchText, 0);
|
||||
string result;
|
||||
if (waitQuery.WaitOne(20000, false) && Client.Network.Connected)
|
||||
@@ -37,25 +41,27 @@ namespace OpenMetaverse.TestClient.Commands
|
||||
else
|
||||
{
|
||||
result = "Timeout waiting for simulator to respond.";
|
||||
}
|
||||
Client.Directory.OnEventsReply -= new DirectoryManager.EventReplyCallback(Directory_OnEventsReply);
|
||||
}
|
||||
|
||||
Client.Directory.DirEventsReply -= Directory_DirEvents;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Directory_OnEventsReply(UUID queryID, List<DirectoryManager.EventsSearchData> matchedEvents)
|
||||
void Directory_DirEvents(object sender, DirEventsReplyEventArgs e)
|
||||
{
|
||||
if (matchedEvents[0].ID == 0 && matchedEvents.Count == 1)
|
||||
if (e.MatchedEvents[0].ID == 0 && e.MatchedEvents.Count == 1)
|
||||
{
|
||||
Console.WriteLine("No Results matched your search string");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (DirectoryManager.EventsSearchData ev in matchedEvents)
|
||||
{
|
||||
foreach (DirectoryManager.EventsSearchData ev in e.MatchedEvents)
|
||||
{
|
||||
Console.WriteLine("Event ID: {0} Event Name: {1} Event Date: {2}", ev.ID, ev.Name, ev.Date);
|
||||
}
|
||||
}
|
||||
resultCount = matchedEvents.Count;
|
||||
resultCount = e.MatchedEvents.Count;
|
||||
waitQuery.Set();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user