Example #1
0
        private float[] ParseLengths(string text)
        {
            List <float> result = new List <float>();

            string[] items = SplitItems(text);
            if (items != null)
            {
                foreach (string item in items)
                {
                    double v = GraphicsUnitConvert.ParseCSSLength(item, this.DomDocument.DocumentGraphicsUnit, double.NaN);
                    if (double.IsNaN(v) == false)
                    {
                        result.Add((float)v);
                    }
                }
            }
            return(result.ToArray());
        }
Example #2
0
 private bool TryParseLength(string text, out float length)
 {
     length = 0;
     if (string.IsNullOrEmpty(text))
     {
         return(false);
     }
     text = text.Trim();
     if ("0123456789.-".IndexOf(text[0]) >= 0)
     {
         double v = GraphicsUnitConvert.ParseCSSLength(text, this.DomDocument.DocumentGraphicsUnit, double.NaN);
         if (double.IsNaN(v) == false)
         {
             length = (float)v;
             return(true);
         }
     }
     return(false);
 }