From 241597c00cddd452486357afbbf5a8da8269f9ea Mon Sep 17 00:00:00 2001 From: lonecoder Date: Thu, 4 Jan 2007 05:41:23 +0000 Subject: [PATCH] TestClient: Cleaned up Command->Client references. git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@796 52acb1d6-8a22-11de-b505-999d5b087335 --- .../examples/TestClient/Command.cs | 4 ++-- .../TestClient/Commands/AppearanceCommand.cs | 4 ---- .../TestClient/Commands/BalanceCommand.cs | 5 ----- .../Commands/CloneProfileCommand.cs | 10 +++------- .../TestClient/Commands/EchoMasterCommand.cs | 9 ++------- .../TestClient/Commands/ExportCommand.cs | 19 ++++++++----------- .../Commands/ExportOutfitCommand.cs | 13 ++++--------- .../TestClient/Commands/FindSimCommand.cs | 4 ---- .../TestClient/Commands/FollowCommand.cs | 19 +++++++------------ .../TestClient/Commands/GiveAllCommand.cs | 5 ----- .../TestClient/Commands/GotoCommand.cs | 4 ---- .../TestClient/Commands/HelpCommand.cs | 7 +------ .../examples/TestClient/Commands/IMCommand.cs | 6 +----- .../TestClient/Commands/ImportCommand.cs | 6 +----- .../Commands/ImportOutfitCommand.cs | 4 ---- .../TestClient/Commands/JumpCommand.cs | 5 ----- .../TestClient/Commands/LoadCommand.cs | 7 +------ .../TestClient/Commands/LocationCommand.cs | 5 ----- .../TestClient/Commands/LoginCommand.cs | 3 +-- .../TestClient/Commands/LogoutCommand.cs | 7 +------ .../TestClient/Commands/PacketLogCommand.cs | 4 ---- .../TestClient/Commands/PrimCountCommand.cs | 9 ++------- .../TestClient/Commands/QuitCommand.cs | 9 ++------- .../TestClient/Commands/SayCommand.cs | 5 ----- .../TestClient/Commands/SetMasterCommand.cs | 10 +++------- .../TestClient/Commands/ShoutCommand.cs | 5 ----- .../TestClient/Commands/SitCommand.cs | 11 +++-------- .../TestClient/Commands/TreeCommand.cs | 7 +------ .../TestClient/Commands/UptimeCommand.cs | 4 ---- .../TestClient/Commands/WhisperCommand.cs | 5 ----- .../TestClient/Commands/WhoCommand.cs | 7 +------ .../examples/TestClient/TestClient.cs | 3 ++- 32 files changed, 46 insertions(+), 179 deletions(-) diff --git a/libsecondlife-cs/examples/TestClient/Command.cs b/libsecondlife-cs/examples/TestClient/Command.cs index 07480500..051519db 100644 --- a/libsecondlife-cs/examples/TestClient/Command.cs +++ b/libsecondlife-cs/examples/TestClient/Command.cs @@ -10,7 +10,7 @@ namespace libsecondlife.TestClient { public string Name; public string Description; - public TestClient TestClient; + public TestClient Client; public abstract string Execute(string[] args, LLUUID fromAgentID); @@ -22,7 +22,7 @@ namespace libsecondlife.TestClient /// /// Called twice per second, when Command.Active is set to true. /// - public virtual void Think(SecondLife Client) + public virtual void Think() { } } diff --git a/libsecondlife-cs/examples/TestClient/Commands/AppearanceCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/AppearanceCommand.cs index fc908cb1..b47cf087 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/AppearanceCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/AppearanceCommand.cs @@ -9,14 +9,10 @@ namespace libsecondlife.TestClient { public class SetAppearanceCommand : Command { - SecondLife Client; AppearanceManager aManager; public SetAppearanceCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "setapp"; Description = "Set appearance to what's stored in the DB."; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/BalanceCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/BalanceCommand.cs index bc50c940..46044f2a 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/BalanceCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/BalanceCommand.cs @@ -7,13 +7,8 @@ namespace libsecondlife.TestClient { public class BalanceCommand: Command { - SecondLife Client; - public BalanceCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "balance"; Description = "Shows the amount of L$."; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/CloneProfileCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/CloneProfileCommand.cs index 9b3631d4..a30b631a 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/CloneProfileCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/CloneProfileCommand.cs @@ -8,7 +8,6 @@ namespace libsecondlife.TestClient { public class CloneProfileCommand : Command { - SecondLife Client; Avatar.Properties Properties; Avatar.Interests Interests; bool ReceivedProperties = false; @@ -17,11 +16,8 @@ namespace libsecondlife.TestClient public CloneProfileCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - - Client.Avatars.OnAvatarInterests += new AvatarManager.AvatarInterestsCallback(Avatars_OnAvatarInterests); - Client.Avatars.OnAvatarProperties += new AvatarManager.AvatarPropertiesCallback(Avatars_OnAvatarProperties); + testClient.Avatars.OnAvatarInterests += new AvatarManager.AvatarInterestsCallback(Avatars_OnAvatarInterests); + testClient.Avatars.OnAvatarProperties += new AvatarManager.AvatarPropertiesCallback(Avatars_OnAvatarProperties); Name = "cloneprofile"; Description = "Clones another avatars profile as closely as possible. WARNING: This command will " + @@ -85,4 +81,4 @@ namespace libsecondlife.TestClient } } } -} +} \ No newline at end of file diff --git a/libsecondlife-cs/examples/TestClient/Commands/EchoMasterCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/EchoMasterCommand.cs index adfee52b..721b5c98 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/EchoMasterCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/EchoMasterCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class EchoMasterCommand: Command { - SecondLife Client; - public EchoMasterCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "echoMaster"; Description = "Repeat everything that master says."; } @@ -37,9 +32,9 @@ namespace libsecondlife.TestClient void Self_OnChat(string message, byte audible, byte type, byte sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { - if (message.Length > 0 && TestClient.Master == fromName) + if (message.Length > 0 && Client.Master == fromName) { - TestClient.Self.Chat(message, 0, MainAvatar.ChatType.Normal); + Client.Self.Chat(message, 0, MainAvatar.ChatType.Normal); } } } diff --git a/libsecondlife-cs/examples/TestClient/Commands/ExportCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/ExportCommand.cs index f165446d..2545688f 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/ExportCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/ExportCommand.cs @@ -10,16 +10,13 @@ namespace libsecondlife.TestClient { public class ExportCommand : Command { - SecondLife Client; ManualResetEvent GotPermissionsEvent = new ManualResetEvent(false); ObjectProperties Properties = null; bool GotPermissions = false; public ExportCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Client.Objects.OnObjectProperties += new ObjectManager.ObjectPropertiesFamilyCallback(Objects_OnObjectProperties); + testClient.Objects.OnObjectProperties += new ObjectManager.ObjectPropertiesFamilyCallback(Objects_OnObjectProperties); Name = "export"; Description = "Exports an object to an xml file. Usage: export uuid outputfile.xml"; @@ -44,11 +41,11 @@ namespace libsecondlife.TestClient return "Usage: export uuid outputfile.xml"; } - lock (TestClient.SimPrims) + lock (Client.SimPrims) { - if (TestClient.SimPrims.ContainsKey(Client.Network.CurrentSim)) + if (Client.SimPrims.ContainsKey(Client.Network.CurrentSim)) { - foreach (PrimObject prim in TestClient.SimPrims[Client.Network.CurrentSim].Values) + foreach (PrimObject prim in Client.SimPrims[Client.Network.CurrentSim].Values) { if (prim.ID == id) { @@ -104,11 +101,11 @@ namespace libsecondlife.TestClient { List prims = new List(); - lock (TestClient.SimPrims) + lock (Client.SimPrims) { - if (TestClient.SimPrims.ContainsKey(Client.Network.CurrentSim)) + if (Client.SimPrims.ContainsKey(Client.Network.CurrentSim)) { - foreach (PrimObject prim in TestClient.SimPrims[Client.Network.CurrentSim].Values) + foreach (PrimObject prim in Client.SimPrims[Client.Network.CurrentSim].Values) { if (prim.LocalID == localid || prim.ParentID == localid) { @@ -141,7 +138,7 @@ namespace libsecondlife.TestClient else { return "Couldn't find UUID " + id.ToString() + " in the " + - TestClient.SimPrims[Client.Network.CurrentSim].Count + + Client.SimPrims[Client.Network.CurrentSim].Count + "objects currently indexed in the current simulator"; } } diff --git a/libsecondlife-cs/examples/TestClient/Commands/ExportOutfitCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/ExportOutfitCommand.cs index 5ff6cd92..9a91d009 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/ExportOutfitCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/ExportOutfitCommand.cs @@ -9,13 +9,8 @@ namespace libsecondlife.TestClient { public class ExportOutfitCommand : Command { - SecondLife Client; - public ExportOutfitCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "exportoutfit"; Description = "Exports an avatars outfit to an xml file. Usage: exportoutfit avataruuid outputfile.xml"; } @@ -36,9 +31,9 @@ namespace libsecondlife.TestClient return "Usage: exportoutfit avataruuid outputfile.xml"; } - lock (TestClient.Appearances) + lock (Client.Appearances) { - if (TestClient.Appearances.ContainsKey(id)) + if (Client.Appearances.ContainsKey(id)) { try { @@ -47,7 +42,7 @@ namespace libsecondlife.TestClient XmlWriter writer = XmlWriter.Create(args[1], settings); try { - TestClient.Appearances[id].ToXml(writer); + Client.Appearances[id].ToXml(writer); } finally { @@ -68,4 +63,4 @@ namespace libsecondlife.TestClient } } } -} +} \ No newline at end of file diff --git a/libsecondlife-cs/examples/TestClient/Commands/FindSimCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/FindSimCommand.cs index dfffe27e..ed4c1850 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/FindSimCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/FindSimCommand.cs @@ -8,14 +8,10 @@ namespace libsecondlife.TestClient { public class FindSimCommand : Command { - SecondLife Client; Dictionary GridDataCached = new Dictionary(); public FindSimCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "findsim"; Description = "Searches for a simulator and returns information about it. Usage: findsim [Simulator Name]"; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs index 312ae558..a4d3c35a 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/FollowCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class FollowCommand: Command { - SecondLife Client; - public FollowCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "follow"; Description = "Follow another avatar. (usage: follow [FirstName LastName]) If no target is set then will follow master."; } @@ -27,7 +22,7 @@ namespace libsecondlife.TestClient target = target.TrimEnd(); if (target.Length == 0) - target = TestClient.Master; + target = Client.Master; if (target.Length > 0) { @@ -48,7 +43,7 @@ namespace libsecondlife.TestClient bool Follow(string name) { - foreach (Avatar av in TestClient.AvatarList.Values) + foreach (Avatar av in Client.AvatarList.Values) { if (av.Name == name) { @@ -61,14 +56,14 @@ namespace libsecondlife.TestClient return false; } - public override void Think(SecondLife Client) + public override void Think() { if (Helpers.VecDist(followAvatar.Position, Client.Self.Position) > DISTANCE_BUFFER) { //move toward target - LLVector3 avPos = followAvatar.Position; - Client.Self.AutoPilot((ulong)avPos.X + (ulong)TestClient.regionX, (ulong)avPos.Y + (ulong)TestClient.regionY, avPos.Z); - } + LLVector3 avPos = followAvatar.Position; + Client.Self.AutoPilot((ulong)avPos.X + (ulong)Client.regionX, (ulong)avPos.Y + (ulong)Client.regionY, avPos.Z); + } //else //{ // //stop at current position @@ -76,7 +71,7 @@ namespace libsecondlife.TestClient // client.Self.AutoPilot((ulong)myPos.x, (ulong)myPos.y, myPos.Z); //} - base.Think(Client); + base.Think(); } } diff --git a/libsecondlife-cs/examples/TestClient/Commands/GiveAllCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/GiveAllCommand.cs index b351ef6b..8890ea0c 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/GiveAllCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/GiveAllCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class GiveAllCommand: Command { - SecondLife Client; - public GiveAllCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "giveAll"; Description = "Gives you all it's money."; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/GotoCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/GotoCommand.cs index 24db39a2..20460729 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/GotoCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/GotoCommand.cs @@ -8,14 +8,10 @@ namespace libsecondlife.TestClient { public class GotoCommand: Command { - SecondLife Client; private bool EstateLookupFinished = false; public GotoCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "goto"; Description = "Teleport to a location (e.g. \"goto Hooper/100/100/30\")"; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/HelpCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/HelpCommand.cs index 66ceffa8..a79abd4b 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/HelpCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/HelpCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class HelpCommand: Command { - SecondLife Client; - public HelpCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "help"; Description = "Lists available commands."; } @@ -23,7 +18,7 @@ namespace libsecondlife.TestClient { StringBuilder result = new StringBuilder(); result.AppendFormat("\n\nHELP\nClient accept teleport lures from master and group members.\n"); - foreach (Command c in TestClient.Commands.Values) + foreach (Command c in Client.Commands.Values) { result.AppendFormat("{0} - {1}\n", c.Name, c.Description); } diff --git a/libsecondlife-cs/examples/TestClient/Commands/IMCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/IMCommand.cs index 208c56c2..d847291d 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/IMCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/IMCommand.cs @@ -8,17 +8,13 @@ namespace libsecondlife.TestClient { public class ImCommand : Command { - SecondLife Client; string ToAvatarName = String.Empty; ManualResetEvent NameSearchEvent = new ManualResetEvent(false); Dictionary Name2Key = new Dictionary(); public ImCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - - Client.Avatars.OnAvatarNameSearch += new AvatarManager.AvatarNameSearchCallback(Avatars_OnAvatarNameSearch); + testClient.Avatars.OnAvatarNameSearch += new AvatarManager.AvatarNameSearchCallback(Avatars_OnAvatarNameSearch); Name = "im"; Description = "Instant message someone. Usage: im [firstname] [lastname] [message]"; diff --git a/libsecondlife-cs/examples/TestClient/Commands/ImportCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/ImportCommand.cs index 75bdedbe..a1d1c397 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/ImportCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/ImportCommand.cs @@ -29,7 +29,6 @@ namespace libsecondlife.TestClient public class ImportCommand : Command { - SecondLife Client; PrimObject currentPrim; LLVector3 currentPosition; SecondLife currentClient; @@ -42,9 +41,6 @@ namespace libsecondlife.TestClient public ImportCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "import"; Description = "Import prims from an exported xml file. Usage: import [filename.xml]"; primDone = new ManualResetEvent(false); @@ -81,7 +77,7 @@ namespace libsecondlife.TestClient if (!registeredCreateEvent) { - TestClient.OnPrimCreated += new TestClient.PrimCreatedCallback(TestClient_OnPrimCreated); + Client.OnPrimCreated += new TestClient.PrimCreatedCallback(TestClient_OnPrimCreated); registeredCreateEvent = true; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/ImportOutfitCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/ImportOutfitCommand.cs index aee1ee15..595ce980 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/ImportOutfitCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/ImportOutfitCommand.cs @@ -10,14 +10,10 @@ namespace libsecondlife.TestClient { public class ImportOutfitCommand : Command { - SecondLife Client; private uint SerialNum = 1; public ImportOutfitCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "importoutfit"; Description = "Imports an appearance from an xml file. Usage: importoutfit inputfile.xml"; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/JumpCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/JumpCommand.cs index f7c14162..c56dd1ce 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/JumpCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/JumpCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class JumpCommand: Command { - SecondLife Client; - public JumpCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "jump"; Description = "Teleports to the specified height. (e.g. \"jump 1000\")"; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/LoadCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/LoadCommand.cs index a2ff410b..24d22196 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/LoadCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/LoadCommand.cs @@ -9,13 +9,8 @@ namespace libsecondlife.TestClient { public class LoadCommand: Command { - SecondLife Client; - public LoadCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "load"; Description = "Loads commands from a dll. (Usage: load AssemblyNameWithoutExtension)"; } @@ -26,7 +21,7 @@ namespace libsecondlife.TestClient return "Usage: load AssemblyNameWithoutExtension"; string filename = AppDomain.CurrentDomain.BaseDirectory + args[0] + ".dll"; - TestClient.RegisterAllCommands(Assembly.LoadFile(filename)); + Client.RegisterAllCommands(Assembly.LoadFile(filename)); return "Assembly " + filename + " loaded."; } } diff --git a/libsecondlife-cs/examples/TestClient/Commands/LocationCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/LocationCommand.cs index e2d424ec..ac7d24f1 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/LocationCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/LocationCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class LocationCommand: Command { - SecondLife Client; - public LocationCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "location"; Description = "Show the location."; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/LoginCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/LoginCommand.cs index f292cb40..ea007849 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/LoginCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/LoginCommand.cs @@ -10,7 +10,6 @@ namespace libsecondlife.TestClient { public LoginCommand(TestClient testClient) { - TestClient = testClient; Name = "login"; Description = "Logs in another avatar"; } @@ -20,7 +19,7 @@ namespace libsecondlife.TestClient if (args.Length != 3) return "usage: login firstname lastname password"; - SecondLife newClient = TestClient.ClientManager.Login(args); + SecondLife newClient = Client.ClientManager.Login(args); if (newClient.Network.Connected) { diff --git a/libsecondlife-cs/examples/TestClient/Commands/LogoutCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/LogoutCommand.cs index 4165c5fb..8241626d 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/LogoutCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/LogoutCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class LogoutCommand : Command { - SecondLife Client; - public LogoutCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "logout"; Description = "Log this avatar out"; } @@ -22,7 +17,7 @@ namespace libsecondlife.TestClient public override string Execute(string[] args, LLUUID fromAgentID) { string name = Client.ToString(); - TestClient.ClientManager.Logout(TestClient); + Client.ClientManager.Logout(Client); return "Logged " + name + " out"; } } diff --git a/libsecondlife-cs/examples/TestClient/Commands/PacketLogCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/PacketLogCommand.cs index cb9a18c2..694cee16 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/PacketLogCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/PacketLogCommand.cs @@ -8,7 +8,6 @@ namespace libsecondlife.TestClient { public class PacketLogCommand : Command { - SecondLife Client; List Packets = new List(); bool Done = false; int Count = 0; @@ -16,9 +15,6 @@ namespace libsecondlife.TestClient public PacketLogCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "packetlog"; Description = "Logs a given number of packets to an xml file. Usage: packetlog 10 tenpackets.xml"; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/PrimCountCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/PrimCountCommand.cs index f95a7e49..25bf3cb1 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/PrimCountCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/PrimCountCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class PrimCountCommand: Command { - SecondLife Client; - public PrimCountCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "primCount"; Description = "Shows the number of prims that have been received."; } @@ -23,9 +18,9 @@ namespace libsecondlife.TestClient { int count = 0; - lock (TestClient.SimPrims) + lock (Client.SimPrims) { - foreach (Dictionary prims in TestClient.SimPrims.Values) + foreach (Dictionary prims in Client.SimPrims.Values) { count += prims.Count; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/QuitCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/QuitCommand.cs index 518439bb..2cf0418c 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/QuitCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/QuitCommand.cs @@ -8,21 +8,16 @@ namespace libsecondlife.TestClient { public class QuitCommand: Command { - SecondLife Client; - public QuitCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "quit"; Description = "Log all avatars out and shut down"; } public override string Execute(string[] args, LLUUID fromAgentID) { - TestClient.ClientManager.LogoutAll(); - TestClient.ClientManager.Running = false; + Client.ClientManager.LogoutAll(); + Client.ClientManager.Running = false; return "All avatars logged out"; } } diff --git a/libsecondlife-cs/examples/TestClient/Commands/SayCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/SayCommand.cs index f41b153c..679c29cd 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/SayCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/SayCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class SayCommand: Command { - SecondLife Client; - public SayCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "say"; Description = "Say something. (usage: say (optional channel) whatever)"; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/SetMasterCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/SetMasterCommand.cs index b5e5c428..6be17eec 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/SetMasterCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/SetMasterCommand.cs @@ -8,14 +8,10 @@ namespace libsecondlife.TestClient { public class SetMasterCommand: Command { - SecondLife Client; public DateTime Created = DateTime.Now; public SetMasterCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "setMaster"; Description = "Sets the user name of the master user. The master user can IM to run commands."; } @@ -25,11 +21,11 @@ namespace libsecondlife.TestClient string masterName = String.Empty; for (int ct = 0; ct < args.Length;ct++) masterName = masterName + args[ct] + " "; - TestClient.Master = masterName.TrimEnd(); + Client.Master = masterName.TrimEnd(); - foreach (Avatar av in TestClient.AvatarList.Values) + foreach (Avatar av in Client.AvatarList.Values) { - if (av.Name == TestClient.Master) + if (av.Name == Client.Master) { Client.Self.InstantMessage(av.ID, "You are now my master. IM me with \"help\" for a command list."); break; diff --git a/libsecondlife-cs/examples/TestClient/Commands/ShoutCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/ShoutCommand.cs index f183b59f..3533e3d4 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/ShoutCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/ShoutCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class ShoutCommand : Command { - SecondLife Client; - public ShoutCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "shout"; Description = "Shout something."; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/SitCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/SitCommand.cs index 282763b8..2024fe54 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/SitCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/SitCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class SitCommand: Command { - SecondLife Client; - public SitCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "sit"; Description = "Attempt to sit on the closest prim"; } @@ -24,11 +19,11 @@ namespace libsecondlife.TestClient PrimObject closest = null; double closestDistance = Double.MaxValue; - lock (TestClient.SimPrims) + lock (Client.SimPrims) { - if (TestClient.SimPrims.ContainsKey(Client.Network.CurrentSim)) + if (Client.SimPrims.ContainsKey(Client.Network.CurrentSim)) { - foreach (PrimObject p in TestClient.SimPrims[Client.Network.CurrentSim].Values) + foreach (PrimObject p in Client.SimPrims[Client.Network.CurrentSim].Values) { float distance = Helpers.VecDist(Client.Self.Position, p.Position); diff --git a/libsecondlife-cs/examples/TestClient/Commands/TreeCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/TreeCommand.cs index 7d556cb7..60cf234e 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/TreeCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/TreeCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class TreeCommand: Command { - SecondLife Client; - public TreeCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "tree"; Description = "Rez a tree."; } @@ -33,7 +28,7 @@ namespace libsecondlife.TestClient treePosition.Z += 3.0f; Client.Objects.AddTree(Client.Network.CurrentSim, new LLVector3(0.5f, 0.5f, 0.5f), - LLQuaternion.Identity, treePosition, tree, TestClient.GroupID, false); + LLQuaternion.Identity, treePosition, tree, Client.GroupID, false); return "Attempted to rez a " + treeName + " tree"; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/UptimeCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/UptimeCommand.cs index d8af5537..ac94644c 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/UptimeCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/UptimeCommand.cs @@ -8,14 +8,10 @@ namespace libsecondlife.TestClient { public class UptimeCommand : Command { - SecondLife Client; public DateTime Created = DateTime.Now; public UptimeCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "uptime"; Description = "Shows the login name, login time and length of time logged on."; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/WhisperCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/WhisperCommand.cs index 0f7afd05..4bfda330 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/WhisperCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/WhisperCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class WhisperCommand : Command { - SecondLife Client; - public WhisperCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "whisper"; Description = "Whisper something."; } diff --git a/libsecondlife-cs/examples/TestClient/Commands/WhoCommand.cs b/libsecondlife-cs/examples/TestClient/Commands/WhoCommand.cs index 877962aa..21d0d036 100644 --- a/libsecondlife-cs/examples/TestClient/Commands/WhoCommand.cs +++ b/libsecondlife-cs/examples/TestClient/Commands/WhoCommand.cs @@ -8,13 +8,8 @@ namespace libsecondlife.TestClient { public class WhoCommand: Command { - SecondLife Client; - public WhoCommand(TestClient testClient) { - TestClient = testClient; - Client = (SecondLife)TestClient; - Name = "who"; Description = "Lists seen avatars."; } @@ -22,7 +17,7 @@ namespace libsecondlife.TestClient public override string Execute(string[] args, LLUUID fromAgentID) { StringBuilder result = new StringBuilder(); - foreach (Avatar av in TestClient.AvatarList.Values) + foreach (Avatar av in Client.AvatarList.Values) { result.AppendFormat("\n{0} {1} {2}/{3} ID: {4}", av.Name, av.GroupName, av.CurrentRegion != null ? av.CurrentRegion.Name : String.Empty, av.Position, av.ID); } diff --git a/libsecondlife-cs/examples/TestClient/TestClient.cs b/libsecondlife-cs/examples/TestClient/TestClient.cs index 48e96484..927c12bb 100644 --- a/libsecondlife-cs/examples/TestClient/TestClient.cs +++ b/libsecondlife-cs/examples/TestClient/TestClient.cs @@ -88,6 +88,7 @@ namespace libsecondlife.TestClient private void RegisterCommand(Command command) { + command.Client = this; if (!Commands.ContainsKey(command.Name.ToLower())) { Commands.Add(command.Name.ToLower(), command); @@ -159,7 +160,7 @@ namespace libsecondlife.TestClient foreach (Command c in Commands.Values) if (c.Active) - c.Think(this); + c.Think(); } private void AgentDataUpdateHandler(Packet packet, Simulator sim)