示例#1
0
        public static HtmlString ImgSet(string imgSetClass, string imgDivClass, string name, bool showFleNames, string dir, params string[] masks)
        {
            if (!dir.EndsWith("\\"))
            {
                dir += "\\";
            }

            var sb = new StringBuilder(string.Format("<div class='{0}'><h2>{1}</h2>", imgSetClass, name));

            foreach (var file in DirMgr.GetImgFiles(dir, masks))
            {
                sb.AppendLine(ImgDiv(file.NameOnly, showFleNames, file.ImgSrc, imgDivClass));
            }
            sb.AppendLine("</div>");

            return(new HtmlString(sb.ToString()));
        }
示例#2
0
        public IEnumerable <string> BuildShow(string rootDir)
        {
            var files = new List <string>();

            foreach (var d in Dirs.Where(d => d.IsSelected))
            {
                var dName = $"{rootDir}/{Dir}/{d.ID}";
                if (Directory.Exists(dName))
                {
                    var foundFiles = Directory.GetFiles(dName, "*.*", SearchOption.AllDirectories).Select(s => s.Replace("\\", "/"));
                    //files.AddRange(foundFiles);//.Select(s => d + "/" + s.Substring(s.LastIndexOf("/") + 1)));
                    files.AddRange(foundFiles.Select(s => $"~/media/Photos/{Dir}/{d.ID}/{s.Substring(s.LastIndexOf("/") + 1)}"));
                }
            }
            var fileArr = files.ToArray();

            if (RandomSequence)//.Order == PhotosViewModel.Orders.Random)
            {
                DirMgr.Shuffle(fileArr);
            }

            return(fileArr);
        }