コード例 #1
0
 private static void ForEachRuleSetIn(IRuleSetContainer rsc, Action <RuleSet> action)
 {
     foreach (RuleSet rs in rsc.RuleSets)
     {
         action(rs);
     }
 }
コード例 #2
0
ファイル: CssParser.cs プロジェクト: schifflee/Gamodo.Studio
        private void FillRuleSet(IRuleSetContainer irc, Node parent)
        {
            // Media, Doc
            foreach (RuleSet rs in irc.RuleSets)
            {
                Node head = parent == null ? new Node("NULL") : parent;


                if (rs.Selectors.Count > 0)
                {
                    Selector first = rs.Selectors[0];
                    Node     stn   = new Node(first.ToString());


                    //stn.Image = codeBrowser.imgCSS.Images[getImageIndex(first.ToString())];
                    head = stn;

                    /*
                     * if (rs.Selectors.Count > 1)
                     * {
                     *  bool start = true;
                     *  Node temp = stn;
                     *  foreach (Selector s in rs.Selectors)
                     *  {
                     *      if (start) { start = false; continue; }
                     *      Node child = new Node(s.ToString());
                     *      head.Nodes.Add(child);
                     *      temp = child;
                     *  }
                     * }*/
                }
                head.Object = rs;


                //FillDeclarations(rs, head.Text.Equals("NULL") ? null : head);
                if (parent == null)
                {
                    throw new Exception("CSS parent can't be null");
                }
                else
                {
                    switch (head.Text[0])
                    {
                    case '.':
                        head.Image = imageList.Images[3];
                        classNode.Nodes.Add(head);
                        break;

                    case '#':
                        head.Image = imageList.Images[5];
                        idNode.Nodes.Add(head);
                        break;

                    default:
                        head.Image = imageList.Images[4];
                        elementsNode.Nodes.Add(head);
                        break;
                    }
                }
            }
        }