diff --git a/libsecondlife-cs/examples/TestClient/Command.cs b/libsecondlife-cs/examples/TestClient/Command.cs index 40f297c0..35463508 100644 --- a/libsecondlife-cs/examples/TestClient/Command.cs +++ b/libsecondlife-cs/examples/TestClient/Command.cs @@ -12,7 +12,7 @@ namespace libsecondlife.TestClient public string Description; public TestClient TestClient; - public abstract string Execute(SecondLife Client, string[] args, LLUUID fromAgentID); + public abstract string Execute(SecondLife client, string[] args, LLUUID fromAgentID); /// /// When set to true, think will be called. diff --git a/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs index dd446156..1433a37a 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs @@ -64,8 +64,8 @@ namespace libsecondlife.TestClient //else //{ // //stop at current position - // LLVector3 myPos = Client.Self.Position; - // Client.Self.AutoPilot((ulong)myPos.X, (ulong)myPos.Y, myPos.Z); + // LLVector3 myPos = client.Self.Position; + // client.Self.AutoPilot((ulong)myPos.x, (ulong)myPos.y, myPos.Z); //} base.Think(Client); diff --git a/libsecondlife-cs/examples/TestClient/Commands/LoadCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/LoadCommand.cs new file mode 100644 index 00000000..21245920 --- /dev/null +++ b/libsecondlife-cs/examples/TestClient/Commands/LoadCommand.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Reflection; +using libsecondlife; +using libsecondlife.Packets; + +namespace libsecondlife.TestClient +{ + public class LoadCommand: Command + { + public LoadCommand() + { + Name = "load"; + Description = "Loads commands from a dll. (Usage: load AssemblyNameWithoutExtension)"; + } + + public override string Execute(SecondLife Client, string[] args, LLUUID fromAgentID) + { + if (args.Length < 1) + return "Usage: load AssemblyNameWithoutExtension"; + + string filename = AppDomain.CurrentDomain.BaseDirectory + args[0] + ".dll"; + TestClient.RegisterAllCommands(Assembly.LoadFile(filename)); + return "Assembly " + filename + " loaded."; + } + } +} diff --git a/libsecondlife-cs/examples/TestClient/TestClient.cs b/libsecondlife-cs/examples/TestClient/TestClient.cs index fc9d8b98..5e2435e6 100644 --- a/libsecondlife-cs/examples/TestClient/TestClient.cs +++ b/libsecondlife-cs/examples/TestClient/TestClient.cs @@ -112,7 +112,7 @@ namespace libsecondlife.TestClient } } - private void RegisterAllCommands(Assembly assembly) + public void RegisterAllCommands(Assembly assembly) { foreach (Type t in assembly.GetTypes()) { @@ -126,9 +126,11 @@ namespace libsecondlife.TestClient private void RegisterCommand(Command command) { - command.TestClient = this; - - Commands.Add(command.Name.ToLower(), command); + if (!Commands.ContainsKey(command.Name.ToLower())) + { + command.TestClient = this; + Commands.Add(command.Name.ToLower(), command); + } } private void DoCommand(SecondLife client, string cmd, LLUUID fromAgentID, LLUUID imSessionID) @@ -218,7 +220,7 @@ Begin: private void PrintPrompt() { - //Console.Write(String.Format("{0} {1} - {2}> ", Client.Self.FirstName, Client.Self.LastName, Client.Network.CurrentSim.Region.Name)); + //Console.Write(String.Format("{0} {1} - {2}> ", client.Self.FirstName, client.Self.LastName, client.Network.CurrentSim.Region.Name)); int online = 0; diff --git a/libsecondlife-cs/examples/TestClient/TestClient.csproj b/libsecondlife-cs/examples/TestClient/TestClient.csproj index 1218fa44..abdb3cc6 100644 --- a/libsecondlife-cs/examples/TestClient/TestClient.csproj +++ b/libsecondlife-cs/examples/TestClient/TestClient.csproj @@ -35,6 +35,7 @@ +