Пример #1
0
        /// <summary>
        /// key 值的转换
        /// </summary>
        /// <param name="type"></param>
        /// <param name="xmlPath"></param>
        /// <returns></returns>
        public static Dictionary <string, Clazz> TypeToClazz(Type type, string xmlPath)
        {
            Dictionary <string, Clazz> dic;

            if (TypeToClazzCache.TryGetValue(xmlPath, out dic))
            {
                return(dic);
            }
            dic = new Dictionary <string, Clazz>();
            Dictionary <String, String> filedDic = XMLRead.GetConfigXmlDic(xmlPath, "property", "key", "value");

            filedDic = Utils.DicReset <string, string>(filedDic);
            Dictionary <string, Clazz> clazzDic = ReflectUtils.MethodToFunction(type.AssemblyQualifiedName);
            string aslisName;

            foreach (string method in clazzDic.Keys)
            {
                if (filedDic.TryGetValue(method, out aslisName))
                {
                    dic.Add(filedDic[method], clazzDic[method]);
                }
                else
                {
                    // dic.Add(method, clazzDic[method]);
                }
            }
            dic.Remove("Equals");
            TypeToClazzCache.Add(xmlPath, dic);
            return(dic);
        }
Пример #2
0
        public static IList <T> TextToObject <T>(string path, string xmlConfig, Regex reg)
        {
            Dictionary <String, String> filedDic = XMLRead.GetConfigXmlDic(xmlConfig, "property", "key", "value");
            IList <T> list = TextToObject <T>(path, filedDic, reg);

            return(list);
        }