Ejemplo n.º 1
0
        public virtual ThemeRuleFile GetRules(Site site, string themeName)
        {
            Theme theme         = new Theme(site, themeName);
            var   themeRuleFile = new ThemeRuleFile(theme);

            themeRuleFile.Read();

            return(themeRuleFile);
        }
Ejemplo n.º 2
0
        public virtual void SaveRules(Site site, string themeName, string rulesBody)
        {
            Theme theme         = new Theme(site, themeName);
            var   themeRuleFile = new ThemeRuleFile(theme)
            {
                Body = rulesBody
            };

            themeRuleFile.Save();
        }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
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))));
        }