aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/Assets/AssetCache.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.RegionServer/Assets/AssetCache.cs')
-rw-r--r--OpenSim.RegionServer/Assets/AssetCache.cs79
1 files changed, 32 insertions, 47 deletions
diff --git a/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim.RegionServer/Assets/AssetCache.cs
index 4149cb2..c1b3472 100644
--- a/OpenSim.RegionServer/Assets/AssetCache.cs
+++ b/OpenSim.RegionServer/Assets/AssetCache.cs
@@ -123,6 +123,36 @@ namespace OpenSim.Assets
123 return inventorySet; 123 return inventorySet;
124 } 124 }
125 125
126 public AssetBase GetAsset(LLUUID assetID)
127 {
128 AssetBase asset = null;
129 if(this.Textures.ContainsKey(assetID))
130 {
131 asset = this.Textures[assetID];
132 }
133 else if (this.Assets.ContainsKey(assetID))
134 {
135 asset = this.Assets[assetID];
136 }
137 return asset;
138 }
139
140 public void AddAsset(AssetBase asset)
141 {
142 this._assetServer.UploadNewAsset(asset);
143 if (asset.Type == 0)
144 {
145 //texture
146 TextureImage textur = new TextureImage(asset);
147 this.Textures.Add(textur.FullID, textur);
148 }
149 else
150 {
151 AssetInfo assetInf = new AssetInfo(asset);
152 this.Assets.Add(assetInf.FullID, assetInf);
153 }
154 }
155
126 /// <summary> 156 /// <summary>
127 /// 157 ///
128 /// </summary> 158 /// </summary>
@@ -150,7 +180,7 @@ namespace OpenSim.Assets
150 req = (AssetRequest)this.TextureRequests[i]; 180 req = (AssetRequest)this.TextureRequests[i];
151 if (req.PacketCounter != req.NumPackets) 181 if (req.PacketCounter != req.NumPackets)
152 { 182 {
153 183 // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005"))
154 if (req.PacketCounter == 0) 184 if (req.PacketCounter == 0)
155 { 185 {
156 //first time for this request so send imagedata packet 186 //first time for this request so send imagedata packet
@@ -186,7 +216,7 @@ namespace OpenSim.Assets
186 } 216 }
187 else 217 else
188 { 218 {
189 //send imagepacket 219 //send imagepacket
190 //more than one packet so split file up 220 //more than one packet so split file up
191 ImagePacketPacket im = new ImagePacketPacket(); 221 ImagePacketPacket im = new ImagePacketPacket();
192 im.ImageID.Packet = (ushort)req.PacketCounter; 222 im.ImageID.Packet = (ushort)req.PacketCounter;
@@ -461,7 +491,6 @@ namespace OpenSim.Assets
461 { 491 {
462 req.NumPackets = 1; 492 req.NumPackets = 1;
463 } 493 }
464
465 this.TextureRequests.Add(req); 494 this.TextureRequests.Add(req);
466 } 495 }
467 496
@@ -477,50 +506,6 @@ namespace OpenSim.Assets
477 } 506 }
478 #endregion 507 #endregion
479 508
480 #region viewer asset uploading
481 public AssetBase UploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
482 {
483
484 AssetBase asset = null;
485 if (pack.AssetBlock.Type == 0)
486 {
487 if (pack.AssetBlock.AssetData.Length > 0)
488 {
489 //first packet for transaction
490 asset = new AssetBase();
491 asset.FullID = assetID;
492 asset.Type = pack.AssetBlock.Type;
493 asset.InvType = asset.Type;
494 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
495 asset.Data = pack.AssetBlock.AssetData;
496 this._assetServer.UploadNewAsset(asset);
497 TextureImage image = new TextureImage(asset);
498 this.Textures.Add(image.FullID, image);
499 }
500 }
501
502 return asset;
503 }
504
505 /*
506 public AssetBase TransactionComplete(LLUUID transactionID)
507 {
508 AssetBase asset = null;
509 if(this.IncomingAssets.ContainsKey(transactionID))
510 {
511 // not the first packet of this transaction
512 asset = this.IncomingAssets[transactionID];
513 if(asset.Type == 0)
514 {
515 TextureImage image = new TextureImage(asset);
516 this.Textures.Add(image.FullID, image);
517 }
518 }
519 return asset;
520 }*/
521
522 #endregion
523
524 } 509 }
525 510
526 public class AssetRequest 511 public class AssetRequest