Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Mono.Cecil;
- namespace Tutorial1Code
- {
- class Program
- {
- static void Main(string[] args)
- {
- // Loads the assembly from the start arguments
- AssemblyDefinition asm = AssemblyDefinition.ReadAssembly(args[0]);
- // Iterates through the assembly's modules, aspects of the program
- foreach (ModuleDefinition mod in asm.Modules)
- {
- // Iterates through the classes of the assembly
- foreach (TypeDefinition td in mod.Types)
- {
- // Writes the types name,
- DoType(td);
- }
- }
- Console.ReadLine();
- }
- static void DoType(TypeDefinition td)
- {
- foreach (TypeDefinition ntd in td.NestedTypes)
- {
- // Repeat if the class has nested classes.
- DoType(ntd);
- }
- foreach (MethodDefinition md in td.Methods)
- {
- // Log the content to the console
- Log(td.Name + " > " + md.Name);
- }
- }
- static void Log(string text)
- {
- Console.WriteLine(text);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement