aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ExportBot/Commands/ExportOutfitCommand.cs
diff options
context:
space:
mode:
authorgareth2007-05-08 00:10:04 +0000
committergareth2007-05-08 00:10:04 +0000
commit5b6afeafbc249ba88dcc20d1fbc98ce12418b21b (patch)
tree78861e5f6ae871d63c83b4ab1cc4c55ea184ed6d /ExportBot/Commands/ExportOutfitCommand.cs
parentZOMG! (diff)
downloadopensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.zip
opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.tar.gz
opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.tar.bz2
opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.tar.xz
Brought in TestClient code for teh fork
Diffstat (limited to 'ExportBot/Commands/ExportOutfitCommand.cs')
-rw-r--r--ExportBot/Commands/ExportOutfitCommand.cs66
1 files changed, 66 insertions, 0 deletions
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 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Xml;
5using libsecondlife;
6using libsecondlife.Packets;
7
8namespace libsecondlife.TestClient
9{
10 public class ExportOutfitCommand : Command
11 {
12 public ExportOutfitCommand(TestClient testClient)
13 {
14 Name = "exportoutfit";
15 Description = "Exports an avatars outfit to an xml file. Usage: exportoutfit avataruuid outputfile.xml";
16 }
17
18 public override string Execute(string[] args, LLUUID fromAgentID)
19 {
20 if (args.Length != 2)
21 return "Usage: exportoutfit avataruuid outputfile.xml";
22
23 LLUUID id;
24
25 try
26 {
27 id = new LLUUID(args[0]);
28 }
29 catch (Exception)
30 {
31 return "Usage: exportoutfit avataruuid outputfile.xml";
32 }
33
34 lock (Client.Appearances)
35 {
36 if (Client.Appearances.ContainsKey(id))
37 {
38 try
39 {
40 XmlWriterSettings settings = new XmlWriterSettings();
41 settings.Indent = true;
42 XmlWriter writer = XmlWriter.Create(args[1], settings);
43 try
44 {
45 Client.Appearances[id].ToXml(writer);
46 }
47 finally
48 {
49 writer.Close();
50 }
51 }
52 catch (Exception e)
53 {
54 return e.ToString();
55 }
56
57 return "Exported appearance for avatar " + id.ToString() + " to " + args[1];
58 }
59 else
60 {
61 return "Couldn't find an appearance for avatar " + id.ToString();
62 }
63 }
64 }
65 }
66} \ No newline at end of file