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();
|
2007-11-06 09:26:10 +00:00
|
|
|
|
|
|
|
|
//Client.Inventory.RequestFolderContents(Client.Inventory.Store.RootFolder.UUID, Client.Self.AgentID,
|
|
|
|
|
// true, true, InventorySortOrder.ByName);
|
|
|
|
|
|
|
|
|
|
//PrintFolder(Inventory.RootNode, result, 0);
|
|
|
|
|
|
|
|
|
|
//return result.ToString();
|
|
|
|
|
|
|
|
|
|
//FIXME:
|
|
|
|
|
return "This function needs a blocking InventoryManager.FolderContents() to work";
|
2007-07-20 08:58:46 +00:00
|
|
|
}
|
2007-11-06 09:26:10 +00:00
|
|
|
|
2007-07-20 08:58:46 +00:00
|
|
|
void PrintFolder(InventoryNode f, StringBuilder result, int indent)
|
|
|
|
|
{
|
2007-11-06 09:26:10 +00:00
|
|
|
foreach ( InventoryNode i in f.Nodes.Values )
|
|
|
|
|
{
|
2007-07-20 08:58:46 +00:00
|
|
|
result.Append(i.Data.Name + "\n");
|
2007-11-06 09:26:10 +00:00
|
|
|
|
|
|
|
|
if ( i.Nodes.Count > 0 )
|
2007-07-20 08:58:46 +00:00
|
|
|
PrintFolder(i, result, indent + 1);
|
|
|
|
|
}
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
2007-11-06 09:26:10 +00:00
|
|
|
|
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
|
|
|
}
|