コード例 #1
0
        public ArrayList Parse()
        {
            ArrayList elements = new ArrayList();

            while (!Eof())
            {
                string elementName = ParseElementName();
                if (elementName == null)
                {
                    break;
                }
                CssElement element = new CssElement(elementName);
                string     name    = ParseAttributeName();
                string     value   = ParseAttributeValue();
                while (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value))
                {
                    element.Add(name, value);
                    EatWhiteSpace();
                    if (GetCurrentChar() == '}')
                    {
                        m_idx++;
                        break;
                    }

                    name  = ParseAttributeName();
                    value = ParseAttributeValue();
                }
                elements.Add(element);
            }
            return(elements);
        }
コード例 #2
0
 public void Save(string file)
 {
     using (StreamWriter sw = new StreamWriter(file, false))
     {
         for (int i = 0; i < Elements.Count - 1; i++)
         {
             CssElement element = (CssElement)Elements[i];
             sw.WriteLine(element.Name + " {");
             foreach (string name in element.Attributes.AllKeys)
             {
                 sw.WriteLine("\t{0}:{1};", name, element.Attributes[name]);
             }
             sw.WriteLine("}");
         }
         sw.Flush();
         sw.Close();
     }
 }
コード例 #3
0
 public void Add(CssElement element)
 {
     Elements.Add(element);
 }
コード例 #4
0
ファイル: CssHelper.cs プロジェクト: fsfree/dookcms
        public ArrayList Parse()
        {
            ArrayList elements = new ArrayList();
            while (!Eof())
            {
                string elementName = ParseElementName();
                if (elementName == null)
                    break;
                CssElement element = new CssElement(elementName);
                string name = ParseAttributeName();
                string value = ParseAttributeValue();
                while (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value))
                {
                    element.Add(name, value);
                    EatWhiteSpace();
                    if (GetCurrentChar() == '}')
                    {
                        m_idx++;
                        break;
                    }

                    name = ParseAttributeName();
                    value = ParseAttributeValue();
                }
                elements.Add(element);
            }
            return elements;
        }
コード例 #5
0
ファイル: CssHelper.cs プロジェクト: fsfree/dookcms
 public void Add(CssElement element)
 {
     Elements.Add(element);
 }