autogen LSLSyntax version uuid
parent
4fae8d3d39
commit
2886408a76
|
@ -864,11 +864,24 @@ namespace OpenSim.Framework
|
||||||
private static byte[] ComputeSHA1Hash(byte[] src)
|
private static byte[] ComputeSHA1Hash(byte[] src)
|
||||||
{
|
{
|
||||||
byte[] ret;
|
byte[] ret;
|
||||||
using(SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider())
|
using (SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider())
|
||||||
ret = SHA1.ComputeHash(src);
|
ret = SHA1.ComputeHash(src);
|
||||||
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)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -330,40 +331,41 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
private void ReadScriptSyntax()
|
private void ReadScriptSyntax()
|
||||||
{
|
{
|
||||||
if(!m_doScriptSyntax || m_scriptSyntaxID != UUID.Zero)
|
lock(m_scriptSyntaxLock)
|
||||||
return;
|
|
||||||
|
|
||||||
if(!File.Exists("ScriptSyntax.xml"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
using (StreamReader sr = File.OpenText("ScriptSyntax.xml"))
|
if(!m_doScriptSyntax || m_scriptSyntaxID != UUID.Zero)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!File.Exists("ScriptSyntax.xml"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
string version = sr.ReadLine();
|
using (StreamReader sr = File.OpenText("ScriptSyntax.xml"))
|
||||||
if(string.IsNullOrEmpty(version))
|
|
||||||
return;
|
|
||||||
if(!UUID.TryParse(version, out m_scriptSyntaxID))
|
|
||||||
return;
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(400*1024);
|
|
||||||
string s="";
|
|
||||||
char[] trimc = new char[] {' ','\t', '\n', '\r'};
|
|
||||||
while((s = sr.ReadLine()) != null)
|
|
||||||
{
|
{
|
||||||
s = s.Trim(trimc);
|
StringBuilder sb = new StringBuilder(400*1024);
|
||||||
if(String.IsNullOrEmpty(s) || s.StartsWith("<--"))
|
sb.Append("<llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer>");
|
||||||
continue;
|
|
||||||
sb.Append(s);
|
string s="";
|
||||||
|
char[] trimc = new char[] {' ','\t', '\n', '\r'};
|
||||||
|
while((s = sr.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
s = s.Trim(trimc);
|
||||||
|
if(String.IsNullOrEmpty(s) || s.StartsWith("<!--"))
|
||||||
|
continue;
|
||||||
|
sb.Append(s);
|
||||||
|
}
|
||||||
|
sb.Append("</map></llsd>");
|
||||||
|
m_scriptSyntaxXML = sb.ToString();
|
||||||
|
m_scriptSyntaxID = Util.ComputeSHA1UUID(m_scriptSyntaxXML);
|
||||||
}
|
}
|
||||||
m_scriptSyntaxXML = sb.ToString();
|
|
||||||
}
|
}
|
||||||
}
|
catch
|
||||||
catch
|
{
|
||||||
{
|
m_log.Error("[SIMULATOR FEATURES MODULE] fail read ScriptSyntax.xml file");
|
||||||
m_log.Error("[SIMULATOR FEATURES MODULE] fail read ScriptSyntax.xml file");
|
m_scriptSyntaxID = UUID.Zero;
|
||||||
m_scriptSyntaxID = UUID.Zero;
|
m_scriptSyntaxXML = "";
|
||||||
m_scriptSyntaxXML = "";
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
34319
bin/ScriptSyntax.xml
34319
bin/ScriptSyntax.xml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue