Exemplo n.º 1
0
        public static IPropertyValue VaryAll(this IValueConverter converter, List <Token> list)
        {
            for (var i = 0; i < list.Count; i++)
            {
                if (list[i].Type == TokenType.Whitespace)
                {
                    continue;
                }

                for (var j = list.Count; j > i; j--)
                {
                    var count = j - i;

                    if (list[j - 1].Type == TokenType.Whitespace)
                    {
                        continue;
                    }

                    var value = converter.Convert(list.Skip(i).Take(count));

                    if (value == null)
                    {
                        continue;
                    }
                    list.RemoveRange(i, count);
                    list.Trim();
                    return(value);
                }
            }

            return(converter.ConvertDefault());
        }
Exemplo n.º 2
0
        public static IPropertyValue VaryStart(this IValueConverter converter, List <CssToken> list)
        {
            for (int count = list.Count; count > 0; count--)
            {
                if (list[count - 1].Type == CssTokenType.Whitespace)
                {
                    continue;
                }

                var value = converter.Convert(list.Take(count));

                if (value != null)
                {
                    list.RemoveRange(0, count);
                    list.Trim();
                    return(value);
                }
            }

            return(converter.ConvertDefault());
        }
Exemplo n.º 3
0
 public static Boolean HasDefault(this IValueConverter converter)
 {
     return(converter.ConvertDefault() != null);
 }