예제 #1
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);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="sheetIndex"></param>
        /// <param name="TitelRowIndex"></param>
        /// <param name="EndRowIndex">此行要读取,默认是最后一行</param>
        public ExcelReflectModel(string excelPath, string path, int sheetIndex = 0, int TitelRowIndex = 0, int StartRowIndex = 1, int EndRowIndex = -1)
        {
            if (!Utils.CheckFileExists(excelPath))
            {
                throw new Exception("文件不存在:" + excelPath);
            }
            if (!Utils.CheckFileExists(path))
            {
                throw new Exception("文件不存在:" + path);
            }

            Sheet           = ExcelRead.ReadExcelSheet(excelPath, sheetIndex);
            this.PropertDic = XMLRead.GetConfigXmlDic(path, "property", "name", "column");
            //this.TitelRowIndex = TitelRowIndex;
            this.ClazzDic = ReflectUtils.MethodToFunction <T>();
            this.TitleDic = GetTitleDic(Sheet.GetRow(TitelRowIndex), this.PropertDic, this.ClazzDic);
            if (EndRowIndex == -1)
            {
                this.LastRowIndex = Sheet.LastRowNum;
            }
            else
            {
                this.LastRowIndex = EndRowIndex;
            }

            this.StartRowIndex = StartRowIndex;
        }
예제 #3
0
파일: ArcgisDao.cs 프로젝트: YB9527/CG
        internal static Dictionary <int, Clazz> GetTitleClzz(object obj, IFields fields, string configName)
        {
            Dictionary <int, Clazz> resultDic;

            if (fieldDicCache.TryGetValue(configName, out resultDic))
            {
                return(resultDic);
            }
            Dictionary <String, int>    filed     = FeatureTitileToDic(fields);
            Dictionary <String, String> configDic = XMLRead.GetConfigXmlDic(configName, "property", "key", "value");
            Dictionary <string, Clazz>  clazzDic  = ReflectUtils.MethodToFunction(obj);

            resultDic = GetChangeDic(filed, configDic, clazzDic);
            fieldDicCache.Add(configName, resultDic);
            return(resultDic);
        }