diff options
* Added prototypical AvatarFactory module interface to load avatar parameters
* Added dump_assets_to_file option to enable asset dumping for debug
* normalized some namespaces
* InventoryFolder renamed to InventoryFolderImpl to
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities')
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/Caps.cs | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 899fb61..095a5b1 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -61,8 +61,9 @@ namespace OpenSim.Region.Capabilities | |||
61 | private Queue<string> CapsEventQueue = new Queue<string>(); | 61 | private Queue<string> CapsEventQueue = new Queue<string>(); |
62 | public NewInventoryItem AddNewInventoryItem = null; | 62 | public NewInventoryItem AddNewInventoryItem = null; |
63 | public ItemUpdatedCallback ItemUpdatedCall = null; | 63 | public ItemUpdatedCallback ItemUpdatedCall = null; |
64 | private bool m_dumpAssetsToFile; | ||
64 | 65 | ||
65 | public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) | 66 | public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent, bool dumpAssetsToFile) |
66 | { | 67 | { |
67 | assetCache = assetCach; | 68 | assetCache = assetCach; |
68 | m_capsObjectPath = capsPath; | 69 | m_capsObjectPath = capsPath; |
@@ -70,6 +71,7 @@ namespace OpenSim.Region.Capabilities | |||
70 | m_httpListenerHostName = httpListen; | 71 | m_httpListenerHostName = httpListen; |
71 | m_httpListenPort = httpPort; | 72 | m_httpListenPort = httpPort; |
72 | agentID = agent; | 73 | agentID = agent; |
74 | m_dumpAssetsToFile = dumpAssetsToFile; | ||
73 | } | 75 | } |
74 | 76 | ||
75 | /// <summary> | 77 | /// <summary> |
@@ -250,7 +252,7 @@ namespace OpenSim.Region.Capabilities | |||
250 | LLUUID newInvItem = llsdRequest.item_id; | 252 | LLUUID newInvItem = llsdRequest.item_id; |
251 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 253 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
252 | 254 | ||
253 | ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener); | 255 | ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile ); |
254 | uploader.OnUpLoad += this.ItemUpdated; | 256 | uploader.OnUpLoad += this.ItemUpdated; |
255 | 257 | ||
256 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 258 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
@@ -280,7 +282,7 @@ namespace OpenSim.Region.Capabilities | |||
280 | LLUUID parentFolder = llsdRequest.folder_id; | 282 | LLUUID parentFolder = llsdRequest.folder_id; |
281 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 283 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
282 | 284 | ||
283 | AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener); | 285 | AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile); |
284 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); | 286 | httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); |
285 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; | 287 | string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; |
286 | 288 | ||
@@ -360,21 +362,14 @@ namespace OpenSim.Region.Capabilities | |||
360 | private LLUUID inventoryItemID; | 362 | private LLUUID inventoryItemID; |
361 | private LLUUID parentFolder; | 363 | private LLUUID parentFolder; |
362 | private BaseHttpServer httpListener; | 364 | private BaseHttpServer httpListener; |
363 | private bool SaveAssets = false; | 365 | private bool m_dumpAssetsToFile; |
364 | private string m_assetName = ""; | 366 | private string m_assetName = ""; |
365 | private string m_assetDes = ""; | 367 | private string m_assetDes = ""; |
366 | 368 | ||
367 | private string m_invType = ""; | 369 | private string m_invType = ""; |
368 | private string m_assetType = ""; | 370 | private string m_assetType = ""; |
369 | 371 | ||
370 | /// <summary> | 372 | public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer, bool dumpAssetsToFile) |
371 | /// | ||
372 | /// </summary> | ||
373 | /// <param name="assetID"></param> | ||
374 | /// <param name="inventoryItem"></param> | ||
375 | /// <param name="path"></param> | ||
376 | /// <param name="httpServer"></param> | ||
377 | public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer) | ||
378 | { | 373 | { |
379 | m_assetName = assetName; | 374 | m_assetName = assetName; |
380 | m_assetDes = description; | 375 | m_assetDes = description; |
@@ -385,7 +380,7 @@ namespace OpenSim.Region.Capabilities | |||
385 | parentFolder = parentFolderID; | 380 | parentFolder = parentFolderID; |
386 | m_assetType = assetType; | 381 | m_assetType = assetType; |
387 | m_invType = invType; | 382 | m_invType = invType; |
388 | 383 | m_dumpAssetsToFile = dumpAssetsToFile; | |
389 | } | 384 | } |
390 | 385 | ||
391 | /// <summary> | 386 | /// <summary> |
@@ -408,8 +403,10 @@ namespace OpenSim.Region.Capabilities | |||
408 | 403 | ||
409 | httpListener.RemoveStreamHandler("POST", uploaderPath); | 404 | httpListener.RemoveStreamHandler("POST", uploaderPath); |
410 | 405 | ||
411 | if(this.SaveAssets) | 406 | if (this.m_dumpAssetsToFile) |
407 | { | ||
412 | this.SaveAssetToFile(m_assetName + ".jp2", data); | 408 | this.SaveAssetToFile(m_assetName + ".jp2", data); |
409 | } | ||
413 | 410 | ||
414 | if (OnUpLoad != null) | 411 | if (OnUpLoad != null) |
415 | { | 412 | { |
@@ -436,19 +433,12 @@ namespace OpenSim.Region.Capabilities | |||
436 | private string uploaderPath = ""; | 433 | private string uploaderPath = ""; |
437 | private LLUUID inventoryItemID; | 434 | private LLUUID inventoryItemID; |
438 | private BaseHttpServer httpListener; | 435 | private BaseHttpServer httpListener; |
439 | private bool SaveAssets = false; | 436 | private bool m_dumpAssetToFile; |
440 | |||
441 | 437 | ||
442 | /// <summary> | 438 | public ItemUpdater( LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile) |
443 | /// | ||
444 | /// </summary> | ||
445 | /// <param name="assetID"></param> | ||
446 | /// <param name="inventoryItem"></param> | ||
447 | /// <param name="path"></param> | ||
448 | /// <param name="httpServer"></param> | ||
449 | public ItemUpdater( LLUUID inventoryItem, string path, BaseHttpServer httpServer) | ||
450 | { | 439 | { |
451 | 440 | m_dumpAssetToFile = dumpAssetToFile; | |
441 | |||
452 | inventoryItemID = inventoryItem; | 442 | inventoryItemID = inventoryItem; |
453 | uploaderPath = path; | 443 | uploaderPath = path; |
454 | httpListener = httpServer; | 444 | httpListener = httpServer; |
@@ -481,8 +471,10 @@ namespace OpenSim.Region.Capabilities | |||
481 | 471 | ||
482 | httpListener.RemoveStreamHandler("POST", uploaderPath); | 472 | httpListener.RemoveStreamHandler("POST", uploaderPath); |
483 | 473 | ||
484 | if (this.SaveAssets) | 474 | if (this.m_dumpAssetToFile) |
485 | this.SaveAssetToFile("updateditem"+Util.RandomClass.Next(1,1000) + ".dat", data); | 475 | { |
476 | this.SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); | ||
477 | } | ||
486 | 478 | ||
487 | return res; | 479 | return res; |
488 | } | 480 | } |