aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs
diff options
context:
space:
mode:
authorTedd Hansen2008-05-18 14:10:51 +0000
committerTedd Hansen2008-05-18 14:10:51 +0000
commitaa5b26a4d361f38274a189bfeb5c6934a9d3d59d (patch)
treed71b3870f8aeae61a67915bb54e2a3637f6fc8d0 /OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs
parent* Patch #1312 from Melanie - Abstracts Money Module to IMoneyModule. (diff)
downloadopensim-SC_OLD-aa5b26a4d361f38274a189bfeb5c6934a9d3d59d.zip
opensim-SC_OLD-aa5b26a4d361f38274a189bfeb5c6934a9d3d59d.tar.gz
opensim-SC_OLD-aa5b26a4d361f38274a189bfeb5c6934a9d3d59d.tar.bz2
opensim-SC_OLD-aa5b26a4d361f38274a189bfeb5c6934a9d3d59d.tar.xz
Cleanup: Removed LSOEngine source again as it will not be used.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs156
1 files changed, 0 insertions, 156 deletions
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs
deleted file mode 100644
index 617d6f6..0000000
--- a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs
+++ /dev/null
@@ -1,156 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using libsecondlife;
30using OpenSim.Framework;
31using OpenSim.Region.Environment.Scenes;
32using OpenSim.Region.ScriptEngine.Common;
33using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
34
35namespace OpenSim.Region.ScriptEngine.LSOEngine
36{
37 public class ScriptManager : Common.ScriptEngineBase.ScriptManager
38 {
39 public ScriptManager(Common.ScriptEngineBase.ScriptEngine scriptEngine)
40 : base(scriptEngine)
41 {
42 base.m_scriptEngine = scriptEngine;
43
44 }
45
46 // KEEP TRACK OF SCRIPTS <int id, whatever script>
47 //internal Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>> Scripts = new Dictionary<uint, Dictionary<LLUUID, LSL_BaseClass>>();
48 // LOAD SCRIPT
49 // UNLOAD SCRIPT
50 // PROVIDE SCRIPT WITH ITS INTERFACE TO OpenSim
51
52 public override void _StartScript(uint localID, LLUUID itemID, string Script)
53 {
54 //IScriptHost root = host.GetRoot();
55 Console.WriteLine("ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
56
57 // We will initialize and start the script.
58 // It will be up to the script itself to hook up the correct events.
59 string ScriptSource = String.Empty;
60
61 SceneObjectPart m_host = World.GetSceneObjectPart(localID);
62
63 try
64 {
65 // Compile (We assume LSL)
66 //ScriptSource = LSLCompiler.CompileFromLSLText(Script);
67
68//#if DEBUG
69 //long before;
70 //before = GC.GetTotalMemory(true); // This force a garbage collect that freezes some windows plateforms
71//#endif
72
73 IScript CompiledScript;
74 CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
75
76//#if DEBUG
77 //Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
78//#endif
79
80 CompiledScript.Source = ScriptSource;
81 // Add it to our script memstruct
82 SetScript(localID, itemID, CompiledScript);
83
84 // We need to give (untrusted) assembly a private instance of BuiltIns
85 // this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed.
86
87
88 BuilIn_Commands LSLB = new BuilIn_Commands(m_scriptEngine, m_host, localID, itemID);
89
90 // Start the script - giving it BuiltIns
91 CompiledScript.Start(LSLB);
92
93 // Fire the first start-event
94 int eventFlags = m_scriptEngine.m_ScriptManager.GetStateEventFlags(localID, itemID);
95 m_host.SetScriptEvents(itemID, eventFlags);
96 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", EventQueueManager.llDetectNull, new object[] { });
97 }
98 catch (Exception e) // LEGIT - User Script Compilation
99 {
100 //m_scriptEngine.Log.Error("[ScriptEngine]: Error compiling script: " + e.ToString());
101 try
102 {
103 // DISPLAY ERROR INWORLD
104 string text = "Error compiling script:\r\n" + e.Message.ToString();
105 if (text.Length > 1500)
106 text = text.Substring(0, 1500);
107 World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition,
108 m_host.Name, m_host.UUID);
109 }
110 catch (Exception e2) // LEGIT - User Scripting
111 {
112 m_scriptEngine.Log.Error("[ScriptEngine]: Error displaying error in-world: " + e2.ToString());
113 m_scriptEngine.Log.Error("[ScriptEngine]: " +
114 "Errormessage: Error compiling script:\r\n" + e.Message.ToString());
115 }
116 }
117 }
118
119 public override void _StopScript(uint localID, LLUUID itemID)
120 {
121 // Stop script
122 Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString());
123
124 // Stop long command on script
125 m_scriptEngine.m_ASYNCLSLCommandManager.RemoveScript(localID, itemID);
126
127 IScript LSLBC = GetScript(localID, itemID);
128 if (LSLBC == null)
129 return;
130
131 // TEMP: First serialize it
132 //GetSerializedScript(localID, itemID);
133
134 try
135 {
136 // Get AppDomain
137 AppDomain ad = LSLBC.Exec.GetAppDomain();
138 // Tell script not to accept new requests
139 GetScript(localID, itemID).Exec.StopScript();
140 // Remove from internal structure
141 RemoveScript(localID, itemID);
142 // Tell AppDomain that we have stopped script
143 m_scriptEngine.m_AppDomainManager.StopScript(ad);
144 }
145 catch (Exception e) // LEGIT - Problems caused by User Scripting
146 {
147 Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
148 ": " + e.ToString());
149 }
150 }
151
152 public override void Initialize()
153 {
154 }
155 }
156}