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


C# Framework.InventoryFolderBase类代码示例

本文整理汇总了C#中OpenSim.Framework.InventoryFolderBase的典型用法代码示例。如果您正苦于以下问题:C# InventoryFolderBase类的具体用法?C# InventoryFolderBase怎么用?C# InventoryFolderBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InventoryFolderBase类属于OpenSim.Framework命名空间,在下文中一共展示了InventoryFolderBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestBasicCreateFolder

        public void TestBasicCreateFolder()
        {
            UUID userId = UUID.Random();

            InventoryFolderBase folder = new InventoryFolderBase();
            folder.ID = UUID.Random();
            folder.Name = "Test Root 1";
            folder.Level = InventoryFolderBase.FolderLevel.Root;
            folder.Owner = userId;
            folder.ParentID = UUID.Zero;
            folder.Type = 1;

            _storage.CreateFolder(folder);

            List<InventoryFolderBase> skel = _storage.GetInventorySkeleton(userId);
            Assert.IsTrue(skel.Count == 1);
            Assert.AreEqual(skel[0].ID, folder.ID);

            InventoryFolderBase folderCopy = _storage.GetFolderAttributes(folder.ID);
            AssertFolderEqual(folder, folderCopy, true);
            Assert.AreEqual(1, folderCopy.Version);

            _storage.SaveFolder(folderCopy);

            InventoryFolderBase folderCopy2 = _storage.GetFolderAttributes(folder.ID);
            AssertFolderEqual(folder, folderCopy2, true);
            Assert.AreEqual(2, folderCopy2.Version);
        }
开发者ID:emperorstarfinder,项目名称:halcyon,代码行数:28,代码来源:UnitTests.cs

示例2: CreateUserRootFolder

        public virtual bool CreateUserRootFolder(UUID principalID)
        {
            bool result = false;

            InventoryFolderBase rootFolder = GetRootFolder(principalID);

            if (rootFolder == null)
            {
                List<InventoryFolderBase> rootFolders = GetInventorySkeleton(principalID);
                if (rootFolders.Count == 0)
                    rootFolder = CreateFolder(principalID, UUID.Zero, (int) AssetType.RootFolder, "My Inventory");
                else
                {
                    rootFolder = new InventoryFolderBase
                                     {
                                         Name = "My Inventory",
                                         Type = (short) AssetType.RootFolder,
                                         Version = 1,
                                         ID = rootFolders[0].ParentID,
                                         Owner = principalID,
                                         ParentID = UUID.Zero
                                     };


                    m_Database.StoreFolder(rootFolder);
                }
                result = true;
            }
            return result;
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:30,代码来源:InventoryService.cs

示例3: CreateFolder

        public void CreateFolder(UUID userId, InventoryFolderBase folder)
        {
            if (folder.Owner != userId)
            {
                throw new InventorySecurityException(String.Format("Not creating folder {0} for user {1}. User does not own the folder", folder.ID, userId));
            }

            _storage.CreateFolder(folder);
        }
开发者ID:BogusCurry,项目名称:halcyon,代码行数:9,代码来源:CheckedInventoryStorage.cs

示例4: GetInventorySkeleton

 /// <summary>
 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
 {
     List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
     InventoryFolderBase folder = new InventoryFolderBase();
     folder.ID = UUID.Random();
     folder.Owner = userId;
     folders.Add(folder);
     return folders;
 }
开发者ID:Ideia-Boa,项目名称:Diva-s-OpenSim-Tests,代码行数:14,代码来源:TestInventoryService.cs

示例5: InventoryFolderImpl

 // Constructors
 public InventoryFolderImpl(InventoryFolderBase folderbase)
 {
     Owner = folderbase.Owner;
     ID = folderbase.ID;
     Name = folderbase.Name;
     ParentID = folderbase.ParentID;
     Type = folderbase.Type;
     Version = folderbase.Version;
 }
开发者ID:ChrisD,项目名称:opensim,代码行数:10,代码来源:InventoryFolderImpl.cs

示例6: Cache

 public void Cache(UUID userID, AssetType type, InventoryFolderBase folder)
 {
     lock (m_FolderTypes)
     {
         Dictionary<AssetType, InventoryFolderBase> ff = null;
         if (!m_FolderTypes.TryGetValue(userID, out ff))
         {
             ff = new Dictionary<AssetType, InventoryFolderBase>();
             m_FolderTypes.Add(userID, ff, CACHE_EXPIRATION_SECONDS);
         }
         if (!ff.ContainsKey(type))
             ff.Add(type, folder);
     }
 }
开发者ID:JAllard,项目名称:opensim,代码行数:14,代码来源:InventoryCache.cs

示例7: AddFolder

        public bool AddFolder(InventoryFolderBase folder)
        {
            Dictionary<string,object> ret = MakeRequest("ADDFOLDER",
                    new Dictionary<string,object> {
                        { "ParentID", folder.ParentID.ToString() },
                        { "Type", folder.Type.ToString() },
                        { "Version", folder.Version.ToString() },
                        { "Name", folder.Name.ToString() },
                        { "Owner", folder.Owner.ToString() },
                        { "ID", folder.ID.ToString() }
                    });

            return CheckReturn(ret);
        }
开发者ID:emperorstarfinder,项目名称:arribasim-dev-extras,代码行数:14,代码来源:XInventoryServicesConnector.cs

示例8: 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:Ideia-Boa,项目名称:diva-distribution,代码行数:28,代码来源:UserInventoryTestUtils.cs

示例9: Cache

        public void Cache(UUID userID, AssetType type, InventoryFolderBase folder)
        {
            ThreadedClasses.RwLockedDictionary<AssetType, InventoryFolderBase> ff = null;
            ff = m_FolderTypes.GetOrAdd(userID, delegate()
            {
                return new ThreadedClasses.RwLockedDictionary<AssetType, InventoryFolderBase>();
            }, CACHE_EXPIRATION_SECONDS);

            try
            {
                ff.Add(type, folder);
            }
            catch
            {

            }
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:17,代码来源:InventoryCache.cs

示例10: Cache

        public void Cache(UUID userID, AssetType type, InventoryFolderBase folder)
        {
            Dictionary<AssetType, InventoryFolderBase> ff = null;
            if (!m_FolderTypes.TryGetValue(userID, out ff))
            {
                ff = new Dictionary<AssetType, InventoryFolderBase>();
                m_FolderTypes.Add(userID, ff, CACHE_EXPIRATION_SECONDS);
            }

            // We need to lock here since two threads could potentially retrieve the same dictionary
            // and try to add a folder for that type simultaneously.  Dictionary<>.Add() is not described as thread-safe in the SDK
            // even if the folders are identical.
            lock (ff)
            {
                if (!ff.ContainsKey(type))
                    ff.Add(type, folder);
            }
        }
开发者ID:AkiraSonoda,项目名称:akisim,代码行数:18,代码来源:InventoryCache.cs

示例11: PurgeFolder

        public virtual bool PurgeFolder(InventoryFolderBase folder)
        {
            if (!m_AllowDelete)
                return false;

            if (!ParentIsTrash(folder.ID))
                return false;

            XInventoryFolder[] subFolders = m_Database.GetFolders(
                    new string[] { "parentFolderID" },
                    new string[] { folder.ID.ToString() });

            foreach (XInventoryFolder x in subFolders)
            {
                PurgeFolder(ConvertToOpenSim(x));
                m_Database.DeleteFolders("folderID", x.folderID.ToString());
            }

            m_Database.DeleteItems("parentFolderID", folder.ID.ToString());

            return true;
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:22,代码来源:XInventoryService.cs

示例12: DeleteFolders

        // We don't check the principal's ID here
        //
        public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
        {
            if (!m_AllowDelete)
                return false;

            // Ignore principal ID, it's bogus at connector level
            //
            foreach (UUID id in folderIDs)
            {
                if (!ParentIsTrash(id))
                    continue;
                InventoryFolderBase f = new InventoryFolderBase();
                f.ID = id;
                PurgeFolder(f);
                m_Database.DeleteFolders("folderID", id.ToString());
            }

            return true;
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:21,代码来源:XInventoryService.cs

示例13: MoveFolder

        public virtual bool MoveFolder(InventoryFolderBase folder)
        {
            XInventoryFolder[] x = m_Database.GetFolders(
                    new string[] { "folderID" },
                    new string[] { folder.ID.ToString() });

            if (x.Length == 0)
                return false;

            x[0].parentFolderID = folder.ParentID;

            return m_Database.StoreFolder(x[0]);
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:13,代码来源:XInventoryService.cs

示例14: UpdateFolder

        public virtual bool UpdateFolder(InventoryFolderBase folder)
        {
            XInventoryFolder xFolder = ConvertFromOpenSim(folder);
            InventoryFolderBase check = GetFolder(folder);
            if (check == null)
                return AddFolder(folder);

            if (check.Type != -1 || xFolder.type != -1)
            {
                if (xFolder.version > check.Version)
                    return false;
                check.Version = (ushort)xFolder.version;
                xFolder = ConvertFromOpenSim(check);
                return m_Database.StoreFolder(xFolder);
            }

            if (xFolder.version < check.Version)
                xFolder.version = check.Version;
            xFolder.folderID = check.ID;

            return m_Database.StoreFolder(xFolder);
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:22,代码来源:XInventoryService.cs

示例15: AddFolder

        public virtual bool AddFolder(InventoryFolderBase folder)
        {
            InventoryFolderBase check = GetFolder(folder);
            if (check != null)
                return false;

            XInventoryFolder xFolder = ConvertFromOpenSim(folder);
            return m_Database.StoreFolder(xFolder);
        }
开发者ID:shangcheng,项目名称:Aurora,代码行数:9,代码来源:XInventoryService.cs


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