Пример #1
0
 private ThemeRuleFile GetCssHack(Site site, string themeName)
 {
     while (site != null)
     {
         var theme         = new Theme(site, themeName);
         var themeRuleFile = new ThemeRuleFile(theme);
         if (themeRuleFile.Exists())
         {
             return(themeRuleFile);
         }
         site = site.Parent;
     }
     return(null);
 }
Пример #2
0
        public static IEnumerable <ThemeFile> Parse(Theme theme, out string themeRuleBody, string baseUri = null)
        {
            theme = theme.LastVersion();
            IEnumerable <ThemeFile> themeFiles  = ServiceFactory.ThemeManager.AllStyles(theme);
            ThemeRuleFile           cssHackFile = ServiceFactory.ThemeManager.GetCssHack(theme);

            if (cssHackFile == null || !cssHackFile.Exists())
            {
                themeRuleBody = "";
                return(themeFiles);
            }

            var themeRuleFiles = Parser.Parse(cssHackFile.Read(), (fileVirtualPath) => UrlUtility.ToHttpAbsolute(baseUri, new ThemeFile(theme, fileVirtualPath).LastVersion().VirtualPath), out themeRuleBody);

            return(themeFiles.Where(it => !themeRuleFiles.Any(cf => cf.EqualsOrNullEmpty(it.FileName, StringComparison.CurrentCultureIgnoreCase))));
        }