2007-05-08 00:10:04 +00:00
|
|
|
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
|
|
|
|
{
|
2007-05-13 19:46:09 +00:00
|
|
|
StreamWriter Outfile = File.AppendText(args[1]);
|
|
|
|
|
|
|
|
|
2007-05-08 00:10:04 +00:00
|
|
|
try
|
|
|
|
{
|
2007-05-13 19:46:09 +00:00
|
|
|
Outfile.Write(Client.Appearances[id].ToString());
|
|
|
|
Console.WriteLine(Client.Appearances[id].ToString());
|
|
|
|
//Client.Appearances[id].ToXml(writer);
|
2007-05-08 00:10:04 +00:00
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
2007-05-13 19:46:09 +00:00
|
|
|
Outfile.Close();
|
2007-05-08 00:10:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-05-13 19:46:09 +00:00
|
|
|
}
|