Esempio n. 1
0
        public static Reflector.CodeModel.ITypeDeclaration Cecil2Reflector(TypeDefinition td)
        {
            Reflector.CodeModel.IModule m = Cecil2Reflector(td.Module);
            if (m == null)
            {
                return(null);
            }

            foreach (Reflector.CodeModel.ITypeDeclaration t in m.Types)
            {
                if (IsEqual(t, td))
                {
                    return(t);
                }
                if (t.NestedTypes.Count > 0)
                {
                    Reflector.CodeModel.ITypeDeclaration t2 = Cecil2Reflector(td, t.NestedTypes);
                    if (t2 != null)
                    {
                        return(t2);
                    }
                }
            }
            return(null);
        }
Esempio n. 2
0
        public static Reflector.CodeModel.IFieldDeclaration Cecil2Reflector(FieldDefinition fd)
        {
            Reflector.CodeModel.ITypeDeclaration t = Cecil2Reflector(fd.DeclaringType);
            if (t == null)
            {
                return(null);
            }

            foreach (Reflector.CodeModel.IFieldDeclaration f in t.Fields)
            {
                if (IsEqual(f, fd))
                {
                    return(f);
                }
            }
            return(null);
        }
Esempio n. 3
0
        public static Reflector.CodeModel.IEventDeclaration Cecil2Reflector(EventDefinition ed)
        {
            Reflector.CodeModel.ITypeDeclaration t = Cecil2Reflector(ed.DeclaringType);
            if (t == null)
            {
                return(null);
            }

            foreach (Reflector.CodeModel.IEventDeclaration e in t.Events)
            {
                if (IsEqual(e, ed))
                {
                    return(e);
                }
            }
            return(null);
        }
Esempio n. 4
0
        public static Reflector.CodeModel.IPropertyDeclaration Cecil2Reflector(PropertyDefinition pd)
        {
            Reflector.CodeModel.ITypeDeclaration t = Cecil2Reflector(pd.DeclaringType);
            if (t == null)
            {
                return(null);
            }

            foreach (Reflector.CodeModel.IPropertyDeclaration p in t.Properties)
            {
                if (IsEqual(p, pd))
                {
                    return(p);
                }
            }
            return(null);
        }
Esempio n. 5
0
        public static Reflector.CodeModel.IMethodDeclaration Cecil2Reflector(MethodDefinition md)
        {
            Reflector.CodeModel.ITypeDeclaration t = Cecil2Reflector(md.DeclaringType);
            if (t == null)
            {
                return(null);
            }

            foreach (Reflector.CodeModel.IMethodDeclaration m in t.Methods)
            {
                if (IsEqual(m, md))
                {
                    return(m);
                }
            }
            return(null);
        }