当前位置: 首页>>代码示例>>C#>>正文


C# IInventoryService.CreateUserInventory方法代码示例

本文整理汇总了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);
        }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:37,代码来源:InventoryArchiveUtils.cs

示例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);
        }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:33,代码来源:InventoryArchiveUtils.cs


注:本文中的IInventoryService.CreateUserInventory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。