Exemple #1
0
        public static Dictionary <string, TypeInfoTS> GetSymbolContainers(IEnumerable <Type> allTypes)
        {
            SymbolLogic.LoadAll();

            var result = (from type in allTypes
                          where type.IsStaticClass() && type.HasAttribute <AutoInitAttribute>()
                          select KVP.Create(GetTypeName(type), OnAddTypeExtension(new TypeInfoTS
            {
                Kind = KindOfType.SymbolContainer,
                FullName = type.FullName,
                Members = type.GetFields(staticFlags)
                          .Select(f => GetSymbolInfo(f))
                          .Where(s =>
                                 s.FieldInfo != null &&  /*Duplicated like in Dynamic*/
                                 s.IdOrNull.HasValue /*Not registered*/)
                          .ToDictionary(s => s.FieldInfo.Name, s => OnAddFieldInfoExtension(new MemberInfoTS
                {
                    NiceName = s.FieldInfo.NiceName(),
                    Id = s.IdOrNull.Value.Object
                }, s.FieldInfo))
            }, type)))
                         .Where(a => a.Value.Members.Any())
                         .ToDictionaryEx("symbols");

            return(result);
        }
Exemple #2
0
        public static Dictionary <string, TypeInfoTS> GetSymbolContainers(IEnumerable <Type> allTypes)
        {
            SymbolLogic.LoadAll();

            var result = (from type in allTypes
                          where type.IsStaticClass() && type.HasAttribute <AutoInitAttribute>()
                          select KVP.Create(GetTypeName(type), OnAddTypeExtension(new TypeInfoTS
            {
                Kind = KindOfType.SymbolContainer,
                Members = type.GetFields(staticFlags).Where(f => GetSymbol(f).IdOrNull.HasValue).ToDictionary(fi => fi.Name, fi => OnAddFieldInfoExtension(new MemberInfoTS
                {
                    NiceName = fi.NiceName(),
                    Id = GetSymbol(fi).Id.Object
                }, fi))
            }, type))).ToDictionaryEx("symbols");

            return(result);
        }