public TypeGraph(Type t, TypeGraph parentType = null, ModuleGraph module = null) : base(t, parentType) { if (module != null) { Module = module; } _methodGraphs = new GraphList <MethodGraph, TypeGraph>(this); _propertyGraphs = new GraphList <PropertyGraph, TypeGraph>(this); _fieldGraphs = new GraphList <FieldGraph, TypeGraph>(this); _eventGraphs = new GraphList <EventGraph, TypeGraph>(this); _typeGraphs = new GraphList <TypeGraph, TypeGraph>(this); if (t != null) { Attributes = t.Attributes; _fullName = t.FullName; _baseType = t.BaseType; IEnumerable <Type> interfaces = t.GetInterfaces(); if (t.BaseType != null)// && interfaces.Any()) { interfaces = interfaces.Except(t.BaseType.GetInterfaces()); } _interfaces.AddRange(interfaces); if ((t.Attributes & TypeAttributes.ExplicitLayout) == TypeAttributes.ExplicitLayout && t.IsValueType) { _packingSize = PackingSize.Size1; _typeSize = System.Runtime.InteropServices.Marshal.SizeOf(t); } else { _packingSize = PackingSize.Unspecified; _typeSize = 0; } //if (t.DeclaringType != null && module != null) // DeclaringObject = module.TypeGraphs.First(x => x.Source == t); foreach (var m in t.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly)) { if (m is MethodBase) { new MethodGraph(m as MethodBase, this); } else if (m is FieldInfo) { new FieldGraph(m as FieldInfo, this); } else if (m is PropertyInfo) { new PropertyGraph(m as PropertyInfo, this); } else if (m is EventInfo) { new EventGraph(m as EventInfo, this); } else if (m is Type) { new TypeGraph(m as Type, this, module); } else { throw new InvalidOperationException(); } } } }
public void SetParentInternal(ModuleGraph parent) { _moduleGraph = parent; }