标签:sub job direct ring 文件名 int length name query
public List<Model> GetFileName(string filePath)
{
var queryParam = queryJson.ToJObject();
string[] filePaths = Directory.GetDirectories(filePath);//获取目录下的所有文件夹路径
string[] fileNames = null; //声明空数组
ArrayList array = new ArrayList();
List<FileWord> lst = new List<FileWord>();
for (int i = 0; i < filePaths.Length; i++)//循环获取文件名
{
fileNames = Directory.GetFiles(filePaths[i]);//把文件名放到数组中去
foreach (var item in fileNames)//把文件名添加到ArrayList
{
array.Add(item);
}
}
for (int i = 0; i < array.Count; i++)
{
Model fw = new Model();
//文件路径
string FilePath = array[i].ToString().Replace("\\", "/");//将\\转换成/
//文件夹名
string TemplateClass = FilePath.Substring(0, FilePath.LastIndexOf("/"));
string FName = FilePath.Substring(FilePath.LastIndexOf("/") + 1);
fw.FName =FName.Substring(0,FName.LastIndexOf(‘.‘)) ;
fw.TemplateClass = TemplateClass.Substring(TemplateClass.LastIndexOf("/") + 1);
lst.Add(fw);//将类添加到lst集合
}
lst = lst.Skip(页数 *行数 - 行数).Take(行数).ToList();//Linq分组
return lst;
}
标签:sub job direct ring 文件名 int length name query
原文地址:http://www.cnblogs.com/Effortslyl/p/7459531.html