From 5b6afeafbc249ba88dcc20d1fbc98ce12418b21b Mon Sep 17 00:00:00 2001 From: gareth Date: Tue, 8 May 2007 00:10:04 +0000 Subject: Brought in TestClient code for teh fork --- ExportBot/Commands/ExportOutfitCommand.cs | 66 +++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 ExportBot/Commands/ExportOutfitCommand.cs (limited to 'ExportBot/Commands/ExportOutfitCommand.cs') diff --git a/ExportBot/Commands/ExportOutfitCommand.cs b/ExportBot/Commands/ExportOutfitCommand.cs new file mode 100644 index 0000000..6ec2776 --- /dev/null +++ b/ExportBot/Commands/ExportOutfitCommand.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml; +using libsecondlife; +using libsecondlife.Packets; + +namespace libsecondlife.TestClient +{ + public class ExportOutfitCommand : Command + { + public ExportOutfitCommand(TestClient testClient) + { + Name = "exportoutfit"; + Description = "Exports an avatars outfit to an xml file. Usage: exportoutfit avataruuid outputfile.xml"; + } + + public override string Execute(string[] args, LLUUID fromAgentID) + { + if (args.Length != 2) + return "Usage: exportoutfit avataruuid outputfile.xml"; + + LLUUID id; + + try + { + id = new LLUUID(args[0]); + } + catch (Exception) + { + return "Usage: exportoutfit avataruuid outputfile.xml"; + } + + lock (Client.Appearances) + { + if (Client.Appearances.ContainsKey(id)) + { + try + { + XmlWriterSettings settings = new XmlWriterSettings(); + settings.Indent = true; + XmlWriter writer = XmlWriter.Create(args[1], settings); + try + { + Client.Appearances[id].ToXml(writer); + } + finally + { + writer.Close(); + } + } + catch (Exception e) + { + return e.ToString(); + } + + return "Exported appearance for avatar " + id.ToString() + " to " + args[1]; + } + else + { + return "Couldn't find an appearance for avatar " + id.ToString(); + } + } + } + } +} \ No newline at end of file -- cgit v1.1