示例#1
0
        public TypeDetail(Assembly assembly, bool byFullNamespace, TypeDetail owner)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            Type = null;
            AssemblyName assemblyName = assembly.GetName();

            _assemblies.Add(assemblyName);
            Name     = assemblyName.Name;
            FullName = assembly.FullName;
            Owner    = owner;
        }
示例#2
0
        public TypeDetail(IEnumerable <Assembly> assemblies, bool byAssembly = false, bool byFullNamespace = false)
        {
            Type     = null;
            Name     = "";
            FullName = "";
            if (assemblies == null)
            {
                return;
            }
            IEnumerable <TypeDetail> aTypes = (assemblies.Select(a => new TypeDetail(a, byFullNamespace)));

            if (byAssembly)
            {
                foreach (TypeDetail d in aTypes)
                {
                    d.Owner = this;
                    _types.Add(d);
                }
            }
            else
            {
                foreach (TypeDetail aT in aTypes)
                {
                    foreach (IGrouping <string, TypeDetail> g in aT._types.GroupBy(t => (t.Type == null) ? t.FullName : ""))
                    {
                        TypeDetail td = _types.FirstOrDefault(d => d.FullName == g.Key);
                        if (td == null)
                        {
                            td = new TypeDetail(g.Key, g.Key, this);
                        }
                        _types.Add(td);
                        td._assemblies.Add(aT._assemblies[0]);
                        foreach (TypeDetail d in g)
                        {
                            d.Owner = td;
                            td._types.Add(d);
                        }
                    }
                }
            }
        }
示例#3
0
        private TypeDetail(Type type, TypeDetail owner)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            Type     = (type is TypeInfo) ? (TypeInfo)(type) : type.GetTypeInfo();
            Name     = GetName(type);
            FullName = GetFullName(type);
            Owner    = owner;
            _assemblies.Add(type.Assembly.GetName());
            if (type.IsGenericParameter)
            {
                return;
            }

            foreach (Type t in type.GetNestedTypes(BindingFlags.NonPublic))
            {
                _types.Add(new TypeDetail(t, this));
            }
        }
示例#4
0
 private TypeDetail(string name, string fullName, TypeDetail owner)
 {
     this.Owner    = owner;
     this.Name     = name;
     this.FullName = fullName;
 }