예제 #1
0
        public static MethodBodyInfo Create(MethodBase method)
        {
            MethodBodyInfo mbi = new MethodBodyInfo();

            mbi.Identity       = method.GetHashCode();
            mbi.TypeName       = method.GetType().Name;
            mbi.MethodToString = method.ToString();
            ReadableILStringVisitor readableIlStringVisitor = new ReadableILStringVisitor((IILStringCollector) new MethodBodyInfo.MethodBodyInfoBuilder(mbi), (IFormatProvider)DefaultFormatProvider.Instance);

            new ILReader(method).Accept((ILInstructionVisitor)readableIlStringVisitor);
            return(mbi);
        }
예제 #2
0
        public static MethodBodyInfo Create(MethodBase method)
        {
            MethodBodyInfo mbi = new MethodBodyInfo();

            mbi.Identity = method.GetHashCode();
            mbi.TypeName = method.GetType().Name;
            mbi.MethodToString = ".method " + method.ToIL();

            ILReader reader = ILReaderFactory.Create(method);
            mbi.Exceptions = reader.ILProvider.GetExceptionInfos();

            ReadableILStringVisitor visitor = new ReadableILStringVisitor(
                new MethodBodyInfoBuilder(mbi),
                DefaultFormatProvider.Instance);

            reader.Accept(visitor);

            return mbi;
        }
        public static MethodBodyInfo Create(MethodBase method)
        {
            MethodBodyInfo mbi = new MethodBodyInfo();

            mbi.Identity       = method.GetHashCode();
            mbi.TypeName       = method.GetType().Name;
            mbi.MethodToString = ".method " + method.ToIL();

            ILReader reader = ILReaderFactory.Create(method);

            mbi.Exceptions = reader.ILProvider.GetExceptionInfos();

            ReadableILStringVisitor visitor = new ReadableILStringVisitor(
                new MethodBodyInfoBuilder(mbi),
                DefaultFormatProvider.Instance);

            reader.Accept(visitor);

            return(mbi);
        }
예제 #4
0
 public static MethodBodyInfo Create(MethodBase method)
 {
     MethodBodyInfo mbi = new MethodBodyInfo();
       mbi.Identity = method.GetHashCode();
       mbi.TypeName = method.GetType().Name;
       mbi.MethodToString = method.ToString();
       ReadableILStringVisitor readableIlStringVisitor = new ReadableILStringVisitor((IILStringCollector) new MethodBodyInfo.MethodBodyInfoBuilder(mbi), (IFormatProvider) DefaultFormatProvider.Instance);
       new ILReader(method).Accept((ILInstructionVisitor) readableIlStringVisitor);
       return mbi;
 }