static List <string> GetDeclarationContext(CssFx.CssDeclaration Declaration, string Keyword) { List <string> Contexts = new List <string>(); if (Declaration.Property.IndexOf(Keyword, StringComparison.OrdinalIgnoreCase) > -1) { Contexts.Add(string.Format("Property-{0}", GetPosition(Declaration.Property, Keyword))); } foreach (CssFx.CssString Value in Declaration.Value.Values) { if (Value.Value.IndexOf(Keyword, StringComparison.OrdinalIgnoreCase) > -1) { Contexts.AddRange(GetValueContext(Value.Value, Keyword)); //Contexts.Add("Value"); } } return(Contexts); }
static List <string> GetContext(CssFx.CssAtRule Stmt, string Keyword) { List <string> Contexts = new List <string>(); bool Import = false; if (Stmt.Ident.Equals("import", StringComparison.OrdinalIgnoreCase)) { Import = true; } if (Stmt.Ident.IndexOf(Keyword, StringComparison.OrdinalIgnoreCase) > -1) { Contexts.Add(string.Format("Ident-Ident-{0}", GetPosition(Stmt.Ident, Keyword))); } if (Stmt.Value != null) { if (Stmt.Value.IndexOf(Keyword, StringComparison.OrdinalIgnoreCase) > -1) { if (Import) { Contexts.AddRange(GetImportIdentContext(Stmt.Value, Keyword)); } else if (Stmt.Ident.Equals("media", StringComparison.OrdinalIgnoreCase)) { Contexts.Add(string.Format("Ident-MediaValue-{0}", GetPosition(Stmt.Ident, Keyword))); } } } foreach (CssFx.ICssValue Value in Stmt.Block.Values) { try { CssFx.CssDeclaration Declaration = (CssFx.CssDeclaration)Value; Contexts.AddRange(GetDeclarationContext(Declaration, Keyword)); }catch {} } return(Contexts); }