Пример #1
0
        /// <summary>
        /// Adds the asset uuid for inspection during the gathering process.
        /// </summary>
        /// <returns><c>true</c>, if for inspection was added, <c>false</c> otherwise.</returns>
        /// <param name="uuid">UUID.</param>
        public bool AddForInspection(UUID uuid)
        {
            if (uuid == UUID.Zero)
            {
                return(false);
            }

            if (FailedUUIDs.Contains(uuid))
            {
                if (UncertainAssetsUUIDs.Contains(uuid))
                {
                    possibleNotAssetCount++;
                }
                else
                {
                    ErrorCount++;
                }
                return(false);
            }
            if (GatheredUuids.ContainsKey(uuid))
            {
                return(false);
            }
            if (m_assetUuidsToInspect.Contains(uuid))
            {
                return(false);
            }

//            m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);

            m_assetUuidsToInspect.Enqueue(uuid);
            return(true);
        }
Пример #2
0
        private void AddForInspection(UUID assetUuid, sbyte assetType)
        {
            if (assetUuid == UUID.Zero)
            {
                return;
            }

            // Here, we want to collect uuids which require further asset fetches but mark the others as gathered
            if (FailedUUIDs.Contains(assetUuid))
            {
                if (UncertainAssetsUUIDs.Contains(assetUuid))
                {
                    possibleNotAssetCount++;
                }
                else
                {
                    ErrorCount++;
                }
                return;
            }
            if (GatheredUuids.ContainsKey(assetUuid))
            {
                return;
            }
            try
            {
                if ((sbyte)AssetType.Bodypart == assetType ||
                    (sbyte)AssetType.Clothing == assetType ||
                    (sbyte)AssetType.Gesture == assetType ||
                    (sbyte)AssetType.Notecard == assetType ||
                    (sbyte)AssetType.LSLText == assetType ||
                    (sbyte)OpenSimAssetType.Material == assetType ||
                    (sbyte)AssetType.Object == assetType)
                {
                    AddForInspection(assetUuid);
                }
                else
                {
                    GatheredUuids[assetUuid] = assetType;
                }
            }
            catch (Exception)
            {
                m_log.ErrorFormat(
                    "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
                    assetUuid, assetType);
                throw;
            }
        }
Пример #3
0
        /// <summary>
        /// Gather all the asset uuids associated with the asset referenced by a given uuid
        /// </summary>
        /// <remarks>
        /// This includes both those directly associated with
        /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained
        /// within this object).
        /// This method assumes that the asset type associated with this asset in persistent storage is correct (which
        /// should always be the case).  So with this method we always need to retrieve asset data even if the asset
        /// is of a type which is known not to reference any other assets
        /// </remarks>
        /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
        private void GetAssetUuids(UUID assetUuid)
        {
            if (assetUuid == UUID.Zero)
            {
                return;
            }

            if (FailedUUIDs.Contains(assetUuid))
            {
                if (UncertainAssetsUUIDs.Contains(assetUuid))
                {
                    possibleNotAssetCount++;
                }
                else
                {
                    ErrorCount++;
                }
                return;
            }

            // avoid infinite loops
            if (GatheredUuids.ContainsKey(assetUuid))
            {
                return;
            }

            AssetBase assetBase;

            try
            {
                assetBase = GetAsset(assetUuid);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[UUID GATHERER]: Failed to get asset {0} : {1}", assetUuid, e.Message);
                ErrorCount++;
                FailedUUIDs.Add(assetUuid);
                return;
            }

            if (assetBase == null)
            {
                FailedUUIDs.Add(assetUuid);
                if (UncertainAssetsUUIDs.Contains(assetUuid))
                {
                    possibleNotAssetCount++;
                }
                else
                {
                    ErrorCount++;
                }
                return;
            }

            if (UncertainAssetsUUIDs.Contains(assetUuid))
            {
                UncertainAssetsUUIDs.Remove(assetUuid);
            }

            sbyte assetType = assetBase.Type;

            if (assetBase.Data == null || assetBase.Data.Length == 0)
            {
                ErrorCount++;
                FailedUUIDs.Add(assetUuid);
                return;
            }

            GatheredUuids[assetUuid] = assetType;
            try
            {
                if ((sbyte)AssetType.Bodypart == assetType || (sbyte)AssetType.Clothing == assetType)
                {
                    RecordWearableAssetUuids(assetBase);
                }
                else if ((sbyte)AssetType.Gesture == assetType)
                {
                    RecordGestureAssetUuids(assetBase);
                }
                else if ((sbyte)AssetType.Notecard == assetType)
                {
                    RecordTextEmbeddedAssetUuids(assetBase);
                }
                else if ((sbyte)AssetType.LSLText == assetType)
                {
                    RecordTextEmbeddedAssetUuids(assetBase);
                }
                else if ((sbyte)OpenSimAssetType.Material == assetType)
                {
                    RecordMaterialAssetUuids(assetBase);
                }
                else if ((sbyte)AssetType.Object == assetType)
                {
                    RecordSceneObjectAssetUuids(assetBase);
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[UUID GATHERER]: Failed to gather uuids for asset with id {0} type {1}: {2}", assetUuid, assetType, e.Message);
                GatheredUuids.Remove(assetUuid);
                ErrorCount++;
                FailedUUIDs.Add(assetUuid);
            }
        }