aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Capabilities
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Framework/Communications/Capabilities
parent* Deleted .user file (diff)
downloadopensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs136
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDArray.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs5
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs7
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs12
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs32
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs5
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs6
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs19
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDTest.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDType.cs10
17 files changed, 113 insertions, 143 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index a114b64..23dfcc6 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -28,18 +28,23 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.IO; 31using System.IO;
33using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console;
35using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
36using OpenSim.Framework;
37 37
38namespace OpenSim.Region.Capabilities 38namespace OpenSim.Region.Capabilities
39{ 39{
40 public delegate void UpLoadedAsset(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType); 40 public delegate void UpLoadedAsset(
41 string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data,
42 string inventoryType, string assetType);
43
41 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); 44 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data);
45
42 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); 46 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
47
43 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); 48 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data);
44 49
45 public class Caps 50 public class Caps
@@ -62,7 +67,8 @@ namespace OpenSim.Region.Capabilities
62 public ItemUpdatedCallback ItemUpdatedCall = null; 67 public ItemUpdatedCallback ItemUpdatedCall = null;
63 private bool m_dumpAssetsToFile; 68 private bool m_dumpAssetsToFile;
64 69
65 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent, bool dumpAssetsToFile) 70 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath,
71 LLUUID agent, bool dumpAssetsToFile)
66 { 72 {
67 assetCache = assetCach; 73 assetCache = assetCach;
68 m_capsObjectPath = capsPath; 74 m_capsObjectPath = capsPath;
@@ -78,12 +84,17 @@ namespace OpenSim.Region.Capabilities
78 /// </summary> 84 /// </summary>
79 public void RegisterHandlers() 85 public void RegisterHandlers()
80 { 86 {
81 OpenSim.Framework.Console.MainLog.Instance.Verbose("CAPS","Registering CAPS handlers"); 87 MainLog.Instance.Verbose("CAPS", "Registering CAPS handlers");
82 string capsBase = "/CAPS/" + m_capsObjectPath; 88 string capsBase = "/CAPS/" + m_capsObjectPath;
83 try 89 try
84 { 90 {
85 httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer)); 91 httpListener.AddStreamHandler(
86 httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); 92 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath,
93 GetMapLayer));
94 httpListener.AddStreamHandler(
95 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
96 capsBase + m_newInventory,
97 NewAgentInventoryRequest));
87 98
88 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); 99 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest);
89 //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture); 100 //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture);
@@ -103,7 +114,7 @@ namespace OpenSim.Region.Capabilities
103 string capsBase = "/CAPS/" + m_capsObjectPath; 114 string capsBase = "/CAPS/" + m_capsObjectPath;
104 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); 115 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod));
105 } 116 }
106 117
107 /// <summary> 118 /// <summary>
108 /// 119 ///
109 /// </summary> 120 /// </summary>
@@ -113,8 +124,8 @@ namespace OpenSim.Region.Capabilities
113 /// <returns></returns> 124 /// <returns></returns>
114 public string CapsRequest(string request, string path, string param) 125 public string CapsRequest(string request, string path, string param)
115 { 126 {
116 // Console.WriteLine("caps request " + request); 127 // Console.WriteLine("caps request " + request);
117 string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); 128 string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities());
118 return result; 129 return result;
119 } 130 }
120 131
@@ -125,9 +136,10 @@ namespace OpenSim.Region.Capabilities
125 protected LLSDCapsDetails GetCapabilities() 136 protected LLSDCapsDetails GetCapabilities()
126 { 137 {
127 LLSDCapsDetails caps = new LLSDCapsDetails(); 138 LLSDCapsDetails caps = new LLSDCapsDetails();
128 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; 139 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" +
140 m_capsObjectPath;
129 caps.MapLayer = capsBaseUrl + m_mapLayerPath; 141 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
130 // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; 142 // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture;
131 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; 143 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
132 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; 144 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
133 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; 145 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath;
@@ -142,7 +154,7 @@ namespace OpenSim.Region.Capabilities
142 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) 154 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
143 { 155 {
144 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); 156 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
145 mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); 157 mapResponse.LayerData.Array.Add(GetLLSDMapLayerResponse());
146 return mapResponse; 158 return mapResponse;
147 } 159 }
148 160
@@ -174,6 +186,7 @@ namespace OpenSim.Region.Capabilities
174 } 186 }
175 187
176 #region EventQueue (Currently not enabled) 188 #region EventQueue (Currently not enabled)
189
177 /// <summary> 190 /// <summary>
178 /// 191 ///
179 /// </summary> 192 /// </summary>
@@ -184,10 +197,10 @@ namespace OpenSim.Region.Capabilities
184 public string ProcessEventQueue(string request, string path, string param) 197 public string ProcessEventQueue(string request, string path, string param)
185 { 198 {
186 string res = ""; 199 string res = "";
187 200
188 if (this.CapsEventQueue.Count > 0) 201 if (CapsEventQueue.Count > 0)
189 { 202 {
190 lock (this.CapsEventQueue) 203 lock (CapsEventQueue)
191 { 204 {
192 string item = CapsEventQueue.Dequeue(); 205 string item = CapsEventQueue.Dequeue();
193 res = item; 206 res = item;
@@ -195,7 +208,7 @@ namespace OpenSim.Region.Capabilities
195 } 208 }
196 else 209 else
197 { 210 {
198 res = this.CreateEmptyEventResponse(); 211 res = CreateEmptyEventResponse();
199 } 212 }
200 return res; 213 return res;
201 } 214 }
@@ -214,8 +227,8 @@ namespace OpenSim.Region.Capabilities
214 eventItem.events.Array.Add(new LLSDEmpty()); 227 eventItem.events.Array.Add(new LLSDEmpty());
215 string res = LLSDHelpers.SerialiseLLSDReply(eventItem); 228 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
216 eventQueueCount++; 229 eventQueueCount++;
217 230
218 this.CapsEventQueue.Enqueue(res); 231 CapsEventQueue.Enqueue(res);
219 return res; 232 return res;
220 } 233 }
221 234
@@ -232,6 +245,7 @@ namespace OpenSim.Region.Capabilities
232 eventQueueCount++; 245 eventQueueCount++;
233 return res; 246 return res;
234 } 247 }
248
235 #endregion 249 #endregion
236 250
237 /// <summary> 251 /// <summary>
@@ -243,24 +257,27 @@ namespace OpenSim.Region.Capabilities
243 /// <returns></returns> 257 /// <returns></returns>
244 public string NoteCardAgentInventory(string request, string path, string param) 258 public string NoteCardAgentInventory(string request, string path, string param)
245 { 259 {
246 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); 260 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request));
247 LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); 261 LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
248 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 262 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
249 263
250 string capsBase = "/CAPS/" + m_capsObjectPath; 264 string capsBase = "/CAPS/" + m_capsObjectPath;
251 LLUUID newInvItem = llsdRequest.item_id; 265 LLUUID newInvItem = llsdRequest.item_id;
252 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 266 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
253 267
254 ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile ); 268 ItemUpdater uploader =
255 uploader.OnUpLoad += this.ItemUpdated; 269 new ItemUpdater(newInvItem, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile);
270 uploader.OnUpLoad += ItemUpdated;
256 271
257 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 272 httpListener.AddStreamHandler(
258 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; 273 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
274 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
275 uploaderPath;
259 276
260 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 277 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
261 uploadResponse.uploader = uploaderURL; 278 uploadResponse.uploader = uploaderURL;
262 uploadResponse.state = "upload"; 279 uploadResponse.state = "upload";
263 280
264 return LLSDHelpers.SerialiseLLSDReply(uploadResponse); 281 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
265 } 282 }
266 283
@@ -272,7 +289,7 @@ namespace OpenSim.Region.Capabilities
272 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) 289 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
273 { 290 {
274 //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type); 291 //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type);
275 292
276 string assetName = llsdRequest.name; 293 string assetName = llsdRequest.name;
277 string assetDes = llsdRequest.description; 294 string assetDes = llsdRequest.description;
278 string capsBase = "/CAPS/" + m_capsObjectPath; 295 string capsBase = "/CAPS/" + m_capsObjectPath;
@@ -281,14 +298,18 @@ namespace OpenSim.Region.Capabilities
281 LLUUID parentFolder = llsdRequest.folder_id; 298 LLUUID parentFolder = llsdRequest.folder_id;
282 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 299 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
283 300
284 AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile); 301 AssetUploader uploader =
285 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 302 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
286 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; 303 llsdRequest.asset_type, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile);
304 httpListener.AddStreamHandler(
305 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
306 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
307 uploaderPath;
287 308
288 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 309 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
289 uploadResponse.uploader = uploaderURL; 310 uploadResponse.uploader = uploaderURL;
290 uploadResponse.state = "upload"; 311 uploadResponse.state = "upload";
291 uploader.OnUpLoad += this.UploadCompleteHandler; 312 uploader.OnUpLoad += UploadCompleteHandler;
292 return uploadResponse; 313 return uploadResponse;
293 } 314 }
294 315
@@ -298,7 +319,9 @@ namespace OpenSim.Region.Capabilities
298 /// <param name="assetID"></param> 319 /// <param name="assetID"></param>
299 /// <param name="inventoryItem"></param> 320 /// <param name="inventoryItem"></param>
300 /// <param name="data"></param> 321 /// <param name="data"></param>
301 public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType) 322 public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID,
323 LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType,
324 string assetType)
302 { 325 {
303 sbyte assType = 0; 326 sbyte assType = 0;
304 sbyte inType = 0; 327 sbyte inType = 0;
@@ -319,14 +342,14 @@ namespace OpenSim.Region.Capabilities
319 asset.FullID = assetID; 342 asset.FullID = assetID;
320 asset.Type = assType; 343 asset.Type = assType;
321 asset.InvType = inType; 344 asset.InvType = inType;
322 asset.Name = assetName; 345 asset.Name = assetName;
323 asset.Data = data; 346 asset.Data = data;
324 this.assetCache.AddAsset(asset); 347 assetCache.AddAsset(asset);
325 348
326 InventoryItemBase item = new InventoryItemBase(); 349 InventoryItemBase item = new InventoryItemBase();
327 item.avatarID = agentID; 350 item.avatarID = agentID;
328 item.creatorsID = agentID; 351 item.creatorsID = agentID;
329 item.inventoryID = inventoryItem; 352 item.inventoryID = inventoryItem;
330 item.assetID = asset.FullID; 353 item.assetID = asset.FullID;
331 item.inventoryDescription = assetDescription; 354 item.inventoryDescription = assetDescription;
332 item.inventoryName = assetName; 355 item.inventoryName = assetName;
@@ -340,14 +363,13 @@ namespace OpenSim.Region.Capabilities
340 { 363 {
341 AddNewInventoryItem(agentID, item); 364 AddNewInventoryItem(agentID, item);
342 } 365 }
343
344 } 366 }
345 367
346 public LLUUID ItemUpdated(LLUUID itemID, byte[] data) 368 public LLUUID ItemUpdated(LLUUID itemID, byte[] data)
347 { 369 {
348 if (ItemUpdatedCall != null) 370 if (ItemUpdatedCall != null)
349 { 371 {
350 return ItemUpdatedCall(this.agentID, itemID, data); 372 return ItemUpdatedCall(agentID, itemID, data);
351 } 373 }
352 return LLUUID.Zero; 374 return LLUUID.Zero;
353 } 375 }
@@ -359,7 +381,7 @@ namespace OpenSim.Region.Capabilities
359 private string uploaderPath = ""; 381 private string uploaderPath = "";
360 private LLUUID newAssetID; 382 private LLUUID newAssetID;
361 private LLUUID inventoryItemID; 383 private LLUUID inventoryItemID;
362 private LLUUID parentFolder; 384 private LLUUID parentFolder;
363 private BaseHttpServer httpListener; 385 private BaseHttpServer httpListener;
364 private bool m_dumpAssetsToFile; 386 private bool m_dumpAssetsToFile;
365 private string m_assetName = ""; 387 private string m_assetName = "";
@@ -368,7 +390,9 @@ namespace OpenSim.Region.Capabilities
368 private string m_invType = ""; 390 private string m_invType = "";
369 private string m_assetType = ""; 391 private string m_assetType = "";
370 392
371 public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer, bool dumpAssetsToFile) 393 public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem,
394 LLUUID parentFolderID, string invType, string assetType, string path,
395 BaseHttpServer httpServer, bool dumpAssetsToFile)
372 { 396 {
373 m_assetName = assetName; 397 m_assetName = assetName;
374 m_assetDes = description; 398 m_assetDes = description;
@@ -391,7 +415,7 @@ namespace OpenSim.Region.Capabilities
391 /// <returns></returns> 415 /// <returns></returns>
392 public string uploaderCaps(byte[] data, string path, string param) 416 public string uploaderCaps(byte[] data, string path, string param)
393 { 417 {
394 LLUUID inv = this.inventoryItemID; 418 LLUUID inv = inventoryItemID;
395 string res = ""; 419 string res = "";
396 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 420 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
397 uploadComplete.new_asset = newAssetID.ToStringHyphenated(); 421 uploadComplete.new_asset = newAssetID.ToStringHyphenated();
@@ -399,29 +423,29 @@ namespace OpenSim.Region.Capabilities
399 uploadComplete.state = "complete"; 423 uploadComplete.state = "complete";
400 424
401 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); 425 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
402 426
403 httpListener.RemoveStreamHandler("POST", uploaderPath); 427 httpListener.RemoveStreamHandler("POST", uploaderPath);
404 428
405 if (this.m_dumpAssetsToFile) 429 if (m_dumpAssetsToFile)
406 { 430 {
407 this.SaveAssetToFile(m_assetName + ".jp2", data); 431 SaveAssetToFile(m_assetName + ".jp2", data);
408 } 432 }
409 433
410 if (OnUpLoad != null) 434 if (OnUpLoad != null)
411 { 435 {
412 OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); 436 OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType);
413 } 437 }
414 438
415 return res; 439 return res;
416 } 440 }
417 441
418 private void SaveAssetToFile(string filename, byte[] data) 442 private void SaveAssetToFile(string filename, byte[] data)
419 { 443 {
420 FileStream fs = File.Create(filename); 444 FileStream fs = File.Create(filename);
421 BinaryWriter bw = new BinaryWriter(fs); 445 BinaryWriter bw = new BinaryWriter(fs);
422 bw.Write(data); 446 bw.Write(data);
423 bw.Close(); 447 bw.Close();
424 fs.Close(); 448 fs.Close();
425 } 449 }
426 } 450 }
427 451
@@ -434,7 +458,7 @@ namespace OpenSim.Region.Capabilities
434 private BaseHttpServer httpListener; 458 private BaseHttpServer httpListener;
435 private bool m_dumpAssetToFile; 459 private bool m_dumpAssetToFile;
436 460
437 public ItemUpdater( LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile) 461 public ItemUpdater(LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile)
438 { 462 {
439 m_dumpAssetToFile = dumpAssetToFile; 463 m_dumpAssetToFile = dumpAssetToFile;
440 464
@@ -452,7 +476,7 @@ namespace OpenSim.Region.Capabilities
452 /// <returns></returns> 476 /// <returns></returns>
453 public string uploaderCaps(byte[] data, string path, string param) 477 public string uploaderCaps(byte[] data, string path, string param)
454 { 478 {
455 LLUUID inv = this.inventoryItemID; 479 LLUUID inv = inventoryItemID;
456 string res = ""; 480 string res = "";
457 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 481 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
458 LLUUID assetID = LLUUID.Zero; 482 LLUUID assetID = LLUUID.Zero;
@@ -461,7 +485,7 @@ namespace OpenSim.Region.Capabilities
461 { 485 {
462 assetID = OnUpLoad(inv, data); 486 assetID = OnUpLoad(inv, data);
463 } 487 }
464 488
465 uploadComplete.new_asset = assetID.ToStringHyphenated(); 489 uploadComplete.new_asset = assetID.ToStringHyphenated();
466 uploadComplete.new_inventory_item = inv; 490 uploadComplete.new_inventory_item = inv;
467 uploadComplete.state = "complete"; 491 uploadComplete.state = "complete";
@@ -470,9 +494,9 @@ namespace OpenSim.Region.Capabilities
470 494
471 httpListener.RemoveStreamHandler("POST", uploaderPath); 495 httpListener.RemoveStreamHandler("POST", uploaderPath);
472 496
473 if (this.m_dumpAssetToFile) 497 if (m_dumpAssetToFile)
474 { 498 {
475 this.SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); 499 SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data);
476 } 500 }
477 501
478 return res; 502 return res;
@@ -488,6 +512,4 @@ namespace OpenSim.Region.Capabilities
488 } 512 }
489 } 513 }
490 } 514 }
491} 515} \ No newline at end of file
492
493
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs
index 2af5a4a..2ed7750 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs
@@ -36,7 +36,6 @@ namespace OpenSim.Region.Capabilities
36 36
37 public LLSDArray() 37 public LLSDArray()
38 { 38 {
39
40 } 39 }
41 } 40 }
42} 41} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs
index e65e741..d054386 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs
@@ -39,7 +39,6 @@ namespace OpenSim.Region.Capabilities
39 39
40 public LLSDAssetUploadComplete() 40 public LLSDAssetUploadComplete()
41 { 41 {
42
43 } 42 }
44 } 43 }
45} 44} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs
index 3a2fe20..7fed27a 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs
@@ -26,9 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 29using libsecondlife;
33 30
34namespace OpenSim.Region.Capabilities 31namespace OpenSim.Region.Capabilities
@@ -46,4 +43,4 @@ namespace OpenSim.Region.Capabilities
46 { 43 {
47 } 44 }
48 } 45 }
49} 46} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs
index c7a9ee6..3ad618d 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs
@@ -26,10 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.Capabilities 29namespace OpenSim.Region.Capabilities
34{ 30{
35 [LLSDMap] 31 [LLSDMap]
@@ -40,7 +36,6 @@ namespace OpenSim.Region.Capabilities
40 36
41 public LLSDAssetUploadResponse() 37 public LLSDAssetUploadResponse()
42 { 38 {
43
44 } 39 }
45 } 40 }
46} 41} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs
index d1894d4..06afac4 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
35 35
36 public LLSDCapEvent() 36 public LLSDCapEvent()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
index 3184792..35caa15 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
@@ -34,18 +34,14 @@ namespace OpenSim.Region.Capabilities
34 public string MapLayer = ""; 34 public string MapLayer = "";
35 public string NewFileAgentInventory = ""; 35 public string NewFileAgentInventory = "";
36 //public string EventQueueGet = ""; 36 //public string EventQueueGet = "";
37 // public string RequestTextureDownload = ""; 37 // public string RequestTextureDownload = "";
38 // public string ChatSessionRequest = ""; 38 // public string ChatSessionRequest = "";
39 public string UpdateNotecardAgentInventory = ""; 39 public string UpdateNotecardAgentInventory = "";
40 public string UpdateScriptAgentInventory = ""; 40 public string UpdateScriptAgentInventory = "";
41 // public string ParcelVoiceInfoRequest = ""; 41 // public string ParcelVoiceInfoRequest = "";
42 42
43 public LLSDCapsDetails() 43 public LLSDCapsDetails()
44 { 44 {
45
46 } 45 }
47 } 46 }
48} 47} \ No newline at end of file
49
50
51
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs
index 0169d3c..69c525c 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs
@@ -32,7 +32,6 @@ namespace OpenSim.Region.Capabilities
32 { 32 {
33 public LLSDEmpty() 33 public LLSDEmpty()
34 { 34 {
35
36 } 35 }
37 } 36 }
38} 37} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
index 8a2215f..8252a63 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Capabilities
51 public static void SerializeLLSDType(XmlTextWriter writer, object obj) 51 public static void SerializeLLSDType(XmlTextWriter writer, object obj)
52 { 52 {
53 Type myType = obj.GetType(); 53 Type myType = obj.GetType();
54 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); 54 LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
55 if (llsdattributes.Length > 0) 55 if (llsdattributes.Length > 0)
56 { 56 {
57 switch (llsdattributes[0].ObjectType) 57 switch (llsdattributes[0].ObjectType)
@@ -62,7 +62,8 @@ namespace OpenSim.Region.Capabilities
62 for (int i = 0; i < fields.Length; i++) 62 for (int i = 0; i < fields.Length; i++)
63 { 63 {
64 object fieldValue = fields[i].GetValue(obj); 64 object fieldValue = fields[i].GetValue(obj);
65 LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); 65 LLSDType[] fieldAttributes =
66 (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false);
66 if (fieldAttributes.Length > 0) 67 if (fieldAttributes.Length > 0)
67 { 68 {
68 writer.WriteStartElement(String.Empty, "key", String.Empty); 69 writer.WriteStartElement(String.Empty, "key", String.Empty);
@@ -83,7 +84,7 @@ namespace OpenSim.Region.Capabilities
83 case "ARRAY": 84 case "ARRAY":
84 // LLSDArray arrayObject = obj as LLSDArray; 85 // LLSDArray arrayObject = obj as LLSDArray;
85 // ArrayList a = arrayObject.Array; 86 // ArrayList a = arrayObject.Array;
86 ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); 87 ArrayList a = (ArrayList) obj.GetType().GetField("Array").GetValue(obj);
87 if (a != null) 88 if (a != null)
88 { 89 {
89 writer.WriteStartElement(String.Empty, "array", String.Empty); 90 writer.WriteStartElement(String.Empty, "array", String.Empty);
@@ -105,7 +106,7 @@ namespace OpenSim.Region.Capabilities
105 public static object DeserialiseLLSDMap(Hashtable llsd, object obj) 106 public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
106 { 107 {
107 Type myType = obj.GetType(); 108 Type myType = obj.GetType();
108 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); 109 LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
109 if (llsdattributes.Length > 0) 110 if (llsdattributes.Length > 0)
110 { 111 {
111 switch (llsdattributes[0].ObjectType) 112 switch (llsdattributes[0].ObjectType)
@@ -114,7 +115,7 @@ namespace OpenSim.Region.Capabilities
114 IDictionaryEnumerator enumerator = llsd.GetEnumerator(); 115 IDictionaryEnumerator enumerator = llsd.GetEnumerator();
115 while (enumerator.MoveNext()) 116 while (enumerator.MoveNext())
116 { 117 {
117 FieldInfo field = myType.GetField((string)enumerator.Key); 118 FieldInfo field = myType.GetField((string) enumerator.Key);
118 if (field != null) 119 if (field != null)
119 { 120 {
120 if (enumerator.Value is Hashtable) 121 if (enumerator.Value is Hashtable)
@@ -142,23 +143,4 @@ namespace OpenSim.Region.Capabilities
142 return obj; 143 return obj;
143 } 144 }
144 } 145 }
145 146} \ No newline at end of file
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164}
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs
index 57fc9e8..3842058 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs
@@ -26,9 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 29using libsecondlife;
33 30
34namespace OpenSim.Region.Capabilities 31namespace OpenSim.Region.Capabilities
@@ -42,4 +39,4 @@ namespace OpenSim.Region.Capabilities
42 { 39 {
43 } 40 }
44 } 41 }
45} 42} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs
index 6d17bff..683e479 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs
@@ -40,7 +40,6 @@ namespace OpenSim.Region.Capabilities
40 40
41 public LLSDMapLayer() 41 public LLSDMapLayer()
42 { 42 {
43
44 } 43 }
45 } 44 }
46} 45} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs
index 7900290..1945a6c 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
35 35
36 public LLSDMapLayerResponse() 36 public LLSDMapLayerResponse()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs
index 5fa08c9..935f81d 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
35 35
36 public LLSDMapRequest() 36 public LLSDMapRequest()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs
index 67253ee..6bd47e1 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs
@@ -26,11 +26,7 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.Capabilities 29namespace OpenSim.Region.Capabilities
34{ 30{
35 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); 31 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request);
36} 32} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
index 894b276..08e9563 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
@@ -26,13 +26,11 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Framework.Servers;
33using System.IO;
34using System.Collections; 29using System.Collections;
30using System.IO;
31using System.Text;
35using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Servers;
36 34
37namespace OpenSim.Region.Capabilities 35namespace OpenSim.Region.Capabilities
38{ 36{
@@ -42,11 +40,11 @@ namespace OpenSim.Region.Capabilities
42 private LLSDMethod<TRequest, TResponse> m_method; 40 private LLSDMethod<TRequest, TResponse> m_method;
43 41
44 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) 42 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
45 : base(httpMethod, path ) 43 : base(httpMethod, path)
46 { 44 {
47 m_method = method; 45 m_method = method;
48 } 46 }
49 47
50 public override byte[] Handle(string path, Stream request) 48 public override byte[] Handle(string path, Stream request)
51 { 49 {
52 //Encoding encoding = Encoding.UTF8; 50 //Encoding encoding = Encoding.UTF8;
@@ -55,16 +53,15 @@ namespace OpenSim.Region.Capabilities
55 //string requestBody = streamReader.ReadToEnd(); 53 //string requestBody = streamReader.ReadToEnd();
56 //streamReader.Close(); 54 //streamReader.Close();
57 55
58 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); 56 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
59 TRequest llsdRequest = new TRequest(); 57 TRequest llsdRequest = new TRequest();
60 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 58 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
61 59
62 TResponse response = m_method(llsdRequest); 60 TResponse response = m_method(llsdRequest);
63 61
64 Encoding encoding = new UTF8Encoding(false); 62 Encoding encoding = new UTF8Encoding(false);
65
66 return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) );
67 63
64 return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
68 } 65 }
69 } 66 }
70} 67} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs
index f70fa11..c2a6054 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
35 35
36 public LLSDTest() 36 public LLSDTest()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs
index 6af7f39..a90ae03 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs
@@ -37,23 +37,19 @@ namespace OpenSim.Region.Capabilities
37 public LLSDType(string type) 37 public LLSDType(string type)
38 { 38 {
39 myType = type; 39 myType = type;
40
41 } 40 }
42 41
43 public string ObjectType 42 public string ObjectType
44 { 43 {
45 get 44 get { return myType; }
46 {
47 return myType;
48 }
49 } 45 }
50 } 46 }
51 47
52 [AttributeUsage(AttributeTargets.Class)] 48 [AttributeUsage(AttributeTargets.Class)]
53 public class LLSDMap : LLSDType 49 public class LLSDMap : LLSDType
54 { 50 {
55 public LLSDMap() : base( "MAP" ) 51 public LLSDMap() : base("MAP")
56 { 52 {
57 } 53 }
58 } 54 }
59} 55} \ No newline at end of file