private void CreateAsset(assets asset)
        {
            AssetFlags flags       = (AssetFlags)asset.assetflags;
            AssetType  type        = (AssetType)asset.assetType;
            string     contentType = LLUtil.SLAssetTypeToContentType((int)type);
            bool       isPublic    = true;

            // Don't bother copying map tiles, garbage-collectibe, or temporary assets
            if ((flags & AssetFlags.Maptile) == AssetFlags.Maptile ||
                (flags & AssetFlags.Collectable) == AssetFlags.Collectable ||
                asset.temporary != 0)
            {
                return;
            }

            // Distinguish public and private assets
            switch (type)
            {
            case AssetType.CallingCard:
            case AssetType.Gesture:
            case AssetType.LSLBytecode:
            case AssetType.LSLText:
                isPublic = false;
                break;
            }

            object[] args = new object[] { asset.id, asset.CreatorID, isPublic, asset.name, contentType, asset.data };

            m_semaphore.WaitOne();
            ThreadPool.QueueUserWorkItem(DoCreateAsset, args);
        }
        /// <summary>
        /// Sets the flags associated with the specified asset.
        /// </summary>
        /// <param name="asset">The asset identifier of the asset for which to retrieve flags.</param>
        /// <param name="flags">A collection of <see cref="AssetFlags"/> value associated with the specified asset.</param>
        /// <returns><see langword="true"/> if the specified asset has flags defined within this
        /// content manager; otherwise, <see langword="false"/>.</returns>
        internal Boolean GetAssetFlags(AssetID asset, out AssetFlags flags)
        {
            Contract.EnsureNotDisposed(this, Disposed);

            lock (SyncObject)
                return(assetFlags.TryGetValue(AssetID.GetAssetPath(asset), out flags));
        }
        /// <summary>
        /// Sets the flags associated with the specified asset.
        /// </summary>
        /// <param name="asset">The asset identifier of the asset for which to set flags.</param>
        /// <param name="flags">A collection of <see cref="AssetFlags"/> values to associate with the specified asset.</param>
        internal void SetAssetFlags(AssetID asset, AssetFlags flags)
        {
            Contract.EnsureNotDisposed(this, Disposed);

            lock (SyncObject)
                assetFlags[AssetID.GetAssetPath(asset)] = flags;
        }
        /// <summary>
        /// Sets the flags associated with the specified asset.
        /// </summary>
        /// <remarks>Please note that, for performance reasons, the content manager's internal cache does not normalize asset paths.
        /// This means that if you reference the same asset by two different but equivalent paths (i.e. "foo/bar" and "foo\\bar"),
        /// each of those paths will represent a <b>separate entry in the cache</b> with <b>separate asset flags</b>.</remarks>
        /// <param name="asset">The asset path of the asset for which to retrieve flags.</param>
        /// <param name="flags">A collection of <see cref="AssetFlags"/> value associated with the specified asset.</param>
        /// <returns><see langword="true"/> if the specified asset has flags defined within this
        /// content manager; otherwise, <see langword="false"/>.</returns>
        internal Boolean GetAssetFlags(String asset, out AssetFlags flags)
        {
            Contract.Require(asset, nameof(asset));
            Contract.EnsureNotDisposed(this, Disposed);

            lock (SyncObject)
                return(assetFlags.TryGetValue(asset, out flags));
        }
        /// <summary>
        /// Sets the flags associated with the specified asset.
        /// </summary>
        /// <remarks>Please note that, for performance reasons, the content manager's internal cache does not normalize asset paths.
        /// This means that if you reference the same asset by two different but equivalent paths (i.e. "foo/bar" and "foo\\bar"),
        /// each of those paths will represent a <b>separate entry in the cache</b> with <b>separate asset flags</b>.</remarks>
        /// <param name="asset">The asset path of the asset for which to set flags.</param>
        /// <param name="flags">A collection of <see cref="AssetFlags"/> values to associate with the specified asset.</param>
        internal void SetAssetFlags(String asset, AssetFlags flags)
        {
            Contract.Require(asset, nameof(asset));
            Contract.EnsureNotDisposed(this, Disposed);

            lock (SyncObject)
                assetFlags[asset] = flags;
        }
Beispiel #6
0
 public AssetMetadata(AssetMetadata copy)
 {
     ID         = copy.ID;
     Local      = copy.Local;
     Temporary  = copy.Temporary;
     Type       = copy.Type;
     Name       = copy.Name;
     Flags      = copy.Flags;
     CreateTime = copy.CreateTime;
     AccessTime = copy.AccessTime;
 }