diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs index 64cb7cd..46d438a 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/TempDotNetMicroThreadingCodeInjector.cs | |||
@@ -1,45 +1,45 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using Rail.Transformation; | 4 | using Rail.Transformation; |
5 | using Rail.Reflect; | 5 | using Rail.Reflect; |
6 | using Rail.Exceptions; | 6 | using Rail.Exceptions; |
7 | using Rail.MSIL; | 7 | using Rail.MSIL; |
8 | 8 | ||
9 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 9 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
10 | { | 10 | { |
11 | /// <summary> | 11 | /// <summary> |
12 | /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes! | 12 | /// Tedds Sandbox for RAIL/microtrheading. This class is only for testing purposes! |
13 | /// Its offspring will be the actual implementation. | 13 | /// Its offspring will be the actual implementation. |
14 | /// </summary> | 14 | /// </summary> |
15 | class TempDotNetMicroThreadingCodeInjector | 15 | class TempDotNetMicroThreadingCodeInjector |
16 | { | 16 | { |
17 | public static string TestFix(string FileName) | 17 | public static string TestFix(string FileName) |
18 | { | 18 | { |
19 | string ret = System.IO.Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); | 19 | string ret = System.IO.Path.GetFileNameWithoutExtension(FileName + "_fixed.dll"); |
20 | 20 | ||
21 | Console.WriteLine("Loading: \"" + FileName + "\""); | 21 | Console.WriteLine("Loading: \"" + FileName + "\""); |
22 | RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); | 22 | RAssemblyDef rAssembly = RAssemblyDef.LoadAssembly(FileName); |
23 | 23 | ||
24 | 24 | ||
25 | //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe | 25 | //Get the type of the method to copy from assembly Teste2.exe to assembly Teste.exe |
26 | RTypeDef type = (RTypeDef)rAssembly.RModuleDef.GetType("SecondLife.Script"); | 26 | RTypeDef type = (RTypeDef)rAssembly.RModuleDef.GetType("SecondLife.Script"); |
27 | 27 | ||
28 | //Get the methods in the type | 28 | //Get the methods in the type |
29 | RMethod[] m = type.GetMethods(); | 29 | RMethod[] m = type.GetMethods(); |
30 | 30 | ||
31 | //Create a MethodPrologueAdder visitor object with the method to add | 31 | //Create a MethodPrologueAdder visitor object with the method to add |
32 | //and with the flag that enables local variable creation set to true | 32 | //and with the flag that enables local variable creation set to true |
33 | MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef)m[0], true); | 33 | MethodPrologueAdder mpa = new MethodPrologueAdder((RMethodDef)m[0], true); |
34 | 34 | ||
35 | //Apply the changes to the assembly | 35 | //Apply the changes to the assembly |
36 | rAssembly.Accept(mpa); | 36 | rAssembly.Accept(mpa); |
37 | 37 | ||
38 | //Save the new assembly | 38 | //Save the new assembly |
39 | rAssembly.SaveAssembly(ret); | 39 | rAssembly.SaveAssembly(ret); |
40 | 40 | ||
41 | return ret; | 41 | return ret; |
42 | 42 | ||
43 | } | 43 | } |
44 | } | 44 | } |
45 | } | 45 | } |