private static List <FileReducedChildrenModel> GetFileReducedChildren(File file, Management.Files.FileSystem.Pages.ImageSizeCache imageSizes, string fsRootPath = "")
 {
     if (file.Children == null)
     {
         return(null);
     }
     try
     {
         return(file.Children.Select(
                    cc => new FileReducedChildrenModel
         {
             SizeName = imageSizes.GetSizeName(cc.Title) ?? GetUnreferencedImageSize(cc.Title),
             Url = fsRootPath + cc.Url,
             Size = (cc as File) != null ? (cc as File).Size : -1
         }
                    ).ToList());
     }
     catch
     {
         return(null);
     }
 }
        public static List <FileReducedListModel> GetFileReducedList(List <File> files, Management.Files.FileSystem.Pages.ImageSizeCache imageSizes, string exts = "", string fsRootPath = "")
        {
            var regIsImage = new Regex(@"^.*\.(jpg|jpeg|gif|png)$", RegexOptions.IgnoreCase);

            var ret = files.Select(d => new FileReducedListModel
            {
                Title    = d.Title,
                Url      = fsRootPath + d.LocalUrl,
                IsImage  = regIsImage.IsMatch(d.Title),
                Thumb    = regIsImage.IsMatch(d.Title) ? fsRootPath + N2.Web.Drawing.ImagesUtility.GetExistingImagePath(d.LocalUrl, "thumb") : null,
                Size     = d.Size,
                Date     = string.Format("{0:s}", d.Created),
                SCount   = d.Children.Count,
                Children = regIsImage.IsMatch(d.Title) ? GetFileReducedChildren(d, imageSizes, fsRootPath) : null
            }).ToList();


            if (!string.IsNullOrEmpty(exts))
            {
                var eqComparer = new ExtensionEqualityComparer();
                var extsArray  = exts.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                var ret2       = ret.Where(p => extsArray.Contains(p.Url, eqComparer)).ToList();
                return(ret2);
            }

            return(ret);
        }