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


C# IInventoryService.AddFolder方法代码示例

本文整理汇总了C#中IInventoryService.AddFolder方法的典型用法代码示例。如果您正苦于以下问题:C# IInventoryService.AddFolder方法的具体用法?C# IInventoryService.AddFolder怎么用?C# IInventoryService.AddFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IInventoryService的用法示例。


在下文中一共展示了IInventoryService.AddFolder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateInventoryFolder

        /// <summary>
        /// Create inventory folders starting from a given parent folder
        /// </summary>
        ///
        /// Ignores any existing folders with the same name
        /// 
        /// <param name="inventoryService"></param>
        /// <param name="parentFolder"></param>
        /// <param name="path">
        /// The folders to create.  Multiple folders can be specified on a path delimited by the PATH_DELIMITER
        /// </param>
        /// <returns>
        /// The folder created.  If the path contains multiple folders then the last one created is returned.
        /// </returns>
        public static InventoryFolderBase CreateInventoryFolder(
            IInventoryService inventoryService, InventoryFolderBase parentFolder, string path)
        {
            string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);

            InventoryFolderBase newFolder 
                = new InventoryFolderBase(UUID.Random(), components[0], parentFolder.Owner, parentFolder.ID);
            inventoryService.AddFolder(newFolder);

            if (components.Length > 1)
                return CreateInventoryFolder(inventoryService, newFolder, components[1]);
            else
                return newFolder;
        }
开发者ID:NovaGrid,项目名称:opensim,代码行数:28,代码来源:UserInventoryHelpers.cs

示例2: CreateInventoryFolder

        /// <summary>
        /// Create inventory folders starting from a given parent folder
        /// </summary>
        /// <remarks>
        /// If any stem of the path names folders that already exist then these are not recreated.  This includes the 
        /// final folder.
        /// TODO: May need to make it an option to create duplicate folders.
        /// </remarks>
        /// <param name="inventoryService"></param>
        /// <param name="parentFolder"></param>
        /// <param name="path">
        /// The folder to create.
        /// </param>
        /// <param name="useExistingFolders">
        /// If true, then folders in the path which already the same name are
        /// used.  This applies to the terminal folder as well.  
        /// If false, then all folders in the path are created, even if there is already a folder at a particular
        /// level with the same name.
        /// </param>
        /// <returns>
        /// The folder created.  If the path contains multiple folders then the last one created is returned.
        /// </returns>
        public static InventoryFolderBase CreateInventoryFolder(
            IInventoryService inventoryService, InventoryFolderBase parentFolder, string path, bool useExistingFolders)
        {
            string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);

            InventoryFolderBase folder = null;

            if (useExistingFolders)
                folder = InventoryArchiveUtils.FindFolderByPath(inventoryService, parentFolder, components[0]);

            if (folder == null)
            {
//                Console.WriteLine("Creating folder {0} at {1}", components[0], parentFolder.Name);

                folder 
                    = new InventoryFolderBase(
                        UUID.Random(), components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0);
                
                inventoryService.AddFolder(folder);
            }
//            else
//            {
//                Console.WriteLine("Found existing folder {0}", folder.Name);
//            }

            if (components.Length > 1)
                return CreateInventoryFolder(inventoryService, folder, components[1], useExistingFolders);
            else
                return folder;
        }
开发者ID:rryk,项目名称:omp-server,代码行数:52,代码来源:UserInventoryHelpers.cs

示例3: DoStoreFolderCheck

        private void DoStoreFolderCheck(IClientAPI client)
        {
            bool hasfolder = false;
            List<InventoryFolderBase> m_invbase = new List<InventoryFolderBase> ();
            Scene scene = (Scene)client.Scene;
            inventoryService = scene.InventoryService;
            m_invbase = inventoryService.GetInventorySkeleton (client.AgentId);
            InventoryFolderBase rootFolder = inventoryService.GetRootFolder (client.AgentId);
            InventoryFolderBase folder = new InventoryFolderBase();
            foreach (InventoryFolderBase current in m_invbase) {
                if (current.Name.ToString () == "Web Store Items") {
                    hasfolder = true;
                }
            }
            if (!hasfolder) {
                UUID id = UUID.Random ();
                folder = new InventoryFolderBase (id, "Web Store Items", client.AgentId, 8, rootFolder.ID, rootFolder.Version);
                inventoryService.AddFolder (folder);
            }

            ScenePresence avatar = null;
            if (scene.TryGetScenePresence(client.AgentId, out avatar))
            {
                scene.SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false);
            }
        }
开发者ID:Barosonix,项目名称:Barosonix-Store-Module,代码行数:26,代码来源:StoreModule.cs


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