Ejemplo n.º 1
0
        public void VisitEntry(RootNode node, TextBuilder builder)
        {
            var             elemType  = node.ElemType.Type;
            ConfigAttribute attribute = TypeUtil.GetAttribute <ConfigAttribute>(elemType);

            if (attribute != null && !elemType.IsEnum)
            {
                Type configType = attribute.GetConfigType(elemType);
                DictionaryConfigAttribute dictAttr = attribute as DictionaryConfigAttribute;
                WriteFieldEntry(builder, configType, attribute.Name ?? ConfigManager.Instance.GetDefaultConfigFileName(configType),
                                dictAttr != null ? dictAttr.Key : null,
                                dictAttr != null && dictAttr.LoadAll);
            }
        }
Ejemplo n.º 2
0
        private void ReadXML(Type elemType, Func <string, Type, IEnumerable <string> > getFiles)
        {
            var  attribute  = TypeUtil.GetAttribute <ConfigAttribute>(elemType);
            Type configType = attribute.GetConfigType(elemType);
            DictionaryConfigAttribute dictAttr = attribute as DictionaryConfigAttribute;

            string name = attribute.Name ?? ConfigManager.Instance.GetDefaultConfigFileName(configType);

            foreach (var file in getFiles(name, configType))
            {
                AppendData(configType, elemType, name,
                           dictAttr != null ? elemType.GetMember(dictAttr.Key).FirstOrDefault() : null,
                           ReadXMLFromFile(file, configType),
                           file);
            }
        }