public List <DIYTableData> GetDIYTableDatasByHeroPartAndSex(HeroPart heroPart, HeroSex sex) { List <DIYTableData> dIYTableDatas = new List <DIYTableData>(); foreach (KeyValuePair <int, DIYTableData> item in DIYTableDataDic) { if (item.Value.part == (int)heroPart && item.Value.sex == (int)sex) { dIYTableDatas.Add(item.Value); } } return(dIYTableDatas); }
public Dictionary <HeroPart, List <string> > GetFileNameByPathForDIY2(string path, string format) { Dictionary <HeroPart, List <string> > names = new Dictionary <HeroPart, List <string> >(); //1、获得当前运行程序的路径 string rootPath = Directory.GetCurrentDirectory(); //C#遍历指定文件夹中的所有文件 DirectoryInfo TheFolder = new DirectoryInfo(path); if (!TheFolder.Exists) { return(null); } DirectoryInfo[] directoryInfos = TheFolder.GetDirectories(); for (int i = 0; i < directoryInfos.Length; i++) { //FileInfo[] fileInfosAll = directoryInfos[i].GetFiles(directoryInfos[i].FullName, SearchOption.AllDirectories); DirectoryInfo[] directoryInfos2 = directoryInfos[i].GetDirectories(); for (int k = 0; k < directoryInfos2.Length; k++) { FileInfo[] fileInfos = directoryInfos2[k].GetFiles(); //遍历文件 foreach (FileInfo NextFile in fileInfos) { //if (NextFile.Name == "0-0-11.grid") // continue; // 获取文件完整路径 //string heatmappath = NextFile.FullName; HeroPart keyname = HeroPart.NULL; if (NextFile.Directory.Name.Contains("Male")) { keyname = HeroPart.Hair; } if (NextFile.Directory.Name.Contains("Female")) { keyname = HeroPart.Hair; } if (NextFile.Directory.Name.Contains("Beards")) { keyname = HeroPart.Beard; } if (keyname != HeroPart.NULL) { if (!names.ContainsKey(keyname)) { names[keyname] = new List <string>(); } if (format == NextFile.Extension) { string name = NextFile.Name.Replace(format, ""); names[keyname].Add(name); } } } } } return(names); }