diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs | 41 |
2 files changed, 42 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 5606287..b6debcf 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -190,7 +190,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
190 | private string ProcessYield(string FileName) | 190 | private string ProcessYield(string FileName) |
191 | { | 191 | { |
192 | // TODO: Create a new assembly and copy old but insert Yield Code | 192 | // TODO: Create a new assembly and copy old but insert Yield Code |
193 | return FileName; | 193 | return TempDotNetMicroThreadingCodeInjector.TestFix(FileName); |
194 | } | 194 | } |
195 | 195 | ||
196 | private AppDomain GetFreeAppDomain() | 196 | private AppDomain GetFreeAppDomain() |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs new file mode 100644 index 0000000..dd3ce09 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs | |||
@@ -0,0 +1,41 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using Rail.Transformation; | ||
5 | using Rail.Reflect; | ||
6 | using Rail.Exceptions; | ||
7 | using Rail.MSIL; | ||
8 | |||
9 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | ||
10 | { | ||
11 | class TempDotNetMicroThreadingCodeInjector | ||
12 | { | ||
13 | public static string TestFix(string FileName) | ||
14 | { | ||
15 | string ret = System.IO.Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); | ||
16 | |||
17 | Console.WriteLine("Loading: \"" + FileName + "\""); | ||
18 | RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); | ||
19 | |||
20 | |||
21 | //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe | ||
22 | RTypeDef type = (RTypeDef)rAssembly.RModuleDef.GetType("SecondLife.Script"); | ||
23 | |||
24 | //Get the methods in the type | ||
25 | RMethod[] m = type.GetMethods(); | ||
26 | |||
27 | //Create a MethodPrologueAdder visitor object with the method to add | ||
28 | //and with the flag that enables local variable creation set to true | ||
29 | MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef)m[0], true); | ||
30 | |||
31 | //Apply the changes to the assembly | ||
32 | rAssembly.Accept(mpa); | ||
33 | |||
34 | //Save the new assembly | ||
35 | rAssembly.SaveAssembly(ret); | ||
36 | |||
37 | return ret; | ||
38 | |||
39 | } | ||
40 | } | ||
41 | } | ||