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;
|
|
|
|
|
|
|
|
|
|
namespace libsecondlife.TestClient
|
|
|
|
|
{
|
|
|
|
|
public class InventoryCommand : Command
|
|
|
|
|
{
|
2007-07-20 08:58:46 +00:00
|
|
|
private Inventory Inventory;
|
|
|
|
|
private InventoryManager Manager;
|
|
|
|
|
|
2007-04-28 20:54:02 +00:00
|
|
|
public InventoryCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "i";
|
|
|
|
|
Description = "Prints out inventory.";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Execute(string[] args, LLUUID fromAgentID)
|
|
|
|
|
{
|
2007-07-20 08:58:46 +00:00
|
|
|
|
|
|
|
|
Manager = Client.Inventory;
|
|
|
|
|
Inventory = Manager.Store;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-07-20 08:58:46 +00:00
|
|
|
StringBuilder result = new StringBuilder();
|
|
|
|
|
Client.Inventory.RequestFolderContents(Client.Inventory.Store.RootFolder.UUID, Client.Network.AgentID, true, true, true, InventorySortOrder.ByName);
|
|
|
|
|
//result.Append(Inventory.RootNode.Name);
|
|
|
|
|
PrintFolder(Inventory.RootNode, result, 0);
|
|
|
|
|
return result.ToString();
|
|
|
|
|
}
|
|
|
|
|
void PrintFolder(InventoryNode f, StringBuilder result, int indent)
|
|
|
|
|
{
|
|
|
|
|
foreach ( InventoryNode i in f.Nodes.Values ) {
|
|
|
|
|
result.Append(i.Data.Name + "\n");
|
|
|
|
|
if ( i.Nodes.Count > 0 ) {
|
|
|
|
|
PrintFolder(i, result, indent + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
//void Indent(StringBuilder output, int indenting)
|
|
|
|
|
//{
|
|
|
|
|
// for (int count = 0; count < indenting; count++)
|
|
|
|
|
// {
|
|
|
|
|
// output.Append(" ");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
2007-01-09 04:56:12 +00:00
|
|
|
}
|