mirror of
https://github.com/opensim/opensim.git
synced 2026-08-02 14:56:19 +08:00
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
This commit is contained in:
@@ -52,4 +52,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
//SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
|
||||
private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
|
||||
private static UInt64 scriptCompileCounter = 0;
|
||||
private static int instanceID = new Random().Next(0, int.MaxValue); // Implemented due to peer preassure --- will cause garbage in ScriptEngines folder ;)
|
||||
|
||||
private static int instanceID = new Random().Next(0, int.MaxValue);
|
||||
// Implemented due to peer preassure --- will cause garbage in ScriptEngines folder ;)
|
||||
|
||||
//private ICodeCompiler icc = codeProvider.CreateCompiler();
|
||||
public string CompileFromFile(string LSOFileName)
|
||||
{
|
||||
@@ -83,7 +86,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
{
|
||||
// Output assembly name
|
||||
scriptCompileCounter++;
|
||||
string OutFile = Path.Combine("ScriptEngines", "DotNetScript_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll");
|
||||
string OutFile =
|
||||
Path.Combine("ScriptEngines",
|
||||
"DotNetScript_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll");
|
||||
try
|
||||
{
|
||||
File.Delete(OutFile);
|
||||
|
||||
@@ -316,8 +316,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
|
||||
|
||||
quotes.Clear();
|
||||
|
||||
|
||||
return Return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1638,7 +1638,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
|
||||
public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end)
|
||||
{
|
||||
return m_LSL_Functions.llListReplaceList(dest,src,start,end);
|
||||
return m_LSL_Functions.llListReplaceList(dest, src, start, end);
|
||||
}
|
||||
|
||||
public void llLoadURL(string avatar_id, string message, string url)
|
||||
@@ -2025,7 +2025,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
public const int REMOTE_DATA_CHANNEL = 1;
|
||||
public const int REMOTE_DATA_REQUEST = 2;
|
||||
public const int REMOTE_DATA_REPLY = 3;
|
||||
|
||||
|
||||
public const int PRIM_MATERIAL = 2;
|
||||
public const int PRIM_PHYSICS = 3;
|
||||
public const int PRIM_TEMP_ON_REZ = 4;
|
||||
@@ -2041,7 +2041,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
public const int PRIM_FLEXIBLE = 21;
|
||||
public const int PRIM_TEXGEN = 22;
|
||||
public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
|
||||
public const int PRIM_POINT_LIGHT = 23; // Huh?
|
||||
public const int PRIM_POINT_LIGHT = 23; // Huh?
|
||||
public const int PRIM_TEXGEN_DEFAULT = 0;
|
||||
public const int PRIM_TEXGEN_PLANAR = 1;
|
||||
public const int PRIM_TYPE_BOX = 0;
|
||||
@@ -2122,4 +2122,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
public vector ZERO_VECTOR = new vector(0, 0, 0);
|
||||
public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,13 +28,11 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Axiom.Math;
|
||||
using libsecondlife;
|
||||
using libsecondlife.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
@@ -217,4 +217,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,9 +184,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
#if DEBUG
|
||||
m_ScriptEngine.Log.Debug("ScriptEngine", "Executing event:\r\n"
|
||||
+ "QIS.localID: " + QIS.localID
|
||||
+ ", QIS.itemID: " + QIS.itemID
|
||||
+ ", QIS.functionName: " + QIS.functionName);
|
||||
+ "QIS.localID: " + QIS.localID
|
||||
+ ", QIS.itemID: " + QIS.itemID
|
||||
+ ", QIS.functionName: " + QIS.functionName);
|
||||
#endif
|
||||
m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID,
|
||||
QIS.functionName, QIS.param);
|
||||
@@ -197,14 +197,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
string text = "Error executing script function \"" + QIS.functionName + "\":\r\n";
|
||||
//if (e.InnerException != null)
|
||||
//{
|
||||
// Send inner exception
|
||||
text += e.InnerException.Message.ToString();
|
||||
// Send inner exception
|
||||
text += e.InnerException.Message.ToString();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
text += "\r\n";
|
||||
// Send normal
|
||||
text += e.Message.ToString();
|
||||
text += "\r\n";
|
||||
// Send normal
|
||||
text += e.Message.ToString();
|
||||
//}
|
||||
try
|
||||
{
|
||||
@@ -222,7 +222,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
//else
|
||||
//{
|
||||
// T oconsole
|
||||
m_ScriptEngine.Log.Error("ScriptEngine", "Unable to send text in-world:\r\n" + text);
|
||||
m_ScriptEngine.Log.Error("ScriptEngine",
|
||||
"Unable to send text in-world:\r\n" + text);
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -338,4 +339,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,17 +202,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
|
||||
public void CheckHttpRequests()
|
||||
{
|
||||
IHttpRequests iHttpReq =
|
||||
IHttpRequests iHttpReq =
|
||||
m_ScriptEngine.World.RequestModuleInterface<IHttpRequests>();
|
||||
|
||||
HttpRequestClass httpInfo = null;
|
||||
|
||||
if( iHttpReq != null )
|
||||
if (iHttpReq != null)
|
||||
httpInfo = iHttpReq.GetNextCompletedRequest();
|
||||
|
||||
while ( httpInfo != null )
|
||||
while (httpInfo != null)
|
||||
{
|
||||
|
||||
//Console.WriteLine("PICKED HTTP REQ:" + httpInfo.response_body + httpInfo.status);
|
||||
|
||||
// Deliver data to prim's remote_data handler
|
||||
@@ -221,7 +220,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
// only returns the byte for HTTP_BODY_TRUNCATED, which is not
|
||||
// implemented here yet anyway. Should be fixed if/when maxsize
|
||||
// is supported
|
||||
|
||||
|
||||
object[] resobj = new object[]
|
||||
{
|
||||
httpInfo.reqID.ToString(), httpInfo.status, null, httpInfo.response_body
|
||||
@@ -254,7 +253,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
//Deliver data to prim's remote_data handler
|
||||
object[] resobj = new object[]
|
||||
{
|
||||
2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(),
|
||||
2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "",
|
||||
rInfo.GetIntValue(),
|
||||
rInfo.GetStrVal()
|
||||
};
|
||||
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
|
||||
@@ -284,4 +284,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,4 +121,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,7 +224,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
|
||||
#region Start/Stop/Reset script
|
||||
|
||||
Object startStopLock = new Object();
|
||||
private Object startStopLock = new Object();
|
||||
|
||||
/// <summary>
|
||||
/// Fetches, loads and hooks up a script to an objects events
|
||||
@@ -261,7 +261,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
}
|
||||
|
||||
// Create a new instance of the compiler (reuse)
|
||||
Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler();
|
||||
private Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler();
|
||||
|
||||
private void _StartScript(uint localID, LLUUID itemID, string Script)
|
||||
{
|
||||
lock (startStopLock)
|
||||
@@ -316,7 +317,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
CompiledScript.Start(LSLB);
|
||||
|
||||
// Fire the first start-event
|
||||
m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { });
|
||||
m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -327,12 +328,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
string text = "Error compiling script:\r\n" + e.Message.ToString();
|
||||
if (text.Length > 1500)
|
||||
text = text.Substring(0, 1500);
|
||||
World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition,
|
||||
m_host.Name, m_host.UUID);
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString());
|
||||
m_scriptEngine.Log.Error("ScriptEngine", "Errormessage: Error compiling script:\r\n" + e.Message.ToString());
|
||||
m_scriptEngine.Log.Error("ScriptEngine",
|
||||
"Errormessage: Error compiling script:\r\n" + e.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,38 +345,38 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
lock (startStopLock)
|
||||
{
|
||||
// Stop script
|
||||
Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString());
|
||||
// Stop script
|
||||
Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString());
|
||||
|
||||
|
||||
// Stop long command on script
|
||||
m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID);
|
||||
// Stop long command on script
|
||||
m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID);
|
||||
|
||||
LSL_BaseClass LSLBC = GetScript(localID, itemID);
|
||||
if (LSLBC == null)
|
||||
return;
|
||||
LSL_BaseClass LSLBC = GetScript(localID, itemID);
|
||||
if (LSLBC == null)
|
||||
return;
|
||||
|
||||
// TEMP: First serialize it
|
||||
//GetSerializedScript(localID, itemID);
|
||||
// TEMP: First serialize it
|
||||
//GetSerializedScript(localID, itemID);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// Get AppDomain
|
||||
AppDomain ad = LSLBC.Exec.GetAppDomain();
|
||||
// Tell script not to accept new requests
|
||||
GetScript(localID, itemID).Exec.StopScript();
|
||||
// Remove from internal structure
|
||||
RemoveScript(localID, itemID);
|
||||
// Tell AppDomain that we have stopped script
|
||||
m_scriptEngine.m_AppDomainManager.StopScript(ad);
|
||||
try
|
||||
{
|
||||
// Get AppDomain
|
||||
AppDomain ad = LSLBC.Exec.GetAppDomain();
|
||||
// Tell script not to accept new requests
|
||||
GetScript(localID, itemID).Exec.StopScript();
|
||||
// Remove from internal structure
|
||||
RemoveScript(localID, itemID);
|
||||
// Tell AppDomain that we have stopped script
|
||||
m_scriptEngine.m_AppDomainManager.StopScript(ad);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
|
||||
": " + e.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
|
||||
": " + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string ProcessYield(string FileName)
|
||||
@@ -435,4 +438,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user