more changes on uuid gatherer

master
UbitUmarov 2020-05-30 19:44:11 +01:00
parent 5ac1fff43e
commit 42b75021b6
1 changed files with 63 additions and 26 deletions

View File

@ -796,19 +796,32 @@ namespace OpenSim.Region.Framework.Scenes
if (!ostmp.SkipLine()) if (!ostmp.SkipLine())
return; return;
while(ostmp.ReadLine(out osUTF8 line)) while (ostmp.ReadLine(out osUTF8 line))
{ {
line.SelfTrim(wearableSeps); line.SelfTrim(wearableSeps);
osUTF8[] parts = line.Split(wearableSeps); osUTF8[] parts = line.Split(wearableSeps);
if(parts[0].Lenght == 0) if(parts[0].Lenght == 0)
continue; continue;
parts[0].SelfTrim(wearableSeps); parts[0].SelfTrim(wearableSeps);
if(parts[0].ToString() == "textures") if (parts[0].ToString() == "parameters")
{
if (parts[1].Lenght == 0)
return;
parts[1].SelfTrim(wearableSeps);
if (!osUTF8.TryParseInt(parts[1], out int count) || count == 0)
return;
for (int i = 0; i < count; ++i)
{
if (!ostmp.SkipLine())
return;
}
}
else if (parts[0].ToString() == "textures")
{ {
if(parts[1].Lenght == 0) if(parts[1].Lenght == 0)
return; return;
parts[1].SelfTrim(wearableSeps); parts[1].SelfTrim(wearableSeps);
if(!int.TryParse(parts[1].ToString(), out int count) || count == 0) if (!osUTF8.TryParseInt(parts[1], out int count) || count == 0)
return; return;
for(int i = 0; i < count; ++i) for(int i = 0; i < count; ++i)
{ {
@ -910,34 +923,58 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="gestureAsset"></param> /// <param name="gestureAsset"></param>
private void RecordGestureAssetUuids(AssetBase gestureAsset) private void RecordGestureAssetUuids(AssetBase gestureAsset)
{ {
using (StreamReader sr = new StreamReader(new MemoryStream(gestureAsset.Data))) osUTF8 osdata = new osUTF8(gestureAsset.Data);
{
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++) if (!osdata.SkipLine()) // version
{ return;
string type = sr.ReadLine(); if (!osdata.SkipLine()) // key
if (type == null) return;
break; if (!osdata.SkipLine()) // mask
string name = sr.ReadLine(); return;
if (name == null) if (!osdata.SkipLine()) // trigger
break; return;
string id = sr.ReadLine(); if (!osdata.SkipLine()) // replace
if (id == null) return;
break;
string unknown = sr.ReadLine();
if (unknown == null)
break;
// If it can be parsed as a UUID, it is an asset ID if (!osdata.ReadLine(out osUTF8 line))
UUID uuid; return;
if (UUID.TryParse(id, out uuid))
GatheredUuids[uuid] = (sbyte)AssetType.Animation; // the asset is either an Animation or a Sound, but this distinction isn't important if(!osUTF8.TryParseInt(line, out int scount) || scount == 0)
return;
for(int i = 0; i < scount; ++i)
{
if (!osdata.ReadLine(out osUTF8 typeline)) // type
return;
typeline.SelfTrim();
if (!osUTF8.TryParseInt(typeline, out int type))
return;
osUTF8 id;
UUID uid;
switch(type)
{
case 0: // animation
case 1: // sound
if (!osdata.SkipLine()) // name
return;
if (!osdata.ReadLine(out id)) // uuid
return;
id.SelfTrim();
if (UUID.TryParse(id.ToString(), out uid) && uid != UUID.Zero)
GatheredUuids[uid] = type == 0 ? (sbyte)AssetType.Animation : (sbyte)AssetType.Sound;
if (!osdata.SkipLine()) // flags
return;
break;
case 2: // chat
case 3: // wait
if (!osdata.SkipLine()) // chat text or wait time
return;
if (!osdata.SkipLine()) // flags
return;
break;
default:
return; // no idea
} }
} }
} }