1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| class News {
public static List<string> PicturePaths = new List<string>();
public static int iNbFiles;
public static string strPath = ReadIni.ReadValue("General", "Path", ReadIni.strPathIni);
public static void SearchPictures(string parentFolder)
{
iNbFiles = 0;
List<FileInfo> lst = new List<FileInfo>();
News.PicturePaths.Clear();
Directory.GetFiles(parentFolder, "*.*", SearchOption.AllDirectories)
.Where(f =>
f.ToLower().EndsWith(".jpg") ||
f.ToLower().EndsWith(".png") ||
f.ToLower().EndsWith(".bmp")
)
.ToList()
.ForEach(f => lst.Add(new FileInfo(f)));
PicturePaths = lst.OrderByDescending(f => f.LastWriteTime).Select(f => f.Name).ToList();
iNbFiles = lst.Count();
}
} |