public UUID FindObjectByPath(UUID baseFolder, UUID inventoryOwner, string path, int timeoutMS)
{
AutoResetEvent findEvent = new AutoResetEvent(false);
UUID foundItem = UUID.Zero;
FindObjectByPathCallback callback =
delegate(string thisPath, UUID inventoryObjectID)
{
if (thisPath == path)
{
foundItem = inventoryObjectID;
findEvent.Set();
}
};
OnFindObjectByPath += callback;
RequestFindObjectByPath(baseFolder, inventoryOwner, path);
findEvent.WaitOne(timeoutMS, false);
OnFindObjectByPath -= callback;
return foundItem;
}