Ejemplo n.º 1
0
        public static MediaMatcher Parse(string media)
        {
            MediaMatcher matcher = new MediaMatcher();

            if (string.IsNullOrEmpty(media))
            {
                return(matcher);
            }

            media = media.ToLower().Trim();

            if (media.StartsWith("not "))
            {
                matcher.Not = true;
                media       = media.Substring(3).Trim();
            }
            if (media.StartsWith("only "))
            {
                media = media.Substring(4).Trim(); //Just ignore only
            }
            if (media.StartsWith("("))
            {
                matcher.Type     = string.Empty;
                matcher.Features = media;
            }
            else
            {
                var split = media.IndexOf(' ');

                if (split > 0)
                {
                    matcher.Type     = media.Substring(0, split).Trim();
                    matcher.Features = media.Substring(split).Trim();
                }
                else
                {
                    matcher.Type = media;
                }
            }

            return(matcher);
        }
 public StyleMediaGroup(Selectors.MediaMatcher media) : this()
 {
     this.Media = media;
 }