aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs68
1 files changed, 68 insertions, 0 deletions
diff --git a/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
new file mode 100644
index 0000000..bf429f6
--- /dev/null
+++ b/OpenSim/ScriptEngine/Engines/DotNetEngine/DotNetEngine_ScriptLoadUnload.cs
@@ -0,0 +1,68 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenMetaverse;
5using OpenSim.ScriptEngine.Components.DotNetEngine.Events;
6using OpenSim.ScriptEngine.Shared;
7
8namespace OpenSim.ScriptEngine.Engines.DotNetEngine
9{
10 public partial class DotNetEngine
11 {
12
13 //internal Dictionary<int, IScriptScheduler> ScriptMapping = new Dictionary<int, IScriptScheduler>();
14
15
16 //
17 // HANDLE EVENTS FROM SCRIPTS
18 // We will handle script add, change and remove events outside of command pipeline
19 //
20 #region Script Add/Change/Remove
21 void Events_RezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine)
22 {
23 // ###
24 // # New script created
25 // ###
26 m_log.DebugFormat(
27 "[{0}] NEW SCRIPT: localID: {1}, itemID: {2}, startParam: {3}, postOnRez: {4}, engine: {5}",
28 Name, localID, itemID, startParam, postOnRez, engine);
29
30 // Make a script object
31 ScriptStructure scriptObject = new ScriptStructure();
32 scriptObject.RegionInfo = RegionInfo;
33 scriptObject.LocalID = localID;
34 scriptObject.ItemID = itemID;
35 scriptObject.Source = script;
36
37 //
38 // Get MetaData from script header
39 //
40 ScriptMetaData scriptMetaData = ScriptMetaData.Extract(ref script);
41 scriptObject.ScriptMetaData = scriptMetaData;
42 foreach (string key in scriptObject.ScriptMetaData.Keys)
43 {
44 m_log.DebugFormat("[{0}] Script metadata: Key: \"{1}\", Value: \"{2}\".", Name, key, scriptObject.ScriptMetaData[key]);
45 }
46
47 //
48 // Load this assembly
49 //
50 // TODO: Use Executor to send a command instead?
51 m_log.DebugFormat("[{0}] Adding script to scheduler", Name);
52 RegionInfo.FindScheduler(scriptObject.ScriptMetaData).AddScript(scriptObject);
53 // Add to our internal mapping
54 //ScriptMapping.Add(itemID, Schedulers[scheduler]);
55 }
56
57 private void Events_RemoveScript(uint localID, UUID itemID)
58 {
59 // Tell all schedulers to remove this item
60 foreach (IScriptScheduler scheduler in RegionInfo.Schedulers.Values)
61 {
62 scheduler.Removecript(localID, itemID);
63 }
64 }
65 #endregion
66
67 }
68}