Files
libremetaverse/Programs/examples/TestClient/Command.cs
Jim Radford d34730a019 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
2009-10-10 06:38:07 +00:00

62 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using OpenMetaverse;
using OpenMetaverse.Packets;
namespace OpenMetaverse.TestClient
{
public enum CommandCategory : int
{
Parcel,
Appearance,
Movement,
Simulator,
Communication,
Inventory,
Objects,
Voice,
TestClient,
Friends,
Groups,
Other,
Unknown,
Search
}
public abstract class Command : IComparable
{
public string Name;
public string Description;
public CommandCategory Category;
public TestClient Client;
public abstract string Execute(string[] args, UUID fromAgentID);
/// <summary>
/// When set to true, think will be called.
/// </summary>
public bool Active;
/// <summary>
/// Called twice per second, when Command.Active is set to true.
/// </summary>
public virtual void Think()
{
}
public int CompareTo(object obj)
{
if (obj is Command)
{
Command c2 = (Command)obj;
return Category.CompareTo(c2.Category);
}
else
throw new ArgumentException("Object is not of type Command.");
}
}
}