public ImageModel GetImages(string path, string category) { var ims = new ImageModel(); foreach (var image in GetImages(path).Images.Where(image => image.Categories.Contains(category.ToLower().Trim()))) { ims.Images.Add(image); } return ims; }
private ImageModel GetAllUnmangedImages(string path) { var allimages = new ImageModel(); if (path.ToLower().Contains("unused") || path.ToLower().Contains("layout")) return allimages; var di = new DirectoryInfo(path); foreach (var directoryInfo in di.GetDirectories()) { allimages.Images.AddRange(GetUnmangedImagesFromCategory(directoryInfo.FullName).Images); } return allimages; }
private ImageModel GetUnmangedImagesFromCategory(string path) { var images = new ImageModel(); var di = new DirectoryInfo(path); foreach (var nimage in from image in di.GetFiles() where image.Extension.ToLower().Contains("jpg") || image.Extension.ToLower().Contains("bmp") || image.Extension.ToLower().Contains("jpeg") || image.Extension.ToLower().Contains("gif") || image.Extension.ToLower().Contains("png") || image.Extension.ToLower().Contains("tif") select new Image { Path = image.FullName }) { nimage.AddCategory("placeholder"); nimage.AddCategory("placeholder2"); nimage.AddTag("placeholder"); nimage.AddTag("placeholder2"); images.Images.Add(nimage); } images.Images.AddRange( GetAllUnmangedImages(path).Images ); return images; }