autogen LSLSyntax version uuid
parent
4fae8d3d39
commit
2886408a76
|
@ -869,6 +869,19 @@ namespace OpenSim.Framework
|
||||||
return ret;
|
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)
|
public static int fast_distance2d(int x, int y)
|
||||||
{
|
{
|
||||||
x = Math.Abs(x);
|
x = Math.Abs(x);
|
||||||
|
|
|
@ -77,16 +77,17 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
private string m_GridName = string.Empty;
|
private string m_GridName = string.Empty;
|
||||||
private string m_GridURL = 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 UUID m_scriptSyntaxID = UUID.Zero;
|
||||||
static private string m_scriptSyntaxXML;
|
static private string m_scriptSyntaxXML;
|
||||||
private bool m_doScriptSyntax;
|
|
||||||
|
|
||||||
#region ISharedRegionModule Members
|
#region ISharedRegionModule Members
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
IConfig config = source.Configs["SimulatorFeatures"];
|
IConfig config = source.Configs["SimulatorFeatures"];
|
||||||
m_doScriptSyntax = false;
|
m_doScriptSyntax = true;
|
||||||
if (config != null)
|
if (config != null)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -329,6 +330,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReadScriptSyntax()
|
private void ReadScriptSyntax()
|
||||||
|
{
|
||||||
|
lock(m_scriptSyntaxLock)
|
||||||
{
|
{
|
||||||
if(!m_doScriptSyntax || m_scriptSyntaxID != UUID.Zero)
|
if(!m_doScriptSyntax || m_scriptSyntaxID != UUID.Zero)
|
||||||
return;
|
return;
|
||||||
|
@ -340,23 +343,21 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
{
|
{
|
||||||
using (StreamReader sr = File.OpenText("ScriptSyntax.xml"))
|
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);
|
StringBuilder sb = new StringBuilder(400*1024);
|
||||||
|
sb.Append("<llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer>");
|
||||||
|
|
||||||
string s="";
|
string s="";
|
||||||
char[] trimc = new char[] {' ','\t', '\n', '\r'};
|
char[] trimc = new char[] {' ','\t', '\n', '\r'};
|
||||||
while((s = sr.ReadLine()) != null)
|
while((s = sr.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
s = s.Trim(trimc);
|
s = s.Trim(trimc);
|
||||||
if(String.IsNullOrEmpty(s) || s.StartsWith("<--"))
|
if(String.IsNullOrEmpty(s) || s.StartsWith("<!--"))
|
||||||
continue;
|
continue;
|
||||||
sb.Append(s);
|
sb.Append(s);
|
||||||
}
|
}
|
||||||
|
sb.Append("</map></llsd>");
|
||||||
m_scriptSyntaxXML = sb.ToString();
|
m_scriptSyntaxXML = sb.ToString();
|
||||||
|
m_scriptSyntaxID = Util.ComputeSHA1UUID(m_scriptSyntaxXML);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -368,3 +369,4 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
1891
bin/ScriptSyntax.xml
1891
bin/ScriptSyntax.xml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue