예제 #1
0
        private void ProcessProps(String props)
        {
            String[] split = props.Split(';');
            IDictionary <String, String> map = new Dictionary <String, String>();

            foreach (String prop in split)
            {
                String[] propSplit = prop.Split(':');
                if (propSplit.Length == 2)
                {
                    map[utils.StripDoubleSpacesTrimAndToLowerCase(propSplit[0])] = utils.StripDoubleSpacesAndTrim(propSplit[1]);
                }
            }
            if (currentSelector.Contains(","))
            {
                String[] selectors = currentSelector.Split(',');
                foreach (String selector in selectors)
                {
                    css.Add(utils.StripDoubleSpacesAndTrim(selector), new Dictionary <string, string>(map));
                }
            }
            else
            {
                css.Add(utils.StripDoubleSpacesAndTrim(currentSelector), map);
            }
        }
예제 #2
0
        private void ProcessProps(String props)
        {
            String[] split = props.Split(';');
            IDictionary <String, String> map = new Dictionary <String, String>();

            foreach (String prop in split)
            {
                String[] propSplit = prop.Split(':');
                if (propSplit.Length == 2)
                {
                    map[utils.StripDoubleSpacesTrimAndToLowerCase(propSplit[0])] = utils.StripDoubleSpacesAndTrim(propSplit[1]);
                }
            }
            if (currentSelector.Contains(","))
            {
                String[] selectors = currentSelector.Split(',');
                //check for rules like p, {…}
                for (int i = 0; i < selectors.Length; i++)
                {
                    selectors[i] = utils.StripDoubleSpacesAndTrim(selectors[i]);
                    if (selectors[i].Length == 0)
                    {
                        return;
                    }
                }
                foreach (String selector in selectors)
                {
                    //if any separated selector has errors, all others become invalid.
                    //in this case we just clear map, it is the easies way to support this.
                    if (!css.Add(selector, map))
                    {
                        map.Clear();
                    }
                }
            }
            else
            {
                css.Add(utils.StripDoubleSpacesAndTrim(currentSelector), map);
            }
        }