aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs69
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs16
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolder.cs20
3 files changed, 78 insertions, 27 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 3866e21..c08bef2 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -137,6 +137,16 @@ namespace OpenSim.Framework.Communications.Caches
137 return asset; 137 return asset;
138 } 138 }
139 139
140 public AssetBase GetAsset(LLUUID assetID, bool isTexture)
141 {
142 AssetBase asset = GetAsset(assetID);
143 if (asset == null)
144 {
145 this._assetServer.RequestAsset(assetID, isTexture);
146 }
147 return asset;
148 }
149
140 public void AddAsset(AssetBase asset) 150 public void AddAsset(AssetBase asset)
141 { 151 {
142 // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); 152 // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
@@ -241,44 +251,51 @@ namespace OpenSim.Framework.Communications.Caches
241 if (IsTexture) 251 if (IsTexture)
242 { 252 {
243 // Console.WriteLine("asset recieved from asset server"); 253 // Console.WriteLine("asset recieved from asset server");
254
244 TextureImage image = new TextureImage(asset); 255 TextureImage image = new TextureImage(asset);
245 this.Textures.Add(image.FullID, image); 256 if (!this.Textures.ContainsKey(image.FullID))
246 if (this.RequestedTextures.ContainsKey(image.FullID))
247 { 257 {
248 AssetRequest req = this.RequestedTextures[image.FullID]; 258 this.Textures.Add(image.FullID, image);
249 req.ImageInfo = image; 259 if (this.RequestedTextures.ContainsKey(image.FullID))
250 if (image.Data.LongLength > 600)
251 {
252 //over 600 bytes so split up file
253 req.NumPackets = 1 + (int)(image.Data.Length - 600 ) / 1000;
254 }
255 else
256 { 260 {
257 req.NumPackets = 1; 261 AssetRequest req = this.RequestedTextures[image.FullID];
262 req.ImageInfo = image;
263 if (image.Data.LongLength > 600)
264 {
265 //over 600 bytes so split up file
266 req.NumPackets = 1 + (int)(image.Data.Length - 600) / 1000;
267 }
268 else
269 {
270 req.NumPackets = 1;
271 }
272 this.RequestedTextures.Remove(image.FullID);
273 this.TextureRequests.Add(req);
258 } 274 }
259 this.RequestedTextures.Remove(image.FullID);
260 this.TextureRequests.Add(req);
261 } 275 }
262 } 276 }
263 else 277 else
264 { 278 {
265 AssetInfo assetInf = new AssetInfo(asset); 279 AssetInfo assetInf = new AssetInfo(asset);
266 this.Assets.Add(assetInf.FullID, assetInf); 280 if (!this.Assets.ContainsKey(assetInf.FullID))
267 if (this.RequestedAssets.ContainsKey(assetInf.FullID))
268 { 281 {
269 AssetRequest req = this.RequestedAssets[assetInf.FullID]; 282 this.Assets.Add(assetInf.FullID, assetInf);
270 req.AssetInf = assetInf; 283 if (this.RequestedAssets.ContainsKey(assetInf.FullID))
271 if (assetInf.Data.LongLength > 600)
272 {
273 //over 600 bytes so split up file
274 req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
275 }
276 else
277 { 284 {
278 req.NumPackets = 1; 285 AssetRequest req = this.RequestedAssets[assetInf.FullID];
286 req.AssetInf = assetInf;
287 if (assetInf.Data.LongLength > 600)
288 {
289 //over 600 bytes so split up file
290 req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
291 }
292 else
293 {
294 req.NumPackets = 1;
295 }
296 this.RequestedAssets.Remove(assetInf.FullID);
297 this.AssetRequests.Add(req);
279 } 298 }
280 this.RequestedAssets.Remove(assetInf.FullID);
281 this.AssetRequests.Add(req);
282 } 299 }
283 } 300 }
284 } 301 }
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 9970d80..ddb5658 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -105,13 +105,27 @@ namespace OpenSim.Framework.Communications.Caches
105 } 105 }
106 } 106 }
107 107
108 public void updateItem(LLUUID userID, InventoryItemBase itemInfo) 108 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
109 { 109 {
110 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 110 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
111 { 111 {
112 this.m_parentCommsManager.InventoryServer.AddNewInventoryItem(userID, itemInfo); 112 this.m_parentCommsManager.InventoryServer.AddNewInventoryItem(userID, itemInfo);
113 } 113 }
114 } 114 }
115
116 public bool DeleteItem(LLUUID userID, InventoryItemBase item)
117 {
118 bool result = false;
119 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null))
120 {
121 result = RootFolder.DeleteItem(item.inventoryID);
122 if (result)
123 {
124 this.m_parentCommsManager.InventoryServer.DeleteInventoryItem(userID, item);
125 }
126 }
127 return result;
128 }
115 } 129 }
116 130
117 131
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
index 6b0e2b4..34f83db 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
@@ -90,6 +90,26 @@ namespace OpenSim.Framework.Communications.Caches
90 return base2; 90 return base2;
91 } 91 }
92 92
93 public bool DeleteItem(LLUUID itemID)
94 {
95 bool found = false;
96 if (this.Items.ContainsKey(itemID))
97 {
98 Items.Remove(itemID);
99 return true;
100 }
101 foreach (InventoryFolder folder in this.SubFolders.Values)
102 {
103 found = folder.DeleteItem(itemID);
104 if (found == true)
105 {
106 break;
107 }
108 }
109 return found;
110 }
111
112
93 public InventoryFolder HasSubFolder(LLUUID folderID) 113 public InventoryFolder HasSubFolder(LLUUID folderID)
94 { 114 {
95 InventoryFolder returnFolder = null; 115 InventoryFolder returnFolder = null;