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

@ -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);

View File

@ -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
@ -367,4 +368,5 @@ namespace OpenSim.Region.ClientStack.Linden
} }
} }
} }
}
} }

File diff suppressed because it is too large Load Diff