Add saving assets from gestures to IAR

mysql-performance
Melanie 2009-12-23 23:09:41 +00:00
parent f2d2073f2b
commit 53386b6f1f
1 changed files with 41 additions and 1 deletions

View File

@ -91,6 +91,10 @@ namespace OpenSim.Region.Framework.Scenes
{
GetWearableAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.Gesture == assetType)
{
GetGestureAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.LSLText == assetType)
{
GetScriptAssetUuids(assetUuid, assetUuids);
@ -278,5 +282,41 @@ namespace OpenSim.Region.Framework.Scenes
GatherAssetUuids(sog, assetUuids);
}
}
protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, int> assetUuids)
{
AssetBase assetBase = GetAsset(gestureUuid);
MemoryStream ms = new MemoryStream(assetBase.Data);
StreamReader sr = new StreamReader(ms);
sr.ReadLine(); // Unknown (Version?)
sr.ReadLine(); // Unknown
sr.ReadLine(); // Unknown
sr.ReadLine(); // Name
sr.ReadLine(); // Comment ?
int count = Convert.ToInt32(sr.ReadLine()); // Item count
for (int i = 0 ; i < count ; i++)
{
string type = sr.ReadLine();
if (type == null)
break;
string name = sr.ReadLine();
if (name == null)
break;
string id = sr.ReadLine();
if (id == null)
break;
string unknown = sr.ReadLine();
if (unknown == null)
break;
// If it can be parsed as a UUID, it is an asset ID
UUID uuid;
if (UUID.Parse(id, out uuid))
assetUuids[uuid] = 1;
}
}
}
}
}