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 ImportOutfitCommand : Command
|
|
|
|
|
{
|
2007-12-21 02:25:36 +00:00
|
|
|
//private uint SerialNum = 1;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
|
|
|
|
public ImportOutfitCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "importoutfit";
|
|
|
|
|
Description = "Imports an appearance from an xml file. Usage: importoutfit inputfile.xml";
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
if (args.Length != 1)
|
|
|
|
|
return "Usage: importoutfit inputfile.xml";
|
|
|
|
|
|
2007-11-30 03:55:08 +00:00
|
|
|
return "LLSD packet import is under construction";
|
|
|
|
|
|
2007-12-21 02:25:36 +00:00
|
|
|
//try
|
|
|
|
|
//{
|
|
|
|
|
// Packet packet = Packet.FromXmlString((File.ReadAllText(args[0])));
|
|
|
|
|
// if (packet.Type != PacketType.AvatarAppearance)
|
|
|
|
|
// return "Deserialized a " + packet.Type + " packet instead of an AvatarAppearance packet";
|
|
|
|
|
// AvatarAppearancePacket appearance = (AvatarAppearancePacket)packet;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-12-21 02:25:36 +00:00
|
|
|
// AgentSetAppearancePacket set = new AgentSetAppearancePacket();
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-12-21 02:25:36 +00:00
|
|
|
// set.AgentData.AgentID = Client.Self.AgentID;
|
|
|
|
|
// set.AgentData.SessionID = Client.Self.SessionID;
|
|
|
|
|
// set.AgentData.SerialNum = SerialNum++;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-12-21 02:25:36 +00:00
|
|
|
// // HACK: Weak hack to calculate size
|
|
|
|
|
// float AV_Height_Range = 2.025506f - 1.50856f;
|
|
|
|
|
// float AV_Height = 1.50856f + (((float)appearance.VisualParam[25].ParamValue / 255.0f) * AV_Height_Range);
|
|
|
|
|
// set.AgentData.Size = new LLVector3(0.45f, 0.6f, AV_Height);
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-12-21 02:25:36 +00:00
|
|
|
// set.ObjectData.TextureEntry = appearance.ObjectData.TextureEntry;
|
|
|
|
|
// set.VisualParam = new AgentSetAppearancePacket.VisualParamBlock[appearance.VisualParam.Length];
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-12-21 02:25:36 +00:00
|
|
|
// int i = 0;
|
|
|
|
|
// foreach (AvatarAppearancePacket.VisualParamBlock block in appearance.VisualParam)
|
|
|
|
|
// {
|
|
|
|
|
// set.VisualParam[i] = new AgentSetAppearancePacket.VisualParamBlock();
|
|
|
|
|
// set.VisualParam[i].ParamValue = block.ParamValue;
|
|
|
|
|
// i++;
|
|
|
|
|
// }
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-12-21 02:25:36 +00:00
|
|
|
// set.WearableData = new AgentSetAppearancePacket.WearableDataBlock[0];
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-12-21 02:25:36 +00:00
|
|
|
// Client.Network.SendPacket(set);
|
|
|
|
|
//}
|
|
|
|
|
//catch (Exception)
|
|
|
|
|
//{
|
|
|
|
|
// return "Failed to import the appearance XML file, maybe it doesn't exist or is in the wrong format?";
|
|
|
|
|
//}
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-12-21 02:25:36 +00:00
|
|
|
//return "Imported " + args[0] + " and sent an AgentSetAppearance packet";
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|