Hiding evidence that I once was a VB coder (thanks to refactoring). Renamed member names to smallcapsy.

afrisby
Tedd Hansen 2007-09-13 11:11:08 +00:00
parent 615487a756
commit cef8c5e9d7
13 changed files with 140 additions and 140 deletions

View File

@ -164,7 +164,6 @@ namespace OpenSim.Framework.Data
ArrayList SendParams = new ArrayList();
SendParams.Add(requestData);
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
Console.WriteLine("Requesting response from GridServer URL: " + gridserver_url);
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
Hashtable responseData = (Hashtable)GridResp.Value;

View File

@ -173,6 +173,7 @@ namespace OpenSim.Framework.UserManagement
/// <returns>Authenticated?</returns>
public virtual bool AuthenticateUser(UserProfileData profile, string password)
{
MainLog.Instance.Verbose(
"Authenticating " + profile.username + " " + profile.surname);

View File

@ -15,11 +15,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
public class AppDomainManager
{
private int MaxScriptsPerAppDomain = 1;
private int maxScriptsPerAppDomain = 1;
/// <summary>
/// Internal list of all AppDomains
/// </summary>
private List<AppDomainStructure> AppDomains = new List<AppDomainStructure>();
private List<AppDomainStructure> appDomains = new List<AppDomainStructure>();
/// <summary>
/// Structure to keep track of data around AppDomain
/// </summary>
@ -41,9 +41,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
/// <summary>
/// Current AppDomain
/// </summary>
private AppDomainStructure CurrentAD;
private object GetLock = new object(); // Mutex
private object FreeLock = new object(); // Mutex
private AppDomainStructure currentAD;
private object getLock = new object(); // Mutex
private object freeLock = new object(); // Mutex
//private ScriptEngine m_scriptEngine;
//public AppDomainManager(ScriptEngine scriptEngine)
@ -59,25 +59,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
private AppDomainStructure GetFreeAppDomain()
{
Console.WriteLine("Finding free AppDomain");
lock (GetLock)
lock (getLock)
{
// Current full?
if (CurrentAD != null && CurrentAD.ScriptsLoaded >= MaxScriptsPerAppDomain)
if (currentAD != null && currentAD.ScriptsLoaded >= maxScriptsPerAppDomain)
{
// Add it to AppDomains list and empty current
AppDomains.Add(CurrentAD);
CurrentAD = null;
appDomains.Add(currentAD);
currentAD = null;
}
// No current
if (CurrentAD == null)
if (currentAD == null)
{
// Create a new current AppDomain
CurrentAD = new AppDomainStructure();
CurrentAD.CurrentAppDomain = PrepareNewAppDomain();
currentAD = new AppDomainStructure();
currentAD.CurrentAppDomain = PrepareNewAppDomain();
}
Console.WriteLine("Scripts loaded in this Appdomain: " + CurrentAD.ScriptsLoaded);
return CurrentAD;
Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded);
return currentAD;
} // lock
}
@ -112,13 +112,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
/// </summary>
private void UnloadAppDomains()
{
lock (FreeLock)
lock (freeLock)
{
// Go through all
foreach (AppDomainStructure ads in new System.Collections.ArrayList(AppDomains))
foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains))
{
// Don't process current AppDomain
if (ads.CurrentAppDomain != CurrentAD.CurrentAppDomain)
if (ads.CurrentAppDomain != currentAD.CurrentAppDomain)
{
// Not current AppDomain
// Is number of unloaded bigger or equal to number of loaded?
@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
Console.WriteLine("Found empty AppDomain, unloading");
// Remove from internal list
AppDomains.Remove(ads);
appDomains.Remove(ads);
#if DEBUG
long m = GC.GetTotalMemory(true);
#endif
@ -164,19 +164,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
//[Obsolete("Needs fixing, needs a real purpose in life!!!")]
public void StopScript(AppDomain ad)
{
lock (FreeLock)
lock (freeLock)
{
Console.WriteLine("Stopping script in AppDomain");
// Check if it is current AppDomain
if (CurrentAD.CurrentAppDomain == ad)
if (currentAD.CurrentAppDomain == ad)
{
// Yes - increase
CurrentAD.ScriptsWaitingUnload++;
currentAD.ScriptsWaitingUnload++;
return;
}
// Lopp through all AppDomains
foreach (AppDomainStructure ads in new System.Collections.ArrayList(AppDomains))
foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains))
{
if (ads.CurrentAppDomain == ad)
{

View File

@ -34,7 +34,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
public static class Common
{
static public bool Debug = true;
static public bool debug = true;
static public ScriptEngine mySE;
//public delegate void SendToDebugEventDelegate(string Message);

View File

@ -13,7 +13,7 @@ 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 UInt64 scriptCompileCounter = 0;
//private ICodeCompiler icc = codeProvider.CreateCompiler();
public string CompileFromFile(string LSOFileName)
{
@ -49,8 +49,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
// Output assembly name
ScriptCompileCounter++;
string OutFile = Path.Combine("ScriptEngines", "Script_" + ScriptCompileCounter + ".dll");
scriptCompileCounter++;
string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll");
try
{
System.IO.File.Delete(OutFile);

View File

@ -8,21 +8,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
public class LSL2CSConverter
{
//private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled);
private Dictionary<string, string> DataTypes = new Dictionary<string, string>();
private Dictionary<string, string> QUOTES = new Dictionary<string, string>();
private Dictionary<string, string> dataTypes = new Dictionary<string, string>();
private Dictionary<string, string> quotes = new Dictionary<string, string>();
public LSL2CSConverter()
{
// Only the types we need to convert
DataTypes.Add("void", "void");
DataTypes.Add("integer", "int");
DataTypes.Add("float", "double");
DataTypes.Add("string", "string");
DataTypes.Add("key", "string");
DataTypes.Add("vector", "LSL_Types.Vector3");
DataTypes.Add("rotation", "LSL_Types.Quaternion");
DataTypes.Add("list", "list");
DataTypes.Add("null", "null");
dataTypes.Add("void", "void");
dataTypes.Add("integer", "int");
dataTypes.Add("float", "double");
dataTypes.Add("string", "string");
dataTypes.Add("key", "string");
dataTypes.Add("vector", "LSL_Types.Vector3");
dataTypes.Add("rotation", "LSL_Types.Quaternion");
dataTypes.Add("list", "list");
dataTypes.Add("null", "null");
}
@ -74,7 +74,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
_Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]);
}
// We just left a quote
QUOTES.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote);
quotes.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote);
quote = "";
}
break;
@ -189,10 +189,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
foreach (string key in DataTypes.Keys)
foreach (string key in dataTypes.Keys)
{
string val;
DataTypes.TryGetValue(key, out val);
dataTypes.TryGetValue(key, out val);
// Replace CAST - (integer) with (int)
Script = Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", RegexOptions.Compiled | RegexOptions.Multiline);
@ -217,10 +217,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
// REPLACE BACK QUOTES
foreach (string key in QUOTES.Keys)
foreach (string key in quotes.Keys)
{
string val;
QUOTES.TryGetValue(key, out val);
quotes.TryGetValue(key, out val);
Script = Script.Replace(key, "\"" + val + "\"");
}

View File

@ -302,7 +302,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llSetTimerEvent(double sec)
{
// Setting timer repeat
m_ScriptEngine.myLSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
}
public void llSleep(double sec)

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Add to queue for all scripts in ObjectID object
//myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start");
//Console.WriteLine("touch_start localID: " + localID);
myScriptEngine.myEventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 });
myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 });
}
public void OnRezScript(uint localID, LLUUID itemID, string script)
{
@ -72,7 +72,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
//);
Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length);
myScriptEngine.myScriptManager.StartScript(localID, itemID, script);
myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script);
}
public void OnRemoveScript(uint localID, LLUUID itemID)
{
@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost()
//);
Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString());
myScriptEngine.myScriptManager.StopScript(
myScriptEngine.m_ScriptManager.StopScript(
localID,
itemID
);

View File

@ -47,20 +47,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
/// <summary>
/// List of threads processing event queue
/// </summary>
private List<Thread> EventQueueThreads = new List<Thread>();
private object QueueLock = new object(); // Mutex lock object
private List<Thread> eventQueueThreads = new List<Thread>();
private object queueLock = new object(); // Mutex lock object
/// <summary>
/// How many ms to sleep if queue is empty
/// </summary>
private int NothingToDoSleepms = 50;
private int nothingToDoSleepms = 50;
/// <summary>
/// How many threads to process queue with
/// </summary>
private int NumberOfThreads = 2;
private int numberOfThreads = 2;
/// <summary>
/// Queue containing events waiting to be executed
/// </summary>
private Queue<QueueItemStruct> EventQueue = new Queue<QueueItemStruct>();
private Queue<QueueItemStruct> eventQueue = new Queue<QueueItemStruct>();
/// <summary>
/// Queue item structure
/// </summary>
@ -68,28 +68,28 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
public uint localID;
public LLUUID itemID;
public string FunctionName;
public string functionName;
public object[] param;
}
/// <summary>
/// List of localID locks for mutex processing of script events
/// </summary>
private List<uint> ObjectLocks = new List<uint>();
private object TryLockLock = new object(); // Mutex lock object
private List<uint> objectLocks = new List<uint>();
private object tryLockLock = new object(); // Mutex lock object
private ScriptEngine myScriptEngine;
private ScriptEngine m_ScriptEngine;
public EventQueueManager(ScriptEngine _ScriptEngine)
{
myScriptEngine = _ScriptEngine;
m_ScriptEngine = _ScriptEngine;
//
// Start event queue processing threads (worker threads)
//
for (int ThreadCount = 0; ThreadCount <= NumberOfThreads; ThreadCount++)
for (int ThreadCount = 0; ThreadCount <= numberOfThreads; ThreadCount++)
{
Thread EventQueueThread = new Thread(EventQueueThreadLoop);
EventQueueThreads.Add(EventQueueThread);
eventQueueThreads.Add(EventQueueThread);
EventQueueThread.IsBackground = true;
EventQueueThread.Priority = ThreadPriority.BelowNormal;
EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount;
@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
// Kill worker threads
foreach (Thread EventQueueThread in new System.Collections.ArrayList(EventQueueThreads))
foreach (Thread EventQueueThread in new System.Collections.ArrayList(eventQueueThreads))
{
if (EventQueueThread != null && EventQueueThread.IsAlive == true)
{
@ -115,9 +115,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
}
}
}
EventQueueThreads.Clear();
eventQueueThreads.Clear();
// Todo: Clean up our queues
EventQueue.Clear();
eventQueue.Clear();
}
@ -137,10 +137,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
QueueItemStruct QIS = BlankQIS;
bool GotItem = false;
if (EventQueue.Count == 0)
if (eventQueue.Count == 0)
{
// Nothing to do? Sleep a bit waiting for something to do
Thread.Sleep(NothingToDoSleepms);
Thread.Sleep(nothingToDoSleepms);
}
else
{
@ -148,19 +148,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
//myScriptEngine.m_logger.Verbose("ScriptEngine", "Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName);
// OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD
lock (QueueLock)
lock (queueLock)
{
GotItem = false;
for (int qc = 0; qc < EventQueue.Count; qc++)
for (int qc = 0; qc < eventQueue.Count; qc++)
{
// Get queue item
QIS = EventQueue.Dequeue();
QIS = eventQueue.Dequeue();
// Check if object is being processed by someone else
if (TryLock(QIS.localID) == false)
{
// Object is already being processed, requeue it
EventQueue.Enqueue(QIS);
eventQueue.Enqueue(QIS);
}
else
{
@ -176,12 +176,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Execute function
try
{
myScriptEngine.myScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.FunctionName, QIS.param);
m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.functionName, QIS.param);
}
catch (Exception e)
{
// DISPLAY ERROR INWORLD
string text = "Error executing script function \"" + QIS.FunctionName + "\":\r\n";
string text = "Error executing script function \"" + QIS.functionName + "\":\r\n";
if (e.InnerException != null)
{ // Send inner exception
text += e.InnerException.Message.ToString();
@ -194,10 +194,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
if (text.Length > 1500)
text = text.Substring(0, 1500);
IScriptHost m_host = myScriptEngine.World.GetSceneObjectPart(QIS.localID);
IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
//if (m_host != null)
//{
myScriptEngine.World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
} catch {
//}
//else
@ -234,15 +234,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
/// <returns></returns>
private bool TryLock(uint localID)
{
lock (TryLockLock)
lock (tryLockLock)
{
if (ObjectLocks.Contains(localID) == true)
if (objectLocks.Contains(localID) == true)
{
return false;
}
else
{
ObjectLocks.Add(localID);
objectLocks.Add(localID);
return true;
}
}
@ -254,11 +254,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
/// <param name="localID"></param>
private void ReleaseLock(uint localID)
{
lock (TryLockLock)
lock (tryLockLock)
{
if (ObjectLocks.Contains(localID) == true)
if (objectLocks.Contains(localID) == true)
{
ObjectLocks.Remove(localID);
objectLocks.Remove(localID);
}
}
}
@ -277,13 +277,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Do we have any scripts in this object at all? If not, return
if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false)
if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false)
{
//Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID.");
return;
}
Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = myScriptEngine.myScriptManager.GetScriptKeys(localID);
Dictionary<LLUUID, LSL_BaseClass>.KeyCollection scriptKeys = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
foreach ( LLUUID itemID in scriptKeys )
{
@ -303,17 +303,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
/// <param name="param">Array of parameters to match event mask</param>
public void AddToScriptQueue(uint localID, LLUUID itemID, string FunctionName, object[] param)
{
lock (QueueLock)
lock (queueLock)
{
// Create a structure and add data
QueueItemStruct QIS = new QueueItemStruct();
QIS.localID = localID;
QIS.itemID = itemID;
QIS.FunctionName = FunctionName;
QIS.functionName = FunctionName;
QIS.param = param;
// Add it to queue
EventQueue.Enqueue(QIS);
eventQueue.Enqueue(QIS);
}
}

View File

@ -11,32 +11,32 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
/// </summary>
class LSLLongCmdHandler
{
private Thread CmdHandlerThread;
private int CmdHandlerThreadCycleSleepms = 100;
private Thread cmdHandlerThread;
private int cmdHandlerThreadCycleSleepms = 100;
private ScriptEngine myScriptEngine;
private ScriptEngine m_ScriptEngine;
public LSLLongCmdHandler(ScriptEngine _ScriptEngine)
{
myScriptEngine = _ScriptEngine;
m_ScriptEngine = _ScriptEngine;
// Start the thread that will be doing the work
CmdHandlerThread = new Thread(CmdHandlerThreadLoop);
CmdHandlerThread.Name = "CmdHandlerThread";
CmdHandlerThread.Priority = ThreadPriority.BelowNormal;
CmdHandlerThread.IsBackground = true;
CmdHandlerThread.Start();
cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
cmdHandlerThread.Name = "CmdHandlerThread";
cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
cmdHandlerThread.IsBackground = true;
cmdHandlerThread.Start();
}
~LSLLongCmdHandler()
{
// Shut down thread
try
{
if (CmdHandlerThread != null)
if (cmdHandlerThread != null)
{
if (CmdHandlerThread.IsAlive == true)
if (cmdHandlerThread.IsAlive == true)
{
CmdHandlerThread.Abort();
CmdHandlerThread.Join();
cmdHandlerThread.Abort();
cmdHandlerThread.Join();
}
}
}
@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
CheckTimerEvents();
// Sleep before next cycle
Thread.Sleep(CmdHandlerThreadCycleSleepms);
Thread.Sleep(cmdHandlerThreadCycleSleepms);
}
}
@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
{
// Add it to queue
myScriptEngine.myEventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { });
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { });
// set next interval

View File

@ -45,11 +45,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
internal OpenSim.Region.Environment.Scenes.Scene World;
internal EventManager myEventManager; // Handles and queues incoming events from OpenSim
internal EventQueueManager myEventQueueManager; // Executes events
internal ScriptManager myScriptManager; // Load, unload and execute scripts
internal AppDomainManager myAppDomainManager;
internal LSLLongCmdHandler myLSLLongCmdHandler;
internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
internal EventQueueManager m_EventQueueManager; // Executes events
internal ScriptManager m_ScriptManager; // Load, unload and execute scripts
internal AppDomainManager m_AppDomainManager;
internal LSLLongCmdHandler m_LSLLongCmdHandler;
private OpenSim.Framework.Console.LogBase m_log;
@ -75,11 +75,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
//m_logger.Status("ScriptEngine", "InitializeEngine");
// Create all objects we'll be using
myEventQueueManager = new EventQueueManager(this);
myEventManager = new EventManager(this);
myScriptManager = new ScriptManager(this);
myAppDomainManager = new AppDomainManager();
myLSLLongCmdHandler = new LSLLongCmdHandler(this);
m_EventQueueManager = new EventQueueManager(this);
m_EventManager = new EventManager(this);
m_ScriptManager = new ScriptManager(this);
m_AppDomainManager = new AppDomainManager();
m_LSLLongCmdHandler = new LSLLongCmdHandler(this);
// Should we iterate the region for scripts that needs starting?
// Or can we assume we are loaded before anything else so we can use proper events?

View File

@ -53,15 +53,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
public class ScriptManager
{
#region Declares
private Thread ScriptLoadUnloadThread;
private int ScriptLoadUnloadThread_IdleSleepms = 100;
private Queue<LoadStruct> LoadQueue = new Queue<LoadStruct>();
private Queue<UnloadStruct> UnloadQueue = new Queue<UnloadStruct>();
private Thread scriptLoadUnloadThread;
private int scriptLoadUnloadThread_IdleSleepms = 100;
private Queue<LoadStruct> loadQueue = new Queue<LoadStruct>();
private Queue<UnloadStruct> unloadQueue = new Queue<UnloadStruct>();
private struct LoadStruct
{
public uint localID;
public LLUUID itemID;
public string Script;
public string script;
}
private struct UnloadStruct
{
@ -87,11 +87,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
m_scriptEngine = scriptEngine;
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
ScriptLoadUnloadThread = new Thread(ScriptLoadUnloadThreadLoop);
ScriptLoadUnloadThread.Name = "ScriptLoadUnloadThread";
ScriptLoadUnloadThread.IsBackground = true;
ScriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal;
ScriptLoadUnloadThread.Start();
scriptLoadUnloadThread = new Thread(ScriptLoadUnloadThreadLoop);
scriptLoadUnloadThread.Name = "ScriptLoadUnloadThread";
scriptLoadUnloadThread.IsBackground = true;
scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal;
scriptLoadUnloadThread.Start();
}
~ScriptManager ()
@ -99,12 +99,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Abort load/unload thread
try
{
if (ScriptLoadUnloadThread != null)
if (scriptLoadUnloadThread != null)
{
if (ScriptLoadUnloadThread.IsAlive == true)
if (scriptLoadUnloadThread.IsAlive == true)
{
ScriptLoadUnloadThread.Abort();
ScriptLoadUnloadThread.Join();
scriptLoadUnloadThread.Abort();
scriptLoadUnloadThread.Join();
}
}
}
@ -120,18 +120,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
while (true)
{
if (LoadQueue.Count == 0 && UnloadQueue.Count == 0)
Thread.Sleep(ScriptLoadUnloadThread_IdleSleepms);
if (loadQueue.Count == 0 && unloadQueue.Count == 0)
Thread.Sleep(scriptLoadUnloadThread_IdleSleepms);
if (LoadQueue.Count > 0)
if (loadQueue.Count > 0)
{
LoadStruct item = LoadQueue.Dequeue();
_StartScript(item.localID, item.itemID, item.Script);
LoadStruct item = loadQueue.Dequeue();
_StartScript(item.localID, item.itemID, item.script);
}
if (UnloadQueue.Count > 0)
if (unloadQueue.Count > 0)
{
UnloadStruct item = UnloadQueue.Dequeue();
UnloadStruct item = unloadQueue.Dequeue();
_StopScript(item.localID, item.itemID);
}
@ -232,8 +232,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
LoadStruct ls = new LoadStruct();
ls.localID = localID;
ls.itemID = itemID;
ls.Script = Script;
LoadQueue.Enqueue(ls);
ls.script = Script;
loadQueue.Enqueue(ls);
}
/// <summary>
/// Disables and unloads a script
@ -245,7 +245,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
UnloadStruct ls = new UnloadStruct();
ls.localID = localID;
ls.itemID = itemID;
UnloadQueue.Enqueue(ls);
unloadQueue.Enqueue(ls);
}
private void _StartScript(uint localID, LLUUID itemID, string Script)
@ -279,7 +279,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
before = GC.GetTotalMemory(true);
#endif
LSL_BaseClass CompiledScript;
CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName);
CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(FileName);
#if DEBUG
Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
#endif
@ -297,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
CompiledScript.Start(LSLB);
// Fire the first start-event
m_scriptEngine.myEventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { });
m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { });
}
@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Stop long command on script
m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID);
m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID);
LSL_BaseClass LSLBC = GetScript(localID, itemID);
if (LSLBC == null)
@ -348,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Remove from internal structure
RemoveScript(localID, itemID);
// Tell AppDomain that we have stopped script
m_scriptEngine.myAppDomainManager.StopScript(ad);
m_scriptEngine.m_AppDomainManager.StopScript(ad);
}
catch(Exception e)
{
@ -375,7 +375,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Execute a function in the script
//m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(localID, itemID);
LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID);
if (Script == null)
return;

View File

@ -112,7 +112,7 @@ namespace OpenSim.GUI
proc_UserServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived);
proc_UserServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived);
proc_UserServer.StartProcess();
System.Threading.Thread.Sleep(2000);
System.Threading.Thread.Sleep(3000);
// Start GridServer
proc_GridServer = new ProcessManager("OpenSim.Grid.GridServer.exe", "");
@ -120,7 +120,7 @@ namespace OpenSim.GUI
proc_GridServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived);
proc_GridServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived);
proc_GridServer.StartProcess();
System.Threading.Thread.Sleep(2000);
System.Threading.Thread.Sleep(3000);
// Start AssetServer
proc_AssetServer = new ProcessManager("OpenSim.Grid.AssetServer.exe", "");
@ -128,7 +128,7 @@ namespace OpenSim.GUI
proc_AssetServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived);
proc_AssetServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived);
proc_AssetServer.StartProcess();
System.Threading.Thread.Sleep(2000);
System.Threading.Thread.Sleep(3000);
}
// Start OpenSim