* Optimized usings

* shortened references
* Removed redundant 'this'
* Normalized EOF
This commit is contained in:
lbsa71
2007-12-27 21:41:48 +00:00
parent d508d77122
commit efd90b56b7
277 changed files with 4685 additions and 4408 deletions

View File

@@ -634,4 +634,4 @@ namespace OpenSim.Region.ScriptEngine.Common
//OpenSim functions
string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
}
}
}

View File

@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Common
{
if (!(o is Vector3)) return false;
Vector3 vector = (Vector3)o;
Vector3 vector = (Vector3) o;
return (x == vector.x && x == vector.x && z == vector.z);
}
@@ -88,11 +88,12 @@ namespace OpenSim.Region.ScriptEngine.Common
#endregion
#region Vector & Vector Math
// Vector-Vector Math
public static Vector3 operator +(Vector3 lhs, Vector3 rhs)
{
return new Vector3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z);
}
}
public static Vector3 operator -(Vector3 lhs, Vector3 rhs)
{
@@ -101,51 +102,53 @@ namespace OpenSim.Region.ScriptEngine.Common
public static Vector3 operator *(Vector3 lhs, Vector3 rhs)
{
return new Vector3(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z);
return new Vector3(lhs.x*rhs.x, lhs.y*rhs.y, lhs.z*rhs.z);
}
public static Vector3 operator %(Vector3 v1, Vector3 v2)
{
//Cross product
Vector3 tv;
tv.x = (v1.y * v2.z) - (v1.z * v2.y);
tv.y = (v1.z * v2.x) - (v1.x * v2.z);
tv.z = (v1.x * v2.y) - (v1.y * v2.x);
tv.x = (v1.y*v2.z) - (v1.z*v2.y);
tv.y = (v1.z*v2.x) - (v1.x*v2.z);
tv.z = (v1.x*v2.y) - (v1.y*v2.x);
return tv;
}
#endregion
#region Vector & Float Math
// Vector-Float and Float-Vector Math
public static Vector3 operator *(Vector3 vec, float val)
{
return new Vector3(vec.x * val, vec.y * val, vec.z * val);
return new Vector3(vec.x*val, vec.y*val, vec.z*val);
}
public static Vector3 operator *(float val, Vector3 vec)
{
return new Vector3(vec.x * val, vec.y * val, vec.z * val);
return new Vector3(vec.x*val, vec.y*val, vec.z*val);
}
public static Vector3 operator /(Vector3 v, float f)
{
v.x = v.x / f;
v.y = v.y / f;
v.z = v.z / f;
v.x = v.x/f;
v.y = v.y/f;
v.z = v.z/f;
return v;
}
#endregion
#region Vector & Rotation Math
// Vector-Rotation Math
public static Vector3 operator *(Vector3 v, Quaternion r)
{
Quaternion vq = new Quaternion(v.x, v.y, v.z, 0);
Quaternion nq = new Quaternion(-r.x, -r.y, -r.z, r.s);
Quaternion result = (r * vq) * nq;
Quaternion result = (r*vq)*nq;
return new Vector3(result.x, result.y, result.z);
}
@@ -157,38 +160,41 @@ namespace OpenSim.Region.ScriptEngine.Common
Quaternion vq = new Quaternion(vec.x, vec.y, vec.z, 0);
Quaternion nq = new Quaternion(-quat.x, -quat.y, -quat.z, quat.s);
Quaternion result = (quat * vq) * nq;
Quaternion result = (quat*vq)*nq;
return new Vector3(result.x, result.y, result.z);
}
#endregion
#region Static Helper Functions
public static double Dot(Vector3 v1, Vector3 v2)
{
return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z);
return (v1.x*v2.x) + (v1.y*v2.y) + (v1.z*v2.z);
}
public static Vector3 Cross(Vector3 v1, Vector3 v2)
{
return new Vector3
(
v1.y * v2.z - v1.z * v2.y,
v1.z * v2.x - v1.x * v2.z,
v1.x * v2.y - v1.y * v2.x
);
(
v1.y*v2.z - v1.z*v2.y,
v1.z*v2.x - v1.x*v2.z,
v1.x*v2.y - v1.y*v2.x
);
}
public static float Mag(Vector3 v)
{
return (float)Math.Sqrt(v.x * v.y + v.y * v.y + v.z * v.z);
return (float) Math.Sqrt(v.x*v.y + v.y*v.y + v.z*v.z);
}
public static Vector3 Norm(Vector3 vector)
{
float mag = Mag(vector);
return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag);
return new Vector3(vector.x/mag, vector.y/mag, vector.z/mag);
}
#endregion
}
@@ -227,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Common
{
if (!(o is Quaternion)) return false;
Quaternion quaternion = (Quaternion)o;
Quaternion quaternion = (Quaternion) o;
return x == quaternion.x && y == quaternion.y && z == quaternion.z && s == quaternion.s;
}
@@ -253,10 +259,10 @@ namespace OpenSim.Region.ScriptEngine.Common
public static Quaternion operator *(Quaternion a, Quaternion b)
{
Quaternion c;
c.x = a.s * b.x + a.x * b.s + a.y * b.z - a.z * b.y;
c.y = a.s * b.y + a.y * b.s + a.z * b.x - a.x * b.z;
c.z = a.s * b.z + a.z * b.s + a.x * b.y - a.y * b.x;
c.s = a.s * b.s - a.x * b.x - a.y * b.y - a.z * b.z;
c.x = a.s*b.x + a.x*b.s + a.y*b.z - a.z*b.y;
c.y = a.s*b.y + a.y*b.s + a.z*b.x - a.x*b.z;
c.z = a.s*b.z + a.z*b.s + a.x*b.y - a.y*b.x;
c.s = a.s*b.s - a.x*b.x - a.y*b.y - a.z*b.z;
return c;
}
}
@@ -324,7 +330,7 @@ namespace OpenSim.Region.ScriptEngine.Common
{
if (start >= m_data.Length)
{
return this.GetSublist(0, end);
return GetSublist(0, end);
}
if (end >= m_data.Length)
{
@@ -334,7 +340,7 @@ namespace OpenSim.Region.ScriptEngine.Common
//ret = new object[m_data.Length - Math.Abs(end - start + 1)];
//Array.Copy(m_data, 0, ret, m_data.Length - start, end + 1);
//Array.Copy(m_data, start, ret, 0, m_data.Length - start);
return this.GetSublist(0, end) + this.GetSublist(start, this.Data.Length - 1);
return GetSublist(0, end) + GetSublist(start, Data.Length - 1);
//return new list(ret);
}
}
@@ -379,4 +385,4 @@ namespace OpenSim.Region.ScriptEngine.Common
}
}
}
}
}

View File

@@ -52,4 +52,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
//SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
}
}
}
}

View File

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

View File

@@ -316,8 +316,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
quotes.Clear();
return Return;
}
}
}
}

View File

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

View File

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

View File

@@ -217,4 +217,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
}
}
}
}

View File

@@ -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
}
}
}
}
}

View File

@@ -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
}
}
}
}
}

View File

@@ -121,4 +121,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
#endregion
}
}
}

View File

@@ -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
}
}
}