示例#1
0
        private List <string> GetImgDirList(string imgDirPath, string configPath)
        {
            string        errorInfo = "未找到目录如下:\n";
            List <string> result    = new List <string>();
            Dictionary <string, List <string> > configInfo = CsvHelper.AnalysisCsvByFile(configPath);
            List <string> infoList = new List <string>();

            foreach (List <string> valueTemp in configInfo.Values)
            {
                for (int i = 0; i < valueTemp.Count; i++)
                {
                    infoList.Add(valueTemp[i]);
                }
            }
            for (int i = 0; i < infoList.Count; i++)
            {
                string dirPath = Path.Combine(imgDirPath, infoList[i]);
                if (Directory.Exists(dirPath))
                {
                    result.Add(dirPath);
                }
                else
                {
                    errorInfo += dirPath + "\n";
                }
            }
            File.WriteAllText(statisticalPath, errorInfo, Encoding.UTF8);
            return(result);
        }
示例#2
0
        private void _setConfigInfo(string configPath)
        {
            _dirInfoDic = new Dictionary <string, string>();
            Dictionary <string, List <string> > configInfo = CsvHelper.AnalysisCsvByFile(configPath);
            int           temp   = 0;
            List <string> keys   = new List <string>();
            List <string> values = new List <string>();

            foreach (List <string> tempList in configInfo.Values)
            {
                if (temp == 0)
                {
                    keys = tempList;
                }
                else if (temp == 1)
                {
                    values = tempList;
                }
                temp++;
            }
            for (int j = 0; j < keys.Count; j++)
            {
                _dirInfoDic.Add(keys[j], values[j]);
            }
        }
示例#3
0
        private void _getConfigInfo(string configPath)
        {
            _replaceInfos = new List <ReplaceInfo>();
            Dictionary <string, List <string> > configInfo = CsvHelper.AnalysisCsvByFile(configPath);

            foreach (List <string> values in configInfo.Values)
            {
                for (int i = 0; i < values.Count; i++)
                {
                    ReplaceInfo info = new ReplaceInfo();
                    info.SourceInfo = values[i];
                    _replaceInfos.Add(info);
                }
            }
            int temp = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(_replaceInfos.Count / 2.0f)));

            for (int i = 0; i < temp; i++)
            {
                ReplaceInfo info = new ReplaceInfo();
                info.SourceInfo  = _replaceInfos[i].SourceInfo;
                info.TargetInfo  = _replaceInfos[i + temp].SourceInfo;
                _replaceInfos[i] = info;
            }
            while (_replaceInfos.Count > temp)
            {
                _replaceInfos.RemoveAt(_replaceInfos.Count - 1);
            }
        }