Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. public static void Trigonometry(ModuleDefMD module)
  2. {
  3. double tobemodified = 0;
  4. double result = 0;
  5. foreach (TypeDef type in module.Types)
  6. {
  7. foreach (MethodDef method in type.Methods)
  8. {
  9. if (!method.HasBody)
  10. {
  11. continue;
  12. }
  13. if (method.Body.HasInstructions)
  14. {
  15. for (int i = 0; i < method.Body.Instructions.Count; i++)
  16. {
  17.  
  18. if (method.Body.Instructions[i].OpCode == OpCodes.Ldc_R8 && method.Body.Instructions[i + 1].OpCode == OpCodes.Call && method.Body.Instructions[i + 1].ToString().Contains("Sin"))
  19. {
  20. tobemodified = Convert.ToDouble(method.Body.Instructions[i].Operand);
  21. result = Math.Sin(tobemodified);
  22. method.Body.Instructions[i].Operand = result;
  23. method.Body.Instructions.RemoveAt(i + 1);
  24. SolvedMath++;
  25. }
  26. }
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement