示例#1
0
 public string Css(string className, string css)
 {
     try
     {
         css = css.RemoveDuplicateSpaces();
         IRule rule;
         if (className.IndexOf("@font-face") != -1)
         {
             rule = ParseFontFace(css);
             _styleSheet.AddClass(rule, _id);
         }
         else if (className.IndexOf("@media") != -1)
         {
             rule = ParseMediaQuery(className, "{" + css + "}");
             _styleSheet.AddClass(rule, _id);
         }
         else
         {
             rule = ParsePredefinedRuleSet(className, css);
             if (_elements.Contains(className))
             {
                 _styleSheet.AddClass(rule, _id);
             }
             else
             {
                 _styleSheet.AddClass(rule, _id);
             }
         }
         return(rule.Selector);
     }
     catch (StyledException e)
     {
         throw e;
     }
     catch (Exception e)
     {
         throw StyledException.GetException(css, e);
     }
 }