diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index f2080eb..6d1ecda 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -46,46 +46,46 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
46 | 46 | ||
47 | 47 | ||
48 | // Object<string, Script<string, script>> | 48 | // Object<string, Script<string, script>> |
49 | internal Dictionary<string, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>> Scripts = new Dictionary<string, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>>(); | 49 | internal Dictionary<string, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass>> Scripts = new Dictionary<string, Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass>>(); |
50 | 50 | ||
51 | 51 | ||
52 | internal Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>.KeyCollection GetScriptKeys(string ObjectID) | 52 | internal Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass>.KeyCollection GetScriptKeys(string ObjectID) |
53 | { | 53 | { |
54 | if (Scripts.ContainsKey(ObjectID) == false) | 54 | if (Scripts.ContainsKey(ObjectID) == false) |
55 | return null; | 55 | return null; |
56 | 56 | ||
57 | Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass> Obj; | 57 | Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass> Obj; |
58 | Scripts.TryGetValue(ObjectID, out Obj); | 58 | Scripts.TryGetValue(ObjectID, out Obj); |
59 | 59 | ||
60 | return Obj.Keys; | 60 | return Obj.Keys; |
61 | 61 | ||
62 | } | 62 | } |
63 | 63 | ||
64 | internal OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass GetScript(string ObjectID, string ScriptID) | 64 | internal OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass GetScript(string ObjectID, string ScriptID) |
65 | { | 65 | { |
66 | if (Scripts.ContainsKey(ObjectID) == false) | 66 | if (Scripts.ContainsKey(ObjectID) == false) |
67 | return null; | 67 | return null; |
68 | 68 | ||
69 | Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass> Obj; | 69 | Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass> Obj; |
70 | Scripts.TryGetValue(ObjectID, out Obj); | 70 | Scripts.TryGetValue(ObjectID, out Obj); |
71 | if (Obj.ContainsKey(ScriptID) == false) | 71 | if (Obj.ContainsKey(ScriptID) == false) |
72 | return null; | 72 | return null; |
73 | 73 | ||
74 | // Get script | 74 | // Get script |
75 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script; | 75 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script; |
76 | Obj.TryGetValue(ScriptID, out Script); | 76 | Obj.TryGetValue(ScriptID, out Script); |
77 | 77 | ||
78 | return Script; | 78 | return Script; |
79 | 79 | ||
80 | } | 80 | } |
81 | internal void SetScript(string ObjectID, string ScriptID, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script) | 81 | internal void SetScript(string ObjectID, string ScriptID, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script) |
82 | { | 82 | { |
83 | // Create object if it doesn't exist | 83 | // Create object if it doesn't exist |
84 | if (Scripts.ContainsKey(ObjectID) == false) | 84 | if (Scripts.ContainsKey(ObjectID) == false) |
85 | Scripts.Add(ObjectID, new Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass>()); | 85 | Scripts.Add(ObjectID, new Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass>()); |
86 | 86 | ||
87 | // Delete script if it exists | 87 | // Delete script if it exists |
88 | Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass> Obj; | 88 | Dictionary<string, OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass> Obj; |
89 | Scripts.TryGetValue(ObjectID, out Obj); | 89 | Scripts.TryGetValue(ObjectID, out Obj); |
90 | if (Obj.ContainsKey(ScriptID) == true) | 90 | if (Obj.ContainsKey(ScriptID) == true) |
91 | Obj.Remove(ScriptID); | 91 | Obj.Remove(ScriptID); |
@@ -118,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
118 | { | 118 | { |
119 | Common.SendToDebug("ScriptManager Script is LSO, compiling to .Net Assembly"); | 119 | Common.SendToDebug("ScriptManager Script is LSO, compiling to .Net Assembly"); |
120 | // Create a new instance of the compiler (currently we don't want reuse) | 120 | // Create a new instance of the compiler (currently we don't want reuse) |
121 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Engine LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.Engine(); | 121 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.Engine LSLCompiler = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.Engine(); |
122 | // Compile | 122 | // Compile |
123 | FileName = LSLCompiler.Compile(FileName); | 123 | FileName = LSLCompiler.Compile(FileName); |
124 | } | 124 | } |
@@ -130,14 +130,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
130 | AppDomain FreeAppDomain = GetFreeAppDomain(); | 130 | AppDomain FreeAppDomain = GetFreeAppDomain(); |
131 | 131 | ||
132 | // * Load and start script | 132 | // * Load and start script |
133 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); | 133 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); |
134 | string FullScriptID = ScriptID + "." + ObjectID; | 134 | string FullScriptID = ScriptID + "." + ObjectID; |
135 | // Add it to our temporary active script keeper | 135 | // Add it to our temporary active script keeper |
136 | //Scripts.Add(FullScriptID, Script); | 136 | //Scripts.Add(FullScriptID, Script); |
137 | SetScript(ObjectID, ScriptID, Script); | 137 | SetScript(ObjectID, ScriptID, Script); |
138 | // We need to give (untrusted) assembly a private instance of BuiltIns | 138 | // We need to give (untrusted) assembly a private instance of BuiltIns |
139 | // this private copy will contain Read-Only FullScriptID so that it can bring that on to the server whenever needed. | 139 | // this private copy will contain Read-Only FullScriptID so that it can bring that on to the server whenever needed. |
140 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BuiltIn_Commands_Interface LSLB = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BuiltIn_Commands_TestImplementation(FullScriptID); | 140 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BuiltIn_Commands_Interface LSLB = new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BuiltIn_Commands_TestImplementation(FullScriptID); |
141 | // Start the script - giving it BuiltIns | 141 | // Start the script - giving it BuiltIns |
142 | Common.SendToDebug("ScriptManager initializing script, handing over private builtin command interface"); | 142 | Common.SendToDebug("ScriptManager initializing script, handing over private builtin command interface"); |
143 | Script.Start(LSLB); | 143 | Script.Start(LSLB); |
@@ -162,7 +162,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
162 | /// <param name="FreeAppDomain">AppDomain to load script into</param> | 162 | /// <param name="FreeAppDomain">AppDomain to load script into</param> |
163 | /// <param name="FileName">FileName of script assembly (.dll)</param> | 163 | /// <param name="FileName">FileName of script assembly (.dll)</param> |
164 | /// <returns></returns> | 164 | /// <returns></returns> |
165 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName) | 165 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName) |
166 | { | 166 | { |
167 | Common.SendToDebug("ScriptManager Loading Assembly " + FileName); | 167 | Common.SendToDebug("ScriptManager Loading Assembly " + FileName); |
168 | // Load .Net Assembly (.dll) | 168 | // Load .Net Assembly (.dll) |
@@ -201,7 +201,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
201 | //{ | 201 | //{ |
202 | //} | 202 | //} |
203 | 203 | ||
204 | return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t); | 204 | return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass)Activator.CreateInstance(t); |
205 | 205 | ||
206 | 206 | ||
207 | } | 207 | } |
@@ -209,13 +209,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
209 | internal void ExecuteFunction(string ObjectID, string ScriptID, string FunctionName, object[] args) | 209 | internal void ExecuteFunction(string ObjectID, string ScriptID, string FunctionName, object[] args) |
210 | { | 210 | { |
211 | Common.SendToDebug("Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); | 211 | Common.SendToDebug("Executing Function ObjectID: " + ObjectID + ", ScriptID: " + ScriptID + ", FunctionName: " + FunctionName); |
212 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = myScriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); | 212 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = myScriptEngine.myScriptManager.GetScript(ObjectID, ScriptID); |
213 | 213 | ||
214 | Type type = Script.GetType(); | 214 | Type type = Script.GetType(); |
215 | //object o = (object)Script; | 215 | //object o = (object)Script; |
216 | 216 | ||
217 | //System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>) | 217 | //System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>) |
218 | //Type type = typeof(OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass); | 218 | //Type type = typeof(OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass); |
219 | Common.SendToDebug("Invoke: \"" + Script.State + "_event_" + FunctionName + "\""); | 219 | Common.SendToDebug("Invoke: \"" + Script.State + "_event_" + FunctionName + "\""); |
220 | type.InvokeMember(Script.State + "_event_" + FunctionName, BindingFlags.InvokeMethod, null, Script, args); | 220 | type.InvokeMember(Script.State + "_event_" + FunctionName, BindingFlags.InvokeMethod, null, Script, args); |
221 | //System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, Script, null); | 221 | //System.Collections.Generic.List<string> Functions = (System.Collections.Generic.List<string>)type.InvokeMember("GetFunctions", BindingFlags.InvokeMethod, null, Script, null); |