change uuids on scripts gather

This commit is contained in:
UbitUmarov
2020-02-08 18:45:38 +00:00
parent ce72aa2eac
commit c239269762
2 changed files with 128 additions and 5 deletions

View File

@@ -843,6 +843,130 @@ namespace OpenSim.Framework
return ids;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
static bool IsHexa(byte c)
{
if (c >= '0' && c <= '9')
return true;
if (c >= 'a' && c <= 'f')
return true;
if (c >= 'A' && c <= 'F')
return true;
return false;
}
public static List<UUID> GetUUIDsOnData(byte[] s, int indx, int len)
{
var ids = new List<UUID>();
int endA = indx + len;
if (endA > s.Length)
endA = s.Length;
if (endA - indx < 36)
return ids;
int endB = endA - 26;
endA -= 35;
int idbase;
int next;
int retry;
while (indx < endA)
{
for (; indx < endA; ++indx)
{
if (IsHexa(s[indx]))
break;
}
if (indx == endA)
break;
idbase = indx;
for (; indx < endB; ++indx)
{
if (!IsHexa(s[indx]))
break;
if (indx - idbase >= 8)
++idbase;
}
if (s[indx] != '-')
continue;
++indx;
retry = indx;
next = indx + 4;
for (; indx < next; ++indx)
{
if (!IsHexa(s[indx]))
break;
}
if (indx != next)
continue;
if (s[indx] != '-')
{
indx = retry;
continue;
}
++indx;
retry = indx;
next = indx + 4;
for (; indx < next; ++indx)
{
if (!IsHexa(s[indx]))
break;
}
if (indx != next)
continue;
if (s[indx] != '-')
{
indx = retry;
continue;
}
++indx;
retry = indx;
next = indx + 4;
for (; indx < next; ++indx)
{
if (!IsHexa(s[indx]))
break;
}
if (indx != next)
continue;
if (s[indx] != '-')
{
indx = retry;
continue;
}
++indx;
retry = indx;
next = indx + 12;
for (; indx < next; ++indx)
{
if (!IsHexa(s[indx]))
break;
}
if (indx != next)
continue;
if (UUID.TryParse(Encoding.ASCII.GetString(s, idbase, 36), out UUID u))
{
ids.Add(u);
}
++indx;
}
return ids;
}
/// <summary>
/// Is the platform Windows?
/// </summary>