aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs41
1 files changed, 41 insertions, 0 deletions
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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Rail.Transformation;
5using Rail.Reflect;
6using Rail.Exceptions;
7using Rail.MSIL;
8
9namespace 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}