make some limit use of new libomv things
parent
7b8db526b3
commit
b541de034c
|
@ -51,9 +51,9 @@ namespace OpenSim.Framework
|
||||||
public const string LLSDEmpty = "<llsd><map /></llsd>";
|
public const string LLSDEmpty = "<llsd><map /></llsd>";
|
||||||
|
|
||||||
// got tired of creating a stringbuilder all the time;
|
// got tired of creating a stringbuilder all the time;
|
||||||
public static StringBuilder Start(int size = 256, bool addxmlversion = false)
|
public static StringBuilder Start(int size = 4096, bool addxmlversion = false)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder(size);
|
StringBuilder sb = osStringBuilderCache.Acquire(size);
|
||||||
if(addxmlversion)
|
if(addxmlversion)
|
||||||
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd>"); // legacy llsd xml name still valid
|
sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd>"); // legacy llsd xml name still valid
|
||||||
else
|
else
|
||||||
|
@ -69,13 +69,13 @@ namespace OpenSim.Framework
|
||||||
public static string End(StringBuilder sb)
|
public static string End(StringBuilder sb)
|
||||||
{
|
{
|
||||||
sb.Append("</llsd>");
|
sb.Append("</llsd>");
|
||||||
return sb.ToString();
|
return osStringBuilderCache.GetStringAndRelease(sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] EndToNBBytes(StringBuilder sb)
|
public static byte[] EndToNBBytes(StringBuilder sb)
|
||||||
{
|
{
|
||||||
sb.Append("</llsd>");
|
sb.Append("</llsd>");
|
||||||
return Util.UTF8NBGetbytes(sb.ToString());
|
return Util.UTF8NBGetbytes(osStringBuilderCache.GetStringAndRelease(sb));
|
||||||
}
|
}
|
||||||
|
|
||||||
// map == a list of key value pairs
|
// map == a list of key value pairs
|
||||||
|
@ -764,11 +764,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public static void EscapeToXML(string s, StringBuilder sb)
|
public static void EscapeToXML(string s, StringBuilder sb)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
char c;
|
char c;
|
||||||
int len = s.Length;
|
for (int i = 0; i < s.Length; ++i)
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
{
|
{
|
||||||
c = s[i];
|
c = s[i];
|
||||||
switch (c)
|
switch (c)
|
||||||
|
|
|
@ -211,8 +211,8 @@ namespace OpenSim.Framework
|
||||||
{"animatn", AssetType.Animation},
|
{"animatn", AssetType.Animation},
|
||||||
{"gesture", AssetType.Gesture},
|
{"gesture", AssetType.Gesture},
|
||||||
{"simstate", AssetType.Simstate},
|
{"simstate", AssetType.Simstate},
|
||||||
{"mesh", AssetType.Mesh}
|
{"mesh", AssetType.Mesh},
|
||||||
// "settings", AssetType.Settings}
|
{"settings", AssetType.Settings}
|
||||||
};
|
};
|
||||||
private static Dictionary<string, FolderType> name2Inventory = new Dictionary<string, FolderType>()
|
private static Dictionary<string, FolderType> name2Inventory = new Dictionary<string, FolderType>()
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ namespace OpenSim.Framework
|
||||||
{"outfit", FolderType.Outfit},
|
{"outfit", FolderType.Outfit},
|
||||||
{"myoutfits", FolderType.MyOutfits},
|
{"myoutfits", FolderType.MyOutfits},
|
||||||
{"mesh", FolderType.Mesh},
|
{"mesh", FolderType.Mesh},
|
||||||
// "settings", FolderType.Settings},
|
{"settings", FolderType.Settings},
|
||||||
{"suitcase", FolderType.Suitcase}
|
{"suitcase", FolderType.Suitcase}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -432,7 +432,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
for(int j = 0; j < items.Count; ++j)
|
for(int j = 0; j < items.Count; ++j)
|
||||||
{
|
{
|
||||||
TaskInventoryItem tii = items[j];
|
TaskInventoryItem tii = items[j];
|
||||||
items[j] = null; // gc is stupid
|
|
||||||
AddForInspection(tii.AssetID, (sbyte)tii.Type);
|
AddForInspection(tii.AssetID, (sbyte)tii.Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +520,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// avoid infinite loops
|
|
||||||
if (GatheredUuids.ContainsKey(assetUuid))
|
if (GatheredUuids.ContainsKey(assetUuid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -777,21 +775,83 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static byte[] wearableSeps = new byte[]{(byte)' ', (byte)'\t'};
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Record the uuids referenced by the given wearable asset
|
/// Record the uuids referenced by the given wearable asset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="assetBase"></param>
|
/// <param name="asset"></param>
|
||||||
private void RecordWearableAssetUuids(AssetBase assetBase)
|
private void RecordWearableAssetUuids(AssetBase asset)
|
||||||
{
|
{
|
||||||
//m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data));
|
if (asset.Data == null || asset.Data.Length < 64)
|
||||||
AssetWearable wearableAsset = new AssetBodypart(assetBase.FullID, assetBase.Data);
|
return;
|
||||||
wearableAsset.Decode();
|
try
|
||||||
|
{
|
||||||
|
osUTF8 ostmp = new osUTF8(asset.Data);
|
||||||
|
if (!ostmp.SkipLine()) // version
|
||||||
|
return;
|
||||||
|
if (!ostmp.SkipLine()) // name
|
||||||
|
return;
|
||||||
|
if (!ostmp.SkipLine()) // description
|
||||||
|
return;
|
||||||
|
if (!ostmp.SkipLine())
|
||||||
|
return;
|
||||||
|
|
||||||
//m_log.DebugFormat(
|
while(ostmp.ReadLine(out osUTF8 line))
|
||||||
// "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count);
|
{
|
||||||
|
line.SelfTrim(wearableSeps);
|
||||||
|
osUTF8[] parts = line.Split(wearableSeps);
|
||||||
|
if(parts[0].Lenght == 0)
|
||||||
|
continue;
|
||||||
|
parts[0].SelfTrim(wearableSeps);
|
||||||
|
if(parts[0].ToString() == "textures")
|
||||||
|
{
|
||||||
|
if(parts[1].Lenght == 0)
|
||||||
|
return;
|
||||||
|
parts[1].SelfTrim(wearableSeps);
|
||||||
|
if(!int.TryParse(parts[1].ToString(), out int count) || count == 0)
|
||||||
|
return;
|
||||||
|
for(int i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
if(!ostmp.ReadLine(out osUTF8 texline))
|
||||||
|
return;
|
||||||
|
texline.SelfTrim(wearableSeps);
|
||||||
|
osUTF8[] texparts = texline.Split(wearableSeps);
|
||||||
|
if(texparts.Length <2 || texparts[1].Lenght < 36)
|
||||||
|
continue;
|
||||||
|
texparts[1].SelfTrim(wearableSeps);
|
||||||
|
if (UUID.TryParse(texparts[1].ToString(), out UUID id) && id != UUID.Zero)
|
||||||
|
GatheredUuids[id] = (sbyte)AssetType.Texture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (UUID uuid in wearableAsset.Textures.Values)
|
private int getxmlheader(osUTF8 data, out osUTF8 h)
|
||||||
GatheredUuids[uuid] = (sbyte)AssetType.Texture;
|
{
|
||||||
|
h = data;
|
||||||
|
int st = -1;
|
||||||
|
while ((st = data.IndexOf('<')) >= 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (st < 0)
|
||||||
|
return -1;
|
||||||
|
++st;
|
||||||
|
int ed = -1;
|
||||||
|
while ((ed = data.IndexOf('>')) >= 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ed < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
h = data.osUTF8SubString(st, ed - st);
|
||||||
|
h.SelfTrim();
|
||||||
|
return ed + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -850,8 +910,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="gestureAsset"></param>
|
/// <param name="gestureAsset"></param>
|
||||||
private void RecordGestureAssetUuids(AssetBase gestureAsset)
|
private void RecordGestureAssetUuids(AssetBase gestureAsset)
|
||||||
{
|
{
|
||||||
using (MemoryStream ms = new MemoryStream(gestureAsset.Data))
|
using (StreamReader sr = new StreamReader(new MemoryStream(gestureAsset.Data)))
|
||||||
using (StreamReader sr = new StreamReader(ms))
|
|
||||||
{
|
{
|
||||||
sr.ReadLine(); // Unknown (Version?)
|
sr.ReadLine(); // Unknown (Version?)
|
||||||
sr.ReadLine(); // Unknown
|
sr.ReadLine(); // Unknown
|
||||||
|
|
Loading…
Reference in New Issue