mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
//Console.WriteLine("Executor: InitializeLifetimeService()");
|
||||
// return null;
|
||||
ILease lease = (ILease)base.InitializeLifetimeService();
|
||||
ILease lease = (ILease) base.InitializeLifetimeService();
|
||||
|
||||
if (lease.CurrentState == LeaseState.Initial)
|
||||
{
|
||||
@@ -75,56 +74,56 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
// Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
|
||||
//try
|
||||
//{
|
||||
if (m_Running == false)
|
||||
if (m_Running == false)
|
||||
{
|
||||
// Script is inactive, do not execute!
|
||||
return;
|
||||
}
|
||||
|
||||
string EventName = m_Script.State() + "_event_" + FunctionName;
|
||||
|
||||
//type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args);
|
||||
|
||||
//Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\"");
|
||||
|
||||
if (Events.ContainsKey(EventName) == false)
|
||||
{
|
||||
// Not found, create
|
||||
Type type = m_Script.GetType();
|
||||
try
|
||||
{
|
||||
// Script is inactive, do not execute!
|
||||
return;
|
||||
MethodInfo mi = type.GetMethod(EventName);
|
||||
Events.Add(EventName, mi);
|
||||
}
|
||||
|
||||
string EventName = m_Script.State() + "_event_" + FunctionName;
|
||||
|
||||
//type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args);
|
||||
|
||||
//Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\"");
|
||||
|
||||
if (Events.ContainsKey(EventName) == false)
|
||||
catch
|
||||
{
|
||||
// Not found, create
|
||||
Type type = m_Script.GetType();
|
||||
try
|
||||
{
|
||||
MethodInfo mi = type.GetMethod(EventName);
|
||||
Events.Add(EventName, mi);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Event name not found, cache it as not found
|
||||
Events.Add(EventName, null);
|
||||
}
|
||||
// Event name not found, cache it as not found
|
||||
Events.Add(EventName, null);
|
||||
}
|
||||
}
|
||||
|
||||
// Get event
|
||||
MethodInfo ev = null;
|
||||
Events.TryGetValue(EventName, out ev);
|
||||
// Get event
|
||||
MethodInfo ev = null;
|
||||
Events.TryGetValue(EventName, out ev);
|
||||
|
||||
if (ev == null) // No event by that name!
|
||||
{
|
||||
//Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\"");
|
||||
return;
|
||||
}
|
||||
if (ev == null) // No event by that name!
|
||||
{
|
||||
//Console.WriteLine("ScriptEngine Can not find any event named: \"" + EventName + "\"");
|
||||
return;
|
||||
}
|
||||
|
||||
// Found
|
||||
//try
|
||||
//{
|
||||
// Invoke it
|
||||
ev.Invoke(m_Script, args);
|
||||
// Found
|
||||
//try
|
||||
//{
|
||||
// Invoke it
|
||||
ev.Invoke(m_Script, args);
|
||||
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// // TODO: Send to correct place
|
||||
// Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString());
|
||||
//}
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// // TODO: Send to correct place
|
||||
// Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString());
|
||||
//}
|
||||
|
||||
|
||||
//}
|
||||
@@ -136,8 +135,5 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
m_Running = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user