示例#1
0
        public TextureImage CloneImage(LLUUID newOwner, TextureImage source)
        {
            TextureImage newImage = new TextureImage();

            newImage.Data = new byte[source.Data.Length];
            Array.Copy(source.Data, newImage.Data, source.Data.Length);
            //newImage.filename = source.filename;
            newImage.FullID = LLUUID.Random();
            newImage.Name   = source.Name;
            return(newImage);
        }
示例#2
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);
             }
         }
     }
 }
示例#3
0
 public AssetBase[] CreateNewInventorySet(LLUUID agentID)
 {
     AssetBase[] inventorySet = new AssetBase[this.textureList.Length];
     for (int i = 0; i < textureList.Length; i++)
     {
         if (this.Textures.ContainsKey(textureList[i]))
         {
             inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]);
             TextureImage image = new TextureImage(inventorySet[i]);
             this.Textures.Add(image.FullID, image);
             this._assetServer.UploadNewAsset(image); //save the asset to the asset server
         }
     }
     return(inventorySet);
 }
示例#4
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);
         }
     }
 }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="imageID"></param>
        public void AddTextureRequest(SimClient userInfo, LLUUID imageID)
        {
            //check to see if texture is in local cache, if not request from asset server
            if (!this.Textures.ContainsKey(imageID))
            {
                if (!this.RequestedTextures.ContainsKey(imageID))
                {
                    //not is cache so request from asset server
                    AssetRequest request = new AssetRequest();
                    request.RequestUser      = userInfo;
                    request.RequestAssetID   = imageID;
                    request.IsTextureRequest = true;
                    this.RequestedTextures.Add(imageID, request);
                    this._assetServer.RequestAsset(imageID, true);
                }
                return;
            }

            TextureImage imag = this.Textures[imageID];
            AssetRequest req  = new AssetRequest();

            req.RequestUser      = userInfo;
            req.RequestAssetID   = imageID;
            req.IsTextureRequest = true;
            req.ImageInfo        = imag;

            if (imag.Data.LongLength > 600)
            {
                //over 600 bytes so split up file
                req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000;
            }
            else
            {
                req.NumPackets = 1;
            }
            this.TextureRequests.Add(req);
        }
示例#6
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);
         }
     }
 }
示例#7
0
 public AssetBase[] CreateNewInventorySet(LLUUID agentID)
 {
     AssetBase[] inventorySet = new AssetBase[this.textureList.Length];
     for (int i = 0; i < textureList.Length; i++)
     {
         if (this.Textures.ContainsKey(textureList[i]))
         {
             inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]);
             TextureImage image = new TextureImage(inventorySet[i]);
             this.Textures.Add(image.FullID, image);
             this._assetServer.UploadNewAsset(image); //save the asset to the asset server
         }
     }
     return inventorySet;
 }
示例#8
0
 public TextureImage CloneImage(LLUUID newOwner, TextureImage source)
 {
     TextureImage newImage = new TextureImage();
     newImage.Data = new byte[source.Data.Length];
     Array.Copy(source.Data, newImage.Data, source.Data.Length);
     //newImage.filename = source.filename;
     newImage.FullID = LLUUID.Random();
     newImage.Name = source.Name;
     return (newImage);
 }
示例#9
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);
             }
         }
     }
 }