diff --git a/libsecondlife-cs/AssetSystem/AppearanceManager.cs b/libsecondlife-cs/AssetSystem/AppearanceManager.cs
index bb0fa14e..c97df402 100644
--- a/libsecondlife-cs/AssetSystem/AppearanceManager.cs
+++ b/libsecondlife-cs/AssetSystem/AppearanceManager.cs
@@ -145,10 +145,17 @@ namespace libsecondlife.AssetSystem
{
if (ib is InventoryWearable)
{
- InventoryWearable iw = (InventoryWearable)ib;
- byte type = ((AssetWearable)iw.Asset).TypeFromAsset;
- AgentWearablesData[type].ItemID = iw.ItemID;
- AgentWearablesData[type].AssetID = iw.AssetID;
+ try
+ {
+ InventoryWearable iw = (InventoryWearable)ib;
+ byte type = ((AssetWearable)iw.Asset).TypeFromAsset;
+ AgentWearablesData[type].ItemID = iw.ItemID;
+ AgentWearablesData[type].AssetID = iw.AssetID;
+ }
+ catch (Exception e)
+ {
+ Client.Log("Asset for " + ib._Name + " unavailable: " + e.Message, Helpers.LogLevel.Error);
+ }
}
}
@@ -239,9 +246,12 @@ namespace libsecondlife.AssetSystem
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 + ")");
+ Client.Log("Asset (" + wearableAsset.AssetID.ToStringHyphenated() + ") unavailable (" + request.StatusMsg + ")", Helpers.LogLevel.Error);
+ }
+ else
+ {
+ wearableAsset.SetAssetData(request.GetAssetData());
}
- wearableAsset.SetAssetData(request.GetAssetData());
if ((wearableAsset.AssetData == null) || (wearableAsset.AssetData.Length == 0))
{
diff --git a/libsecondlife-cs/AssetSystem/Asset.cs b/libsecondlife-cs/AssetSystem/Asset.cs
index 597a4cf5..c7d28a32 100644
--- a/libsecondlife-cs/AssetSystem/Asset.cs
+++ b/libsecondlife-cs/AssetSystem/Asset.cs
@@ -35,11 +35,93 @@ namespace libsecondlife.AssetSystem
///
public class Asset
{
+/*
public const sbyte ASSET_TYPE_NOTECARD = 7;
public const sbyte ASSET_TYPE_IMAGE = 0;
public const sbyte ASSET_TYPE_WEARABLE_BODY = 13;
public const sbyte ASSET_TYPE_WEARABLE_CLOTHING = 5;
public const sbyte ASSET_TYPE_SCRIPT = 10;
+*/
+ public enum AssetType : sbyte
+ {
+ /// Unknown asset type
+ Unknown = -1,
+
+ /// Texture asset, stores in JPEG2000 J2C stream format
+ Texture = 0,
+
+ /// Sound asset
+ Sound = 1,
+
+ /// Calling card for another avatar
+ CallingCard = 2,
+
+ /// Link to a location in world
+ Landmark = 3,
+
+ /// Legacy script asset, you should never see one of these
+ [Obsolete]
+ Script = 4,
+
+ /// Collection of textures and parameters that can be
+ /// worn by an avatar
+ Clothing = 5,
+
+ /// Primitive that can contain textures, sounds,
+ /// scripts and more
+ Object = 6,
+
+ /// Notecard asset
+ Notecard = 7,
+
+ /// Holds a collection of inventory items
+ Folder = 8,
+
+ /// Root inventory folder
+ RootFolder = 9,
+
+ /// Linden scripting language script
+ LSLText = 10,
+
+ /// LSO bytecode for a script
+ LSLBytecode = 11,
+
+ /// Uncompressed TGA texture
+ TextureTGA = 12,
+
+ /// Collection of textures and shape parameters that can
+ /// be worn
+ Bodypart = 13,
+
+ /// Trash folder
+ TrashFolder = 14,
+
+ /// Snapshot folder
+ SnapshotFolder = 15,
+
+ /// Lost and found folder
+ LostAndFoundFolder = 16,
+
+ /// Uncompressed sound
+ SoundWAV = 17,
+
+ /// Uncompressed TGA non-square image, not to be used as a
+ /// texture
+ ImageTGA = 18,
+
+ /// Compressed JPEG non-square image, not to be used as a
+ /// texture
+ ImageJPEG = 19,
+
+ /// Animation
+ Animation = 20,
+
+ /// Sequence of animations, sounds, chat, and pauses
+ Gesture = 21,
+
+ /// Simstate file
+ Simstate = 22
+ }
public LLUUID AssetID;
diff --git a/libsecondlife-cs/AssetSystem/AssetImage.cs b/libsecondlife-cs/AssetSystem/AssetImage.cs
index 56a46789..fada9b92 100644
--- a/libsecondlife-cs/AssetSystem/AssetImage.cs
+++ b/libsecondlife-cs/AssetSystem/AssetImage.cs
@@ -48,7 +48,7 @@ namespace libsecondlife.AssetSystem
///
///
public AssetImage(LLUUID assetID, byte[] assetData)
- : base(assetID, Asset.ASSET_TYPE_IMAGE, false, assetData)
+ : base(assetID, (sbyte)Asset.AssetType.Texture, false, assetData)
{
}
diff --git a/libsecondlife-cs/AssetSystem/AssetManager.cs b/libsecondlife-cs/AssetSystem/AssetManager.cs
index ebd7276a..4def1434 100644
--- a/libsecondlife-cs/AssetSystem/AssetManager.cs
+++ b/libsecondlife-cs/AssetSystem/AssetManager.cs
@@ -73,6 +73,8 @@ namespace libsecondlife.AssetSystem
///
public class AssetManager
{
+
+
protected SecondLife slClient;
protected AssetRequestUpload curUploadRequest = null;
@@ -148,7 +150,7 @@ namespace libsecondlife.AssetSystem
curUploadRequest = new AssetRequestUpload(slClient, LLUUID.Random(), asset);
LLUUID assetID = curUploadRequest.DoUpload();
- if (asset.Type == Asset.ASSET_TYPE_IMAGE)
+ if (asset.Type == (sbyte)Asset.AssetType.Texture)
{
SinkFee();
}
diff --git a/libsecondlife-cs/AssetSystem/AssetNotecard.cs b/libsecondlife-cs/AssetSystem/AssetNotecard.cs
index 34948422..51a4d6d7 100644
--- a/libsecondlife-cs/AssetSystem/AssetNotecard.cs
+++ b/libsecondlife-cs/AssetSystem/AssetNotecard.cs
@@ -51,7 +51,7 @@ namespace libsecondlife.AssetSystem
///
///
public AssetNotecard(LLUUID assetID, string body)
- : base(assetID, Asset.ASSET_TYPE_NOTECARD, false, null)
+ : base(assetID, (sbyte)Asset.AssetType.Notecard, false, null)
{
_Body = body;
setAsset( body );
@@ -62,7 +62,7 @@ namespace libsecondlife.AssetSystem
///
///
public AssetNotecard(LLUUID assetID, byte[] assetData)
- : base(assetID, Asset.ASSET_TYPE_NOTECARD, false, null)
+ : base(assetID, (sbyte)Asset.AssetType.Notecard, false, null)
{
_AssetData = assetData;
diff --git a/libsecondlife-cs/AssetSystem/AssetRequest.cs b/libsecondlife-cs/AssetSystem/AssetRequest.cs
index 33a30ebb..537d300f 100644
--- a/libsecondlife-cs/AssetSystem/AssetRequest.cs
+++ b/libsecondlife-cs/AssetSystem/AssetRequest.cs
@@ -125,14 +125,14 @@ namespace libsecondlife.AssetSystem
{
if (SecondsSinceLastPacket > hardTimeout)
{
- _StatusMsg += "Timeout Failure - Hard timeout reached ";
+ _StatusMsg += "Timeout Failure - Hard timeout reached (" + SecondsSinceLastPacket + " > " + hardTimeout + ")";
return RequestStatus.Failure;
}
else
{
if (SecondsSinceLastPacket > softTimeout)
{
- _StatusMsg += "Timeout Failure - No packets in " + SecondsSinceLastPacket;
+ _StatusMsg += "Timeout Failure - Soft Timeout ( " + SecondsSinceLastPacket + " > " + softTimeout + ")";
return RequestStatus.Failure;
}
}
diff --git a/libsecondlife-cs/AssetSystem/AssetScript.cs b/libsecondlife-cs/AssetSystem/AssetScript.cs
index 621539d1..ee79e165 100644
--- a/libsecondlife-cs/AssetSystem/AssetScript.cs
+++ b/libsecondlife-cs/AssetSystem/AssetScript.cs
@@ -18,14 +18,14 @@ namespace libsecondlife.AssetSystem
}
public AssetScript(LLUUID assetID, string source)
- : base(assetID, Asset.ASSET_TYPE_SCRIPT, false, null)
+ : base(assetID, (sbyte)Asset.AssetType.LSLText, false, null)
{
_Source = source;
setAsset(source);
}
public AssetScript(LLUUID assetID, byte[] assetData)
- : base(assetID, Asset.ASSET_TYPE_SCRIPT, false, assetData)
+ : base(assetID, (sbyte)Asset.AssetType.LSLText, false, assetData)
{
_Source = System.Text.Encoding.UTF8.GetString(assetData).Trim();
}
diff --git a/libsecondlife-cs/AssetSystem/AssetWearable_Body.cs b/libsecondlife-cs/AssetSystem/AssetWearable_Body.cs
index 410b333c..d6d122b7 100644
--- a/libsecondlife-cs/AssetSystem/AssetWearable_Body.cs
+++ b/libsecondlife-cs/AssetSystem/AssetWearable_Body.cs
@@ -41,7 +41,7 @@ namespace libsecondlife.AssetSystem
///
///
public AssetWearable_Body(LLUUID assetID, byte[] assetData)
- : base(assetID, Asset.ASSET_TYPE_WEARABLE_BODY, assetData)
+ : base(assetID, (sbyte)Asset.AssetType.Bodypart, assetData)
{
}
}
diff --git a/libsecondlife-cs/AssetSystem/AssetWearable_Clothing.cs b/libsecondlife-cs/AssetSystem/AssetWearable_Clothing.cs
index 37de27b3..41ebd6a9 100644
--- a/libsecondlife-cs/AssetSystem/AssetWearable_Clothing.cs
+++ b/libsecondlife-cs/AssetSystem/AssetWearable_Clothing.cs
@@ -41,7 +41,7 @@ namespace libsecondlife.AssetSystem
///
///
public AssetWearable_Clothing(LLUUID assetID, byte[] assetData)
- : base(assetID, Asset.ASSET_TYPE_WEARABLE_CLOTHING, assetData)
+ : base(assetID, (sbyte)Asset.AssetType.Clothing, assetData)
{
}
}
diff --git a/libsecondlife-cs/InventorySystem/InventoryImage.cs b/libsecondlife-cs/InventorySystem/InventoryImage.cs
index 1deef174..d8814f16 100644
--- a/libsecondlife-cs/InventorySystem/InventoryImage.cs
+++ b/libsecondlife-cs/InventorySystem/InventoryImage.cs
@@ -54,7 +54,7 @@ namespace libsecondlife.InventorySystem
internal InventoryImage( InventoryManager manager, InventoryItem ii )
: base( manager, ii._Name, ii._Description, ii._FolderID, ii._InvType, ii._Type, ii._CreatorID)
{
- if( (ii.InvType != 0) || (ii.Type != Asset.ASSET_TYPE_IMAGE) )
+ if( (ii.InvType != 0) || (ii.Type != (sbyte)Asset.AssetType.Texture) )
{
throw new Exception("The InventoryItem cannot be converted to a Image/Texture, wrong InvType/Type.");
}
diff --git a/libsecondlife-cs/InventorySystem/InventoryItem.cs b/libsecondlife-cs/InventorySystem/InventoryItem.cs
index 1fa53195..81d8ea63 100644
--- a/libsecondlife-cs/InventorySystem/InventoryItem.cs
+++ b/libsecondlife-cs/InventorySystem/InventoryItem.cs
@@ -135,7 +135,31 @@ namespace libsecondlife.InventorySystem
{
throw new Exception("Asset (" + AssetID.ToStringHyphenated() + ") unavailable (" + request.StatusMsg + ") for " + this.Name);
}
- _Asset = new Asset(AssetID, Type, request.GetAssetData());
+ switch (Type)
+ {
+ case (sbyte)Asset.AssetType.Clothing:
+ Console.WriteLine(">> Clothing");
+ _Asset = new AssetWearable_Clothing(AssetID, request.GetAssetData());
+ break;
+ case (sbyte)Asset.AssetType.Bodypart:
+ Console.WriteLine(">> Bodypart");
+ _Asset = new AssetWearable_Body(AssetID, request.GetAssetData());
+ break;
+ case (sbyte)Asset.AssetType.LSLText:
+ _Asset = new AssetScript(AssetID, request.GetAssetData());
+ break;
+ case (sbyte)Asset.AssetType.Notecard:
+ _Asset = new AssetNotecard(AssetID, request.GetAssetData());
+ break;
+ case (sbyte)Asset.AssetType.Texture:
+ _Asset = new AssetImage(AssetID, request.GetAssetData());
+ break;
+ default:
+ Console.WriteLine(">> Bodypart");
+ _Asset = new Asset(AssetID, Type, request.GetAssetData());
+ break;
+ }
+
return Asset;
}
}
diff --git a/libsecondlife-cs/InventorySystem/InventoryManager.cs b/libsecondlife-cs/InventorySystem/InventoryManager.cs
index 1e832a51..c2748fbf 100644
--- a/libsecondlife-cs/InventorySystem/InventoryManager.cs
+++ b/libsecondlife-cs/InventorySystem/InventoryManager.cs
@@ -812,19 +812,19 @@ namespace libsecondlife.InventorySystem
if (InvFolderUpdating._Contents.Contains(TempInvItem) == false)
{
- if ((TempInvItem.InvType == 7) && (TempInvItem.Type == Asset.ASSET_TYPE_NOTECARD))
+ if ((TempInvItem.InvType == 7) && (TempInvItem.Type == (sbyte)Asset.AssetType.Notecard))
{
InventoryItem temp = new InventoryNotecard(this, TempInvItem);
TempInvItem = temp;
}
- if ((TempInvItem.InvType == 0) && (TempInvItem.Type == Asset.ASSET_TYPE_IMAGE))
+ if ((TempInvItem.InvType == 0) && (TempInvItem.Type == (sbyte)Asset.AssetType.Texture))
{
InventoryItem temp = new InventoryImage(this, TempInvItem);
TempInvItem = temp;
}
- if ( (TempInvItem.InvType == 10) && (TempInvItem.Type == Asset.ASSET_TYPE_SCRIPT) )
+ if ((TempInvItem.InvType == 10) && (TempInvItem.Type == (sbyte)Asset.AssetType.LSLText))
{
InventoryItem temp = new InventoryScript(this, TempInvItem);
TempInvItem = temp;
@@ -832,8 +832,8 @@ namespace libsecondlife.InventorySystem
if ((TempInvItem.InvType == 18) &&
(
- (TempInvItem.Type == Asset.ASSET_TYPE_WEARABLE_BODY)
- || (TempInvItem.Type == Asset.ASSET_TYPE_WEARABLE_CLOTHING)
+ (TempInvItem.Type == (sbyte)Asset.AssetType.Bodypart)
+ || (TempInvItem.Type == (sbyte)Asset.AssetType.Clothing)
)
)
diff --git a/libsecondlife-cs/InventorySystem/InventoryNotecard.cs b/libsecondlife-cs/InventorySystem/InventoryNotecard.cs
index 0b22a870..097ea0e1 100644
--- a/libsecondlife-cs/InventorySystem/InventoryNotecard.cs
+++ b/libsecondlife-cs/InventorySystem/InventoryNotecard.cs
@@ -64,7 +64,7 @@ namespace libsecondlife.InventorySystem
internal InventoryNotecard(InventoryManager manager, InventoryItem ii)
: base( manager, ii._Name, ii._Description, ii._FolderID, ii._InvType, ii._Type, ii._CreatorID)
{
- if( (ii.InvType != 7) || (ii.Type != Asset.ASSET_TYPE_NOTECARD) )
+ if ((ii.InvType != 7) || (ii.Type != (sbyte)Asset.AssetType.Notecard))
{
throw new Exception("The InventoryItem cannot be converted to a Notecard, wrong InvType/Type.");
}
diff --git a/libsecondlife-cs/InventorySystem/InventoryScript.cs b/libsecondlife-cs/InventorySystem/InventoryScript.cs
index dd354447..b98505ac 100644
--- a/libsecondlife-cs/InventorySystem/InventoryScript.cs
+++ b/libsecondlife-cs/InventorySystem/InventoryScript.cs
@@ -46,7 +46,7 @@ namespace libsecondlife.InventorySystem
public InventoryScript(InventoryManager manager, InventoryItem ii)
: base(manager, ii.Name, ii.Description, ii.FolderID, ii.InvType, ii.Type, ii.CreatorID)
{
- if ( ii.InvType != 10 || ii.Type != Asset.ASSET_TYPE_SCRIPT )
+ if (ii.InvType != 10 || ii.Type != (sbyte)Asset.AssetType.LSLText)
throw new Exception("The InventoryItem cannot be converted to a Script, wrong InvType/Type.");
this.iManager = manager;
this._ItemID = ii._ItemID;