diff options
author | Tedd Hansen | 2007-08-18 23:24:38 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-08-18 23:24:38 +0000 |
commit | 37446b0392ba423894952f81aa0f938d2bd2de22 (patch) | |
tree | 674be11acb7037c8d98fb6de34bd12e547a6c175 /OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |
parent | starting to add bits and pieces to physics prims that we will eventually need... (diff) | |
download | opensim-SC_OLD-37446b0392ba423894952f81aa0f938d2bd2de22.zip opensim-SC_OLD-37446b0392ba423894952f81aa0f938d2bd2de22.tar.gz opensim-SC_OLD-37446b0392ba423894952f81aa0f938d2bd2de22.tar.bz2 opensim-SC_OLD-37446b0392ba423894952f81aa0f938d2bd2de22.tar.xz |
Moved in-AppDomain event execution from Script to OpenSim.Region.ScriptEngine.Executor. Script no longer responsible for handling event calls to itself (and we can create reference cache in Executor).
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 80 |
1 files changed, 14 insertions, 66 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 602ac9f..926ec74 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
42 | /// <summary> | 42 | /// <summary> |
43 | /// Loads scripts | 43 | /// Loads scripts |
44 | /// Compiles them if necessary | 44 | /// Compiles them if necessary |
45 | /// Execute functions for EventQueueManager | 45 | /// Execute functions for EventQueueManager (Sends them to script on other AppDomain for execution) |
46 | /// </summary> | 46 | /// </summary> |
47 | [Serializable] | 47 | [Serializable] |
48 | public class ScriptManager | 48 | public class ScriptManager |
@@ -182,18 +182,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
182 | //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, ObjectID); | 182 | //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, ObjectID); |
183 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, ObjectID); | 183 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, ObjectID); |
184 | 184 | ||
185 | //string FullScriptID = ScriptID + "." + ObjectID; | ||
186 | // Add it to our temporary active script keeper | 185 | // Add it to our temporary active script keeper |
187 | //Scripts.Add(FullScriptID, Script); | 186 | //Scripts.Add(FullScriptID, Script); |
188 | SetScript(ObjectID, ScriptID, Script); | 187 | SetScript(ObjectID, ScriptID, Script); |
189 | // We need to give (untrusted) assembly a private instance of BuiltIns | 188 | // We need to give (untrusted) assembly a private instance of BuiltIns |
190 | // this private copy will contain Read-Only FullScriptID so that it can bring that on to the server whenever needed. | 189 | // this private copy will contain Read-Only FullScriptID so that it can bring that on to the server whenever needed. |
191 | //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL_BuiltIn_Commands_Interface LSLB = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL_BuiltIn_Commands_TestImplementation(FullScriptID); | 190 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL_BuiltIn_Commands LSLB = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL_BuiltIn_Commands(this, ObjectID); |
192 | 191 | ||
193 | // Start the script - giving it BuiltIns | 192 | // Start the script - giving it BuiltIns |
194 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager initializing script, handing over private builtin command interface"); | 193 | Script.Start(LSLB); |
195 | |||
196 | Script.Start(new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL_BuiltIn_Commands(this, ObjectID)); | ||
197 | 194 | ||
198 | } | 195 | } |
199 | catch (Exception e) | 196 | catch (Exception e) |
@@ -210,12 +207,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
210 | return FileName; | 207 | return FileName; |
211 | } | 208 | } |
212 | 209 | ||
213 | //private AppDomain GetFreeAppDomain() | ||
214 | //{ | ||
215 | // // TODO: Find an available AppDomain - if none, create one and add default security | ||
216 | // return Thread.GetDomain(); | ||
217 | //} | ||
218 | |||
219 | /// <summary> | 210 | /// <summary> |
220 | /// Does actual loading and initialization of script Assembly | 211 | /// Does actual loading and initialization of script Assembly |
221 | /// </summary> | 212 | /// </summary> |
@@ -239,68 +230,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
239 | return mbrt; | 230 | return mbrt; |
240 | //return (LSL_BaseClass)mbrt; | 231 | //return (LSL_BaseClass)mbrt; |
241 | 232 | ||
242 | |||
243 | |||
244 | |||
245 | |||
246 | |||
247 | // //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName); | ||
248 | // // Load .Net Assembly (.dll) | ||
249 | // // Initialize and return it | ||
250 | |||
251 | // // TODO: Add error handling | ||
252 | // // Script might not follow our rules since users can upload -anything- | ||
253 | |||
254 | // Assembly a; | ||
255 | // //try | ||
256 | // //{ | ||
257 | |||
258 | |||
259 | // // Load to default appdomain (temporary) | ||
260 | // a = Assembly.LoadFrom(FileName); | ||
261 | // // Load to specified appdomain | ||
262 | // // TODO: Insert security | ||
263 | // //a = FreeAppDomain.Load(FileName); | ||
264 | // //} | ||
265 | // //catch (Exception e) | ||
266 | // //{ | ||
267 | // //} | ||
268 | |||
269 | |||
270 | // //foreach (Type _t in a.GetTypes()) | ||
271 | // //{ | ||
272 | // // Console.WriteLine("Type: " + _t.ToString()); | ||
273 | // //} | ||
274 | |||
275 | // Type t; | ||
276 | // //try | ||
277 | // //{ | ||
278 | // t = a.GetType("SecondLife.Script", true); | ||
279 | // //} | ||
280 | // //catch (Exception e) | ||
281 | // //{ | ||
282 | // //} | ||
283 | |||
284 | // // Create constructor arguments | ||
285 | // object[] args = new object[] | ||
286 | // { | ||
287 | //// this, | ||
288 | //// host | ||
289 | // }; | ||
290 | |||
291 | // return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args ); | ||
292 | |||
293 | |||
294 | } | 233 | } |
295 | 234 | ||
296 | internal void ExecuteFunction(IScriptHost ObjectID, string ScriptID, string FunctionName, object[] args) | 235 | /// <summary> |
236 | /// Execute a LL-event-function in Script | ||
237 | /// </summary> | ||
238 | /// <param name="ObjectID">Object the script is located in</param> | ||
239 | /// <param name="ScriptID">Script ID</param> | ||
240 | /// <param name="FunctionName">Name of function</param> | ||
241 | /// <param name="args">Arguments to pass to function</param> | ||
242 | internal void ExecuteEvent(IScriptHost ObjectID, string ScriptID, string FunctionName, object[] args) | ||
297 | { | 243 | { |
298 | 244 | ||
299 | // Execute a function in the script | 245 | // Execute a function in the script |
300 | m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); | 246 | m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); |
301 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); | 247 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); |
302 | 248 | ||
303 | Script.ExecuteEvent(FunctionName, args); | 249 | // Must be done in correct AppDomain, so leaving it up to the script itself |
250 | |||
251 | Script.Exec.ExecuteEvent(FunctionName, args); | ||
304 | 252 | ||
305 | //Type type = Script.GetType(); | 253 | //Type type = Script.GetType(); |
306 | 254 | ||