Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="transferRequest"></param>
        public void AddAssetRequest(SimClient userInfo, TransferRequestPacket transferRequest)
        {
            LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0);
            //check to see if asset is in local cache, if not we need to request it from asset server.
            if (!this.Assets.ContainsKey(requestID))
            {
                //not found asset
                // so request from asset server
                if (!this.RequestedAssets.ContainsKey(requestID))
                {
                    AssetRequest request = new AssetRequest();
                    request.RequestUser = userInfo;
                    request.RequestAssetID = requestID;
                    request.TransferRequestID = transferRequest.TransferInfo.TransferID;
                    this.RequestedAssets.Add(requestID, request);
                    this._assetServer.RequestAsset(requestID, false);
                }
                return;
            }
            //it is in our cache
             AssetInfo asset = this.Assets[requestID];

            //work out how many packets it  should be sent in
            // and add to the AssetRequests list
            AssetRequest req = new AssetRequest();
            req.RequestUser = userInfo;
            req.RequestAssetID = requestID;
            req.TransferRequestID = transferRequest.TransferInfo.TransferID;
            req.AssetInf = asset;

            if (asset.Data.LongLength > 600)
            {
                //over 600 bytes so split up file
                req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000;
            }
            else
            {
                req.NumPackets = 1;
            }

            this.AssetRequests.Add(req);
        }