2007-04-28 20:54:02 +00:00
using System ;
using System.Collections.Generic ;
using System.IO ;
using System.Text ;
using System.Threading ;
using System.Xml ;
using System.Xml.Serialization ;
using libsecondlife ;
using libsecondlife.Packets ;
using libsecondlife.InventorySystem ;
namespace libsecondlife.TestClient
{
public class WearCommand : Command
{
2007-07-11 09:17:46 +00:00
public WearCommand ( TestClient testClient )
2007-04-28 20:54:02 +00:00
{
2007-07-11 09:17:46 +00:00
Client = testClient ;
2007-04-28 20:54:02 +00:00
Name = "wear" ;
2007-05-12 01:42:28 +00:00
Description = "Wear an outfit folder from inventory. Usage: wear [outfit name]" ;
2007-04-28 20:54:02 +00:00
}
public override string Execute ( string [ ] args , LLUUID fromAgentID )
{
2007-05-12 01:42:28 +00:00
string target = String . Empty ;
2007-07-11 09:17:46 +00:00
bool oldcode = false ;
2007-04-28 20:54:02 +00:00
2007-05-12 01:42:28 +00:00
for ( int ct = 0 ; ct < args . Length ; ct + + )
2007-07-11 09:17:46 +00:00
{
if ( args [ ct ] = = "oldcode" )
oldcode = true ;
else
target = target + args [ ct ] + " " ;
}
2007-05-12 01:42:28 +00:00
target = target . TrimEnd ( ) ;
2007-04-28 20:54:02 +00:00
2007-05-12 01:42:28 +00:00
InventoryFolder folder = Client . Inventory . getFolder ( target ) ;
if ( folder ! = null )
{
2007-07-11 09:17:46 +00:00
//libsecondlife.Utilities.Appearance.AppearanceManager am = new libsecondlife.Utilities.Appearance.AppearanceManager(Client, new Utilities.Assets.AssetManager(Client));
if ( oldcode )
Client . Appearance . WearOutfit ( folder ) ;
else
Client . NewAppearanceManager . WearOutfit ( folder ) ;
2007-05-12 01:42:28 +00:00
return "Outfit " + target + " worn." ;
}
2007-04-28 20:54:02 +00:00
2007-05-12 01:42:28 +00:00
return "Unable to find: " + target ;
2007-04-28 20:54:02 +00:00
}
2007-05-12 01:42:28 +00:00
}
}