2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2008-07-21 21:12:59 +00:00
|
|
|
using OpenMetaverse;
|
|
|
|
|
using OpenMetaverse.Packets;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
public class ExportOutfitCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public ExportOutfitCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "exportoutfit";
|
2007-11-06 09:26:10 +00:00
|
|
|
Description = "Exports an avatars outfit to an xml file. Usage: exportoutfit [avataruuid] outputfile.xml";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Inventory;
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2008-07-25 05:15:05 +00:00
|
|
|
UUID id;
|
2007-11-06 09:26:10 +00:00
|
|
|
string path;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-11-06 09:26:10 +00:00
|
|
|
if (args.Length == 1)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2007-11-06 09:26:10 +00:00
|
|
|
id = Client.Self.AgentID;
|
|
|
|
|
path = args[0];
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
2007-11-06 09:26:10 +00:00
|
|
|
else if (args.Length == 2)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2008-07-25 05:15:05 +00:00
|
|
|
if (!UUID.TryParse(args[0], out id))
|
2007-11-06 09:26:10 +00:00
|
|
|
return "Usage: exportoutfit [avataruuid] outputfile.xml";
|
|
|
|
|
path = args[1];
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
2007-11-06 09:26:10 +00:00
|
|
|
else
|
|
|
|
|
return "Usage: exportoutfit [avataruuid] outputfile.xml";
|
2007-04-28 20:54:02 +00:00
|
|
|
|
|
|
|
|
lock (Client.Appearances)
|
|
|
|
|
{
|
|
|
|
|
if (Client.Appearances.ContainsKey(id))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2007-11-30 03:55:08 +00:00
|
|
|
File.WriteAllText(path, Packet.ToXmlString(Client.Appearances[id]));
|
2007-04-28 20:54:02 +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-01-04 05:41:23 +00:00
|
|
|
}
|