Ejemplo n.º 1
0
 public override void VisitMember(Member member)
 {
     Console.WriteLine();
     Console.WriteLine(new string('-', 50));
     Console.WriteLine("# " + member.Id);
     base.VisitMember(member);
 }
Ejemplo n.º 2
0
        private static Member ReplaceTypes(Member member, MemberIdMap map)
        {
            if (member.Kind != MemberKinds.Type)
                return member;

            var type = (Type)map.GetOrDefault(member.ToString());
            if (type == null)
                return member;

            var nestingTypeId = "";
            if (type.DeclaringType != null &&
                !string.IsNullOrEmpty((nestingTypeId = map.GetOrDefault(type.DeclaringType))))
                return new NestedType(member.ToString(), nestingTypeId, member.Elements);

            if (type.IsInterface)
                return new Interface(member.ToString(), member.Elements);
            if (type.IsClass)
                return new Class(member.ToString(), member.Elements);
            if (type.IsEnum)
                return new Enum(member.ToString(), member.Elements);
            if (type.IsValueType)
                return new Struct(member.ToString(), member.Elements);

            return member;
        }
Ejemplo n.º 3
0
        private static Member SetInfo(Member member, MemberIdMap map)
        {
            member.Info = map.GetOrDefault(member.ToString());

            return member;
        }
Ejemplo n.º 4
0
        private static Member ReplaceExtensionMethods(Member member, MemberIdMap map)
        {
            if (member.Kind != MemberKinds.Method)
                return member;

            var method = (MethodBase)map.GetOrDefault(member.ToString());
            if (method == null)
                return member;

            if (method.GetCustomAttributes(true).Any(attr => attr.GetType().FullName == "System.Runtime.CompilerServices.ExtensionAttribute"))
            {
                var extendedTypeId = map.GetOrDefault(method.GetParameters()[0].ParameterType);
                if (!string.IsNullOrEmpty(extendedTypeId))
                    return new ExtensionMethod(member.ToString(), extendedTypeId, member.Elements);
            }

            return member;
        }