Exemplo n.º 1
0
 public override void decodeCssString(string cssString)
 {
     Height = CssHelpers.decodeCssUnit(cssString);
 }
Exemplo n.º 2
0
 public override void decodeCssString(string cssString)
 {
     Bottom = CssHelpers.decodeCssUnit(cssString);
 }
Exemplo n.º 3
0
        public static CssUnit decodeCssUnit(string cssString)
        {
            Regex regex = new Regex("(?<number>\\d+)(?<suffix>.*)", RegexOptions.IgnoreCase);
            CssUnit unit = new CssUnit();
            var match = regex.Match(cssString);
            float value = 0.0f;
            float.TryParse(match.Groups["number"].Value, out value);
            unit.value = value;
            if (CssUnit.PositionTable.ContainsKey(match.Groups["suffix"].Value))
            {
                unit.valueType = CssUnit.PositionTable[match.Groups["suffix"].Value];
            }
            else
            {
                Debug.WriteLine("Error: no suffix was found on a numerical position definition");
            }

            return unit;
        }