Beispiel #1
0
        public static CSSLookup Parse(string svgFilePath)
        {
            CSSLookup   lookup = new CSSLookup();
            XmlDocument xml    = FromPath(svgFilePath);

            var els = xml.GetElementsByTagName("style");

            foreach (XmlNode node in els)
            {
                foreach (var nameDef in GetClassNamesAndDefinitions(node.InnerText))
                {
                    var cssC = CSSClass.FromString(nameDef[0], nameDef[1]);
                    lookup.add(cssC);
                }
            }

            return(lookup);
        }
Beispiel #2
0
        public static CSSClass FromString(string className, string definition)
        {
            CSSClass result = new CSSClass();

            result.name = className;
            string[] defs = definition.Split(';');
            foreach (string def in defs)
            {
                string[] keyVal = def.Split(':');
                if (keyVal.Length != 2)
                {
                    continue;
                }
                string key = keyVal[0].Trim();
                string val = keyVal[1].Trim();
                result.defs.Add(key, val);
            }
            return(result);
        }
Beispiel #3
0
 public void add(CSSClass ccs)
 {
     storage.Add(ccs.name, ccs);
 }