當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。