本文整理汇总了C#中IInventoryService.CreateUserInventory方法的典型用法代码示例。如果您正苦于以下问题:C# IInventoryService.CreateUserInventory方法的具体用法?C# IInventoryService.CreateUserInventory怎么用?C# IInventoryService.CreateUserInventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInventoryService
的用法示例。
在下文中一共展示了IInventoryService.CreateUserInventory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindFolderByPath
/// <summary>
/// Find a folder given a PATH_DELIMITER delimited path starting from a user's root folder
/// </summary>
/// This method does not handle paths that contain multiple delimiters
///
/// FIXME: We have no way of distinguishing folders with the same path
///
/// FIXME: Delimiters which occur in names themselves are not currently escapable.
/// <param name="inventoryService">
/// Inventory service to query
/// </param>
/// <param name="userId">
/// User id to search
/// </param>
/// <param name="path">
/// The path to the required folder.
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
/// </param>
/// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
public static List<InventoryFolderBase> FindFolderByPath(IInventoryService inventoryService, UUID userId, string path)
{
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
if (rootFolder == null)
{
// we don't appear to have any inventory setup yet
if (!inventoryService.CreateUserInventory(userId, true))
return new List<InventoryFolderBase>();
// get the new root folder
rootFolder = inventoryService.GetRootFolder(userId);
if (rootFolder == null)
return new List<InventoryFolderBase>(); // unable to create the root folder??
}
return FindFolderByPath(inventoryService, rootFolder, path);
}
示例2: FindItemByPath
/// <summary>
/// Find an item given a PATH_DELIMITOR delimited path starting from the user's root folder.
/// This method does not handle paths that contain multiple delimiters
/// FIXME: We do not yet handle situations where folders or items have the same name. We could handle this by some
/// XPath like expression
/// FIXME: Delimiters which occur in names themselves are not currently escapable.
/// </summary>
/// <param name="inventoryService">
/// Inventory service to query
/// </param>
/// <param name="userId">
/// The user to search
/// </param>
/// <param name="path">
/// The path to the required item.
/// </param>
/// <returns>null if the item is not found</returns>
public static InventoryItemBase FindItemByPath(
IInventoryService inventoryService, UUID userId, string path)
{
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
if (rootFolder == null)
{
// we don't appear to have any inventory setup yet
if (!inventoryService.CreateUserInventory(userId, true))
return null; // something really wrong
rootFolder = inventoryService.GetRootFolder(userId);
if (rootFolder == null) // really wrong!!
return null;
}
return FindItemByPath(inventoryService, rootFolder, path);
}