public static MethodNode CreateNode(MethodDefinition definition) { string methodName = GetMethodName(definition); var node = new MethodNode(definition, methodName); ProcessDefinition(node, definition); return node; }
private static void ProcessDefinition(MethodNode node, MethodDefinition definition) { if (!definition.HasBody) { return; } foreach (Instruction instruction in definition.Body.Instructions) { if (instruction.OpCode == OpCodes.Call || instruction.OpCode == OpCodes.Callvirt || instruction.OpCode == OpCodes.Calli) { var operandNS = (instruction.Operand as MemberReference).DeclaringType.Namespace; if (ioNamespaces.Any(ns => operandNS.StartsWith(ns))) { node.IOIcon = Resources.file; } else if (netNamespaces.Any(ns => operandNS.StartsWith(ns))) { node.NetIcon = Resources.network; } else if (securityNamespaces.Any(ns => operandNS.StartsWith(ns))) { node.SecurityIcon = Resources.security; } } } }