private void RecursiveCollectSubfoldersAndItems(UUID id, UUID ownerId, List<UUID> allFolders, List<UUID> allItems, C5.HashSet<UUID> rootItems, C5.HashSet<UUID> rootFolders, bool isRoot,
            Dictionary<Guid, InventoryFolderBase> index, StringBuilder debugFolderList)
        {
            if (index == null)
            {
                index = GetFolderIndex(ownerId);
            }

            InventoryFolderBase folder;
            try
            {
                folder = this.GetFolder(id);
            }
            catch (InventoryObjectMissingException)
            {
                //missing a folder is not a fatal exception, it could indicate a corrupted or temporarily
                //inconsistent inventory state. this should not stop the remainder of the collection
                _log.WarnFormat("[Inworldz.Data.Inventory.Cassandra] Found missing folder with subFolder index remaining in parent. Inventory may need subfolder index maintenance.");
                return;
            }
            catch (InventoryStorageException e)
            {
                if (e.InnerException != null && e.InnerException is KeyNotFoundException)
                {
                    //not a fatal exception, it could indicate a corrupted or temporarily
                    //inconsistent inventory state. this should not stop the remainder of the collection
                    _log.WarnFormat("[Inworldz.Data.Inventory.Cassandra] Found corrupt folder with subFolder index remaining in parent. User inventory needs subfolder index maintenance.");
                    return;
                }
                else
                {
                    throw;
                }
            }

            foreach (InventoryItemBase item in folder.Items)
            {
                allItems.Add(item.ID);

                if (isRoot)
                {
                    rootItems.Add(item.ID);
                }

                debugFolderList.AppendLine("I " + item.ID.ToString() + " " + item.Name);
            }

            foreach (InventoryNodeBase subFolder in folder.SubFolders)
            {
                if (subFolder.Owner != ownerId)
                {
                    throw new UnrecoverableInventoryStorageException(
                        String.Format("Changed owner found during recursive folder collection. Folder: {0}, Expected Owner: {1}, Found Owner: {2}",
                        subFolder.ID, ownerId, subFolder.Owner)); ;
                }


                if (SubfolderIsConsistent(subFolder.ID, folder.ID, index))
                {
                    debugFolderList.AppendLine("F " + subFolder.ID.ToString() + " " + subFolder.Name);

                    allFolders.Add(subFolder.ID);

                    if (isRoot)
                    {
                        rootFolders.Add(subFolder.ID);
                    }

                    this.RecursiveCollectSubfoldersAndItems(subFolder.ID, ownerId, allFolders, allItems, rootItems, rootFolders, false, index, debugFolderList);
                }
                else
                {
                    _log.WarnFormat("[Inworldz.Data.Inventory.Cassandra] Not recursing into folder {0} with parent {1}. Index is inconsistent", 
                        subFolder.ID, folder.ID);
                }
            }
        }
示例#2
0
        void GetVirtualMethods( AssemblyCache cache, C5.TreeSet<MethodKey> methods, TypeDefinition type )
        {
            // check the interfaces
            foreach ( TypeReference ifaceRef in type.Interfaces )
            {
                TypeDefinition iface = project.GetTypeDefinition( ifaceRef );

                // if it's not in the project, try to get it via the cache
                if ( iface == null )
                    iface = cache.GetTypeDefinition( ifaceRef );

                // search interface
                if ( iface != null )
                    GetVirtualMethods( cache, methods, iface );
            }

            // check the base type unless it isn't in the project, or we don't have one
            TypeDefinition baseType = project.GetTypeDefinition( type.BaseType );

            // if it's not in the project, try to get it via the cache
            if ( baseType == null )
                baseType = cache.GetTypeDefinition( type.BaseType );

            // search base
            if ( baseType != null )
                GetVirtualMethods( cache, methods, baseType );

            foreach ( MethodDefinition method in type.Methods )
            {
                if ( method.IsVirtual )
                    methods.Add( new MethodKey( method ) );
            }
        }
        private void CollectCreatedAssetIdsFromUserInventory(UUID creatorId, C5.HashSet<UUID> retAssets)
        {
            IInventoryProviderSelector selector = ProviderRegistry.Instance.Get<IInventoryProviderSelector>();
            IInventoryStorage provider = selector.GetProvider(creatorId);

            List<InventoryFolderBase> skel = provider.GetInventorySkeleton(creatorId);
            foreach (InventoryFolderBase folder in skel)
            {
                InventoryFolderBase fullFolder = provider.GetFolder(folder.ID);
                foreach (InventoryItemBase item in fullFolder.Items)
                {
                    if (m_allowedCreatorIds.Contains(item.CreatorIdAsUuid))
                    {
                        retAssets.Add(item.AssetID);
                    }
                }
            }
        }
示例#4
0
        void GetBaseTypes( C5.HashSet<TypeKey> baseTypes, TypeDefinition type )
        {
            // check the interfaces
            foreach ( TypeReference ifaceRef in type.Interfaces )
            {
                TypeDefinition iface = project.GetTypeDefinition( ifaceRef );
                if ( iface != null )
                {
                    GetBaseTypes( baseTypes, iface );
                    baseTypes.Add( new TypeKey( iface ) );
                }
            }

            // check the base type unless it isn't in the project, or we don't have one
            TypeDefinition baseType = project.GetTypeDefinition( type.BaseType );
            if ( baseType != null && baseType.FullName != "System.Object" )
            {
                GetBaseTypes( baseTypes, baseType );
                baseTypes.Add( new TypeKey( baseType ) );
            }
        }