autogen LSLSyntax version uuid

0.9.1.0-post-fixes
UbitUmarov 2018-10-19 18:35:31 +01:00
parent 4fae8d3d39
commit 2886408a76
3 changed files with 16453 additions and 17947 deletions

View File

@ -869,6 +869,19 @@ namespace OpenSim.Framework
return ret;
}
public static UUID ComputeSHA1UUID(string src)
{
return ComputeSHA1UUID(Encoding.Default.GetBytes(src));
}
public static UUID ComputeSHA1UUID(byte[] src)
{
byte[] ret;
using (SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider())
ret = SHA1.ComputeHash(src);
return new UUID(ret, 2);
}
public static int fast_distance2d(int x, int y)
{
x = Math.Abs(x);

View File

@ -77,16 +77,17 @@ namespace OpenSim.Region.ClientStack.Linden
private string m_GridName = string.Empty;
private string m_GridURL = string.Empty;
private bool m_doScriptSyntax;
static private object m_scriptSyntaxLock = new object();
static private UUID m_scriptSyntaxID = UUID.Zero;
static private string m_scriptSyntaxXML;
private bool m_doScriptSyntax;
#region ISharedRegionModule Members
public void Initialise(IConfigSource source)
{
IConfig config = source.Configs["SimulatorFeatures"];
m_doScriptSyntax = false;
m_doScriptSyntax = true;
if (config != null)
{
//
@ -329,6 +330,8 @@ namespace OpenSim.Region.ClientStack.Linden
}
private void ReadScriptSyntax()
{
lock(m_scriptSyntaxLock)
{
if(!m_doScriptSyntax || m_scriptSyntaxID != UUID.Zero)
return;
@ -340,23 +343,21 @@ namespace OpenSim.Region.ClientStack.Linden
{
using (StreamReader sr = File.OpenText("ScriptSyntax.xml"))
{
string version = sr.ReadLine();
if(string.IsNullOrEmpty(version))
return;
if(!UUID.TryParse(version, out m_scriptSyntaxID))
return;
StringBuilder sb = new StringBuilder(400*1024);
sb.Append("<llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer>");
string s="";
char[] trimc = new char[] {' ','\t', '\n', '\r'};
while((s = sr.ReadLine()) != null)
{
s = s.Trim(trimc);
if(String.IsNullOrEmpty(s) || s.StartsWith("<--"))
if(String.IsNullOrEmpty(s) || s.StartsWith("<!--"))
continue;
sb.Append(s);
}
sb.Append("</map></llsd>");
m_scriptSyntaxXML = sb.ToString();
m_scriptSyntaxID = Util.ComputeSHA1UUID(m_scriptSyntaxXML);
}
}
catch
@ -368,3 +369,4 @@ namespace OpenSim.Region.ClientStack.Linden
}
}
}
}

File diff suppressed because it is too large Load Diff