diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index a6a4b1c..1c4b538 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | |||
@@ -77,16 +77,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
77 | private string m_GridName = string.Empty; | 77 | private string m_GridName = string.Empty; |
78 | private string m_GridURL = string.Empty; | 78 | private string m_GridURL = string.Empty; |
79 | 79 | ||
80 | private bool m_doScriptSyntax; | ||
81 | static private object m_scriptSyntaxLock = new object(); | ||
80 | static private UUID m_scriptSyntaxID = UUID.Zero; | 82 | static private UUID m_scriptSyntaxID = UUID.Zero; |
81 | static private string m_scriptSyntaxXML; | 83 | static private string m_scriptSyntaxXML; |
82 | private bool m_doScriptSyntax; | ||
83 | 84 | ||
84 | #region ISharedRegionModule Members | 85 | #region ISharedRegionModule Members |
85 | 86 | ||
86 | public void Initialise(IConfigSource source) | 87 | public void Initialise(IConfigSource source) |
87 | { | 88 | { |
88 | IConfig config = source.Configs["SimulatorFeatures"]; | 89 | IConfig config = source.Configs["SimulatorFeatures"]; |
89 | m_doScriptSyntax = false; | 90 | m_doScriptSyntax = true; |
90 | if (config != null) | 91 | if (config != null) |
91 | { | 92 | { |
92 | // | 93 | // |
@@ -330,40 +331,41 @@ namespace OpenSim.Region.ClientStack.Linden | |||
330 | 331 | ||
331 | private void ReadScriptSyntax() | 332 | private void ReadScriptSyntax() |
332 | { | 333 | { |
333 | if(!m_doScriptSyntax || m_scriptSyntaxID != UUID.Zero) | 334 | lock(m_scriptSyntaxLock) |
334 | return; | 335 | { |
336 | if(!m_doScriptSyntax || m_scriptSyntaxID != UUID.Zero) | ||
337 | return; | ||
335 | 338 | ||
336 | if(!File.Exists("ScriptSyntax.xml")) | 339 | if(!File.Exists("ScriptSyntax.xml")) |
337 | return; | 340 | return; |
338 | 341 | ||
339 | try | 342 | try |
340 | { | ||
341 | using (StreamReader sr = File.OpenText("ScriptSyntax.xml")) | ||
342 | { | 343 | { |
343 | string version = sr.ReadLine(); | 344 | using (StreamReader sr = File.OpenText("ScriptSyntax.xml")) |
344 | if(string.IsNullOrEmpty(version)) | ||
345 | return; | ||
346 | if(!UUID.TryParse(version, out m_scriptSyntaxID)) | ||
347 | return; | ||
348 | |||
349 | StringBuilder sb = new StringBuilder(400*1024); | ||
350 | string s=""; | ||
351 | char[] trimc = new char[] {' ','\t', '\n', '\r'}; | ||
352 | while((s = sr.ReadLine()) != null) | ||
353 | { | 345 | { |
354 | s = s.Trim(trimc); | 346 | StringBuilder sb = new StringBuilder(400*1024); |
355 | if(String.IsNullOrEmpty(s) || s.StartsWith("<--")) | 347 | sb.Append("<llsd><map><key>llsd-lsl-syntax-version</key><integer>2</integer>"); |
356 | continue; | 348 | |
357 | sb.Append(s); | 349 | string s=""; |
350 | char[] trimc = new char[] {' ','\t', '\n', '\r'}; | ||
351 | while((s = sr.ReadLine()) != null) | ||
352 | { | ||
353 | s = s.Trim(trimc); | ||
354 | if(String.IsNullOrEmpty(s) || s.StartsWith("<!--")) | ||
355 | continue; | ||
356 | sb.Append(s); | ||
357 | } | ||
358 | sb.Append("</map></llsd>"); | ||
359 | m_scriptSyntaxXML = sb.ToString(); | ||
360 | m_scriptSyntaxID = Util.ComputeSHA1UUID(m_scriptSyntaxXML); | ||
358 | } | 361 | } |
359 | m_scriptSyntaxXML = sb.ToString(); | ||
360 | } | 362 | } |
361 | } | 363 | catch |
362 | catch | 364 | { |
363 | { | 365 | m_log.Error("[SIMULATOR FEATURES MODULE] fail read ScriptSyntax.xml file"); |
364 | m_log.Error("[SIMULATOR FEATURES MODULE] fail read ScriptSyntax.xml file"); | 366 | m_scriptSyntaxID = UUID.Zero; |
365 | m_scriptSyntaxID = UUID.Zero; | 367 | m_scriptSyntaxXML = ""; |
366 | m_scriptSyntaxXML = ""; | 368 | } |
367 | } | 369 | } |
368 | } | 370 | } |
369 | } | 371 | } |