Exemple #1
0
        public void TestPhysicalPath()
        {
            string themeName = "theme1";
            var site = new Site("Site1");
            var theme = new Theme(site, themeName);
            var themeImageFile = new ThemeImageFile(theme, "image1.jpg");

            string expected1 = Path.Combine(site.PhysicalPath, "themes", themeName, "Images", "image1.jpg");

            Assert.AreEqual(expected1, themeImageFile.PhysicalPath, true);
        }
Exemple #2
0
        public void TestVirtualPath()
        {
            string themeName = "theme1";
            var site = new Site("Site1");
            var theme = new Theme(site, themeName);
            var themeImageFile = new ThemeImageFile(theme, "image1.jpg");

            string expected1 = Kooboo.Web.Url.UrlUtility.Combine(site.VirtualPath, "themes", themeName, "Images", "image1.jpg");

            Assert.AreEqual(expected1, themeImageFile.VirtualPath, true);
        }
Exemple #3
0
 public IEnumerable<ThemeImageFile> AllImagesEnumerable(Theme theme)
 {
     List<ThemeImageFile> list = new List<ThemeImageFile>();
     theme = theme.LastVersion();
     if (theme.Exists())
     {
         ThemeImageFile dummy = new ThemeImageFile(theme, "dummy");
         var baseDir = dummy.BasePhysicalPath;
         if (Directory.Exists(baseDir))
         {
             foreach (var file in Directory.EnumerateFiles(baseDir))
             {
                 list.Add(new ThemeImageFile(theme, Path.GetFileName(file)));
             }
         }
     }
     return list;
 }