From efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Dec 2007 21:41:48 +0000 Subject: * Optimized usings * shortened references * Removed redundant 'this' * Normalized EOF --- .../ScriptEngine/DotNetEngine/ScriptManager.cs | 65 +++++++++++----------- 1 file changed, 34 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 6b83dff..e211902 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -224,7 +224,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine #region Start/Stop/Reset script - Object startStopLock = new Object(); + private Object startStopLock = new Object(); /// /// 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,39 +345,39 @@ 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); - } - catch (Exception e) - { - Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + - ": " + e.ToString()); + 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()); + } } } - } private string ProcessYield(string FileName) { @@ -435,4 +438,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine #endregion } -} +} \ No newline at end of file -- cgit v1.1