Пример #1
0
 public AssetInfo CloneAsset(LLUUID newOwner, AssetInfo sourceAsset)
 {
     AssetInfo newAsset = new AssetInfo();
     newAsset.Data = new byte[sourceAsset.Data.Length];
     Array.Copy(sourceAsset.Data, newAsset.Data, sourceAsset.Data.Length);
     newAsset.FullID = LLUUID.Random();
     newAsset.Type = sourceAsset.Type;
     newAsset.InvType = sourceAsset.InvType;
     return (newAsset);
 }
Пример #2
0
 public void AddAsset(AssetBase asset)
 {
     if (asset.Type == 0)
     {
         if (!this.Textures.ContainsKey(asset.FullID))
         { //texture
             TextureImage textur = new TextureImage(asset);
             this.Textures.Add(textur.FullID, textur);
             this._assetServer.UploadNewAsset(asset);
         }
     }
     else
     {
         if (!this.Assets.ContainsKey(asset.FullID))
         {
             AssetInfo assetInf = new AssetInfo(asset);
             this.Assets.Add(assetInf.FullID, assetInf);
             this._assetServer.UploadNewAsset(asset);
         }
     }
 }
Пример #3
0
 public void AssetReceived(AssetBase asset, bool IsTexture)
 {
     if (asset.FullID != LLUUID.Zero)  // if it is set to zero then the asset wasn't found by the server
     {
         //check if it is a texture or not
         //then add to the correct cache list
         //then check for waiting requests for this asset/texture (in the Requested lists)
         //and move those requests into the Requests list.
         if (IsTexture)
         {
             TextureImage image = new TextureImage(asset);
             this.Textures.Add(image.FullID, image);
             if (this.RequestedTextures.ContainsKey(image.FullID))
             {
                 AssetRequest req = this.RequestedTextures[image.FullID];
                 req.ImageInfo = image;
                 if (image.Data.LongLength > 600)
                 {
                     //over 600 bytes so split up file
                     req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000;
                 }
                 else
                 {
                     req.NumPackets = 1;
                 }
                 this.RequestedTextures.Remove(image.FullID);
                 this.TextureRequests.Add(req);
             }
         }
         else
         {
             AssetInfo assetInf = new AssetInfo(asset);
             this.Assets.Add(assetInf.FullID, assetInf);
             if (this.RequestedAssets.ContainsKey(assetInf.FullID))
             {
                 AssetRequest req = this.RequestedAssets[assetInf.FullID];
                 req.AssetInf = assetInf;
                 if (assetInf.Data.LongLength > 600)
                 {
                     //over 600 bytes so split up file
                     req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
                 }
                 else
                 {
                     req.NumPackets = 1;
                 }
                 this.RequestedAssets.Remove(assetInf.FullID);
                 this.AssetRequests.Add(req);
             }
         }
     }
 }