Files
libremetaverse/Programs/examples/TestClient/Commands/Inventory/ExportOutfitCommand.cs
Jim Radford 6f11b53860 TC-45 New TestClient command selectobjects - will return a list of objects on a specific parcel owned by the specifed owner
TC-44 New TestClient command ownerprims to display prim counts
TC-43 Overhaul TestClient help menu system

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2000 52acb1d6-8a22-11de-b505-999d5b087335
2008-07-25 08:55:36 +00:00

59 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using OpenMetaverse;
using OpenMetaverse.Packets;
namespace OpenMetaverse.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";
Category = CommandCategory.Inventory;
}
public override string Execute(string[] args, UUID fromAgentID)
{
UUID id;
string path;
if (args.Length == 1)
{
id = Client.Self.AgentID;
path = args[0];
}
else if (args.Length == 2)
{
if (!UUID.TryParse(args[0], out id))
return "Usage: exportoutfit [avataruuid] outputfile.xml";
path = args[1];
}
else
return "Usage: exportoutfit [avataruuid] outputfile.xml";
lock (Client.Appearances)
{
if (Client.Appearances.ContainsKey(id))
{
try
{
File.WriteAllText(path, Packet.ToXmlString(Client.Appearances[id]));
}
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();
}
}
}
}
}