public static GraphProvider Create(MethodDef method) { var methodName = IdentifierEscaper.Escape(method.Name); switch (method.MethodBody) { case CilBody cilBody: { var cflow = method.ConstructStaticFlowGraph(); return(new ControlFlowGraphProvider <Instruction>(methodName, cflow)); } case NativeMethodBody _: { var cflow = IcedHelpers.ReadNativeMethodBody(method); return(new ControlFlowGraphProvider <Iced.Intel.Instruction>(methodName, cflow)); } default: throw new Exception("Tried to create graph for method that has neither managed nor native body"); } }