LIBOMV-639:
* Renamed TextureCache to AssetCache * Plugged in new cache into AssetManager * Removed OnAssetReceived global event from AssetManger * RequestAsset and RequestInventoryAsset now take a delegate of type AssetReceivedCallback git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3004 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -42,35 +42,29 @@ namespace OpenMetaverse.TestClient
|
||||
|
||||
System.Text.StringBuilder result = new System.Text.StringBuilder();
|
||||
|
||||
|
||||
// define a delegate to handle the reply
|
||||
AssetManager.AssetReceivedCallback del = delegate(AssetDownload transfer, Asset asset)
|
||||
{
|
||||
if (transfer.Success)
|
||||
{
|
||||
result.AppendFormat("Raw Notecard Data: " + System.Environment.NewLine + " {0}", Utils.BytesToString(asset.AssetData));
|
||||
waitEvent.Set();
|
||||
}
|
||||
};
|
||||
|
||||
// verify asset is loaded in store
|
||||
if (Client.Inventory.Store.Contains(note))
|
||||
{
|
||||
// retrieve asset from store
|
||||
InventoryItem ii = (InventoryItem)Client.Inventory.Store[note];
|
||||
// subscribe to reply event
|
||||
Client.Assets.OnAssetReceived += del;
|
||||
|
||||
// make request for asset
|
||||
Client.Assets.RequestInventoryAsset(ii, true);
|
||||
Client.Assets.RequestInventoryAsset(ii, true,
|
||||
delegate(AssetDownload transfer, Asset asset)
|
||||
{
|
||||
if (transfer.Success)
|
||||
{
|
||||
result.AppendFormat("Raw Notecard Data: " + System.Environment.NewLine + " {0}", Utils.BytesToString(asset.AssetData));
|
||||
waitEvent.Set();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// wait for reply or timeout
|
||||
if (!waitEvent.WaitOne(10000, false))
|
||||
{
|
||||
result.Append("Timeout waiting for notecard to download.");
|
||||
}
|
||||
// unsubscribe from reply event
|
||||
Client.Assets.OnAssetReceived -= del;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user