diff --git a/libsecondlife-cs/AssetSystem/AppearanceManager.cs b/libsecondlife-cs/AssetSystem/AppearanceManager.cs
index dd3ec57e..719db45b 100644
--- a/libsecondlife-cs/AssetSystem/AppearanceManager.cs
+++ b/libsecondlife-cs/AssetSystem/AppearanceManager.cs
@@ -233,11 +233,12 @@ namespace libsecondlife.AssetSystem
break;
}
- AssetRequestDownload request = Client.Assets.RequestInventoryAsset(wearableAsset);
+ AssetRequestDownload request = Client.Assets.RequestInventoryAsset(wearableAsset.AssetID, wearableAsset.Type);
if (request.Wait(AssetManager.DefaultTimeout) != AssetRequestDownload.RequestStatus.Success)
{
throw new Exception("Asset (" + wearableAsset.AssetID.ToStringHyphenated() + ") unavailable (" + request.StatusMsg + ")");
}
+ wearableAsset.SetAssetData(request.GetAssetData());
if ((wearableAsset.AssetData == null) || (wearableAsset.AssetData.Length == 0))
{
diff --git a/libsecondlife-cs/AssetSystem/AssetManager.cs b/libsecondlife-cs/AssetSystem/AssetManager.cs
index 438d84d4..eef092f8 100644
--- a/libsecondlife-cs/AssetSystem/AssetManager.cs
+++ b/libsecondlife-cs/AssetSystem/AssetManager.cs
@@ -90,7 +90,7 @@ namespace libsecondlife.AssetSystem
///
///
///
- internal AssetManager(SecondLife client)
+ public AssetManager(SecondLife client)
{
slClient = client;
@@ -172,6 +172,7 @@ namespace libsecondlife.AssetSystem
///
/// Get the Asset data for an item, must be used when requesting a Notecard
///
+ /// It is the responsibility of the calling party to retrieve the asset data from the request object when it is compelte.
///
public AssetRequestDownload RequestInventoryAsset(InventoryItem item)
{
@@ -182,7 +183,7 @@ namespace libsecondlife.AssetSystem
LLUUID TransferID = LLUUID.Random();
- AssetRequestDownload request = new AssetRequestDownload(slClient.Assets, TransferID, item._Asset);
+ AssetRequestDownload request = new AssetRequestDownload(slClient.Assets, TransferID);
request.UpdateLastPacketTime(); // last time we recevied a packet for this request
htDownloadRequests[TransferID] = request;
@@ -213,17 +214,16 @@ namespace libsecondlife.AssetSystem
///
/// Get Asset data, works with BodyShapes (type 13) but does not work with Notecards(type 7)
///
- ///
- public AssetRequestDownload RequestInventoryAsset(Asset asset)
+ public AssetRequestDownload RequestInventoryAsset(LLUUID AssetID, sbyte Type)
{
LLUUID TransferID = LLUUID.Random();
- AssetRequestDownload request = new AssetRequestDownload(slClient.Assets, TransferID, asset);
+ AssetRequestDownload request = new AssetRequestDownload(slClient.Assets, TransferID);
request.UpdateLastPacketTime(); // last time we recevied a packet for this request
htDownloadRequests[TransferID] = request;
- Packet packet = AssetPacketHelpers.TransferRequestDirect(slClient.Network.SessionID, slClient.Network.AgentID, TransferID, asset.AssetID, asset.Type);
+ Packet packet = AssetPacketHelpers.TransferRequestDirect(slClient.Network.SessionID, slClient.Network.AgentID, TransferID, AssetID, Type);
slClient.Network.SendPacket(packet);
#if DEBUG_PACKETS
@@ -264,7 +264,9 @@ namespace libsecondlife.AssetSystem
[Obsolete("Use RequestInventoryAsset instead.", false)]
public void GetInventoryAsset(Asset asset)
{
- RequestInventoryAsset(asset).Wait(-1);
+ AssetRequestDownload request = RequestInventoryAsset(asset.AssetID, asset.Type);
+ request.Wait(-1);
+ asset.SetAssetData(request.GetAssetData());
}
#endregion
diff --git a/libsecondlife-cs/AssetSystem/AssetRequest.cs b/libsecondlife-cs/AssetSystem/AssetRequest.cs
index 994aa1e2..d33528a2 100644
--- a/libsecondlife-cs/AssetSystem/AssetRequest.cs
+++ b/libsecondlife-cs/AssetSystem/AssetRequest.cs
@@ -81,6 +81,18 @@ namespace libsecondlife.AssetSystem
UpdateLastPacketTime();
}
+ public AssetRequest(AssetManager Manager, LLUUID TransID)
+ {
+ _AssetManager = Manager;
+ _TransactionID = TransID;
+ AssetBeingTransferd = null;
+
+ _Size = int.MaxValue;
+
+ UpdateLastPacketTime();
+ }
+
+
public void UpdateLastPacketTime()
{
_LastPacketTime = Helpers.GetUnixTime();
@@ -127,8 +139,8 @@ namespace libsecondlife.AssetSystem
protected int _Received;
protected SortedList _AssetDataReceived = new SortedList();
- public AssetRequestDownload(AssetManager Manager, LLUUID TransID, Asset Asset2Update)
- : base(Manager, TransID, Asset2Update)
+ public AssetRequestDownload(AssetManager Manager, LLUUID TransID)
+ : base(Manager, TransID)
{
_Received = 0;
}
@@ -151,8 +163,6 @@ namespace libsecondlife.AssetSystem
curPos += kvp.Value.Length;
}
- AssetBeingTransferd.SetAssetData(_AssetData);
-
MarkCompleted(AssetRequestDownload.RequestStatus.Success, "Download Completed");
}
@@ -163,5 +173,14 @@ namespace libsecondlife.AssetSystem
_Size = size;
_AssetData = new byte[_Size];
}
+
+ ///
+ /// Get the asset data downloaded by this request.
+ ///
+ ///
+ public byte[] GetAssetData()
+ {
+ return _AssetData;
+ }
}
}
diff --git a/libsecondlife-cs/InventorySystem/InventoryImage.cs b/libsecondlife-cs/InventorySystem/InventoryImage.cs
index 877ae610..874174b3 100644
--- a/libsecondlife-cs/InventorySystem/InventoryImage.cs
+++ b/libsecondlife-cs/InventorySystem/InventoryImage.cs
@@ -27,6 +27,8 @@ namespace libsecondlife.InventorySystem
{
throw new Exception("Asset (" + AssetID.ToStringHyphenated() + ") unavailable (" + request.StatusMsg + ") for " + this.Name);
}
+ _Asset = new AssetImage(AssetID, request.GetAssetData());
+
return ((AssetImage)Asset).J2CData;
}
}
diff --git a/libsecondlife-cs/InventorySystem/InventoryItem.cs b/libsecondlife-cs/InventorySystem/InventoryItem.cs
index 1974fa86..671e5d57 100644
--- a/libsecondlife-cs/InventorySystem/InventoryItem.cs
+++ b/libsecondlife-cs/InventorySystem/InventoryItem.cs
@@ -135,6 +135,7 @@ namespace libsecondlife.InventorySystem
{
throw new Exception("Asset (" + AssetID.ToStringHyphenated() + ") unavailable (" + request.StatusMsg + ") for " + this.Name);
}
+ _Asset = new Asset(AssetID, Type, request.GetAssetData());
return Asset;
}
}
diff --git a/libsecondlife-cs/InventorySystem/InventoryNotecard.cs b/libsecondlife-cs/InventorySystem/InventoryNotecard.cs
index 77684e18..a7e22d02 100644
--- a/libsecondlife-cs/InventorySystem/InventoryNotecard.cs
+++ b/libsecondlife-cs/InventorySystem/InventoryNotecard.cs
@@ -25,6 +25,8 @@ namespace libsecondlife.InventorySystem
{
throw new Exception("Asset (" + AssetID.ToStringHyphenated() + ") unavailable (" + request.StatusMsg + ") for " + this.Name);
}
+ _Asset = new AssetNotecard(AssetID, request.GetAssetData());
+
return ((AssetNotecard)Asset).Body;
}
}
diff --git a/libsecondlife-cs/InventorySystem/InventoryScript.cs b/libsecondlife-cs/InventorySystem/InventoryScript.cs
index 9438f70d..5ad78cb5 100644
--- a/libsecondlife-cs/InventorySystem/InventoryScript.cs
+++ b/libsecondlife-cs/InventorySystem/InventoryScript.cs
@@ -24,6 +24,7 @@ namespace libsecondlife.InventorySystem
{
throw new Exception("Asset (" + AssetID.ToStringHyphenated() + ") unavailable (" + request.StatusMsg + ") for " + this.Name);
}
+ _Asset = new AssetScript(AssetID, request.GetAssetData());
return ((AssetScript)Asset).Source;
}
}