ObjectsAvatars and ObjectsPrimitives are now ConcurrentDictionary to avoid a rather nasty locking bottleneck.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
@@ -15,44 +15,47 @@ namespace OpenMetaverse.TestClient
|
||||
public override string Execute(string[] args, UUID fromAgentID)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
return "Usage: objectinventory [objectID]";
|
||||
|
||||
uint objectLocalID;
|
||||
UUID objectID;
|
||||
if (!UUID.TryParse(args[0], out objectID))
|
||||
return "Usage: objectinventory [objectID]";
|
||||
|
||||
Primitive found = Client.Network.CurrentSim.ObjectsPrimitives.Find(prim => prim.ID == objectID);
|
||||
if (found != null)
|
||||
objectLocalID = found.LocalID;
|
||||
else
|
||||
return "Couldn't find prim " + objectID;
|
||||
|
||||
List<InventoryBase> items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, TimeSpan.FromSeconds(30));
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
string result = string.Empty;
|
||||
return "Usage: objectinventory [objectID]";
|
||||
}
|
||||
|
||||
foreach (var i in items)
|
||||
if (!UUID.TryParse(args[0], out var objectID))
|
||||
{
|
||||
return "Usage: objectinventory [objectID]";
|
||||
}
|
||||
|
||||
var found = Client.Network.CurrentSim.ObjectsPrimitives.FirstOrDefault(prim => prim.Value.ID == objectID);
|
||||
if (found.Value == null)
|
||||
{
|
||||
return $"Could not find ${objectID} object";
|
||||
}
|
||||
|
||||
var objectLocalID = found.Value.LocalID;
|
||||
|
||||
var items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, TimeSpan.FromSeconds(30));
|
||||
|
||||
if (items == null)
|
||||
{
|
||||
return $"Failed to download task inventory for {objectLocalID}";
|
||||
}
|
||||
|
||||
var result = string.Empty;
|
||||
|
||||
foreach (var i in items)
|
||||
{
|
||||
if (i is InventoryFolder)
|
||||
{
|
||||
if (i is InventoryFolder)
|
||||
{
|
||||
result += $"[Folder] Name: {i.Name}" + Environment.NewLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryItem item = (InventoryItem)i;
|
||||
result += $"[Item] Name: {item.Name} Desc: {item.Description} Type: {item.AssetType}" + Environment.NewLine;
|
||||
}
|
||||
result += $"[Folder] Name: {i.Name}" + Environment.NewLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryItem item = (InventoryItem)i;
|
||||
result += $"[Item] Name: {item.Name} Desc: {item.Description} Type: {item.AssetType}" + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Failed to download task inventory for " + objectLocalID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user