Prevent scripts from running under multiple engines at once

0.6.0-stable
Melanie Thielker 2008-09-22 02:11:40 +00:00
parent 1602ba6175
commit 79ac01fb0c
2 changed files with 16 additions and 8 deletions

View File

@ -194,12 +194,16 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine)
{
if (script.Length > 15)
int lineEnd = script.IndexOf('\n');
if (lineEnd != 1)
{
if (script.Substring(0, 15) == "//DotNetEngine:")
string firstline = script.Substring(0, lineEnd).Trim();
int colon = firstline.IndexOf(':');
if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1)
{
script = "//" + script.Substring(15);
engine = "DotNetEngine";
engine = firstline.Substring(2, colon-2);
}
}

View File

@ -341,12 +341,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine)
{
if (script.Length > 10)
int lineEnd = script.IndexOf('\n');
if (lineEnd != 1)
{
if (script.Substring(0, 10) == "//XEngine:")
string firstline = script.Substring(0, lineEnd).Trim();
int colon = firstline.IndexOf(':');
if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1)
{
script = "//" + script.Substring(10);
engine = "XEngine";
engine = firstline.Substring(2, colon-2);
}
}