From e93869c7a785a4f375685ffa33c913033ed1c85a Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 21 Jun 2007 17:08:21 +0000 Subject: * Importing Ming's mass test client --- .../Commands/Communication/SayCommand.cs | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tools/mass test client/Commands/Communication/SayCommand.cs (limited to 'tools/mass test client/Commands/Communication/SayCommand.cs') diff --git a/tools/mass test client/Commands/Communication/SayCommand.cs b/tools/mass test client/Commands/Communication/SayCommand.cs new file mode 100644 index 0000000..2ab9db4 --- /dev/null +++ b/tools/mass test client/Commands/Communication/SayCommand.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace libsecondlife.TestClient +{ + public class SayCommand: Command + { + public SayCommand(TestClient testClient) + { + Name = "say"; + Description = "Say something. (usage: say (optional channel) whatever)"; + } + + public override string Execute(string[] args, LLUUID fromAgentID) + { + int channel = 0; + int startIndex = 0; + + if (args.Length < 1) + { + return "usage: say (optional channel) whatever"; + } + else if (args.Length > 1) + { + if (Int32.TryParse(args[0], out channel)) + startIndex = 1; + } + + StringBuilder message = new StringBuilder(); + + for (int i = startIndex; i < args.Length; i++) + { + message.Append(args[i]); + if (i != args.Length - 1) message.Append(" "); + } + + Client.Self.Chat(message.ToString(), channel, MainAvatar.ChatType.Normal); + + return "Said " + message.ToString(); + } + } +} -- cgit v1.1