Ejemplo n.º 1
0
        private static bool Valid(XElement jsItem)
        {
            string browser     = XmlHelpers.GetAttribute(jsItem, "Browser");
            bool   browserPass = browser.Length == 0 || HtmlHelpers.BrowserName().Equals(browser, StringComparison.OrdinalIgnoreCase);

            if (!browserPass)
            {
                return(false);
            }

            // if the browser is specified, check if the version number is specified
            if (!string.IsNullOrEmpty(browser))
            {
                int version;
                if (Int32.TryParse(XmlHelpers.GetAttribute(jsItem, "BrowserMaxVersion"), out version))
                {
                    if (HtmlHelpers.BrowserMajorVersion() > version)
                    {
                        return(false);
                    }
                }

                if (Int32.TryParse(XmlHelpers.GetAttribute(jsItem, "BrowserMinVersion"), out version))
                {
                    if (HtmlHelpers.BrowserMajorVersion() < version)
                    {
                        return(false);
                    }
                }
            }

            bool devicePass = HtmlHelpers.DeviceSupported(jsItem);

            if (!devicePass)
            {
                return(false);
            }

            string environment     = XmlHelpers.GetAttribute(jsItem, "Environment");
            bool   environmentPass = environment.Length == 0 || ConfigurationManager.AppSettings["Environment"].Equals(environment, StringComparison.OrdinalIgnoreCase);

            return(environmentPass);
        }
Ejemplo n.º 2
0
        private static bool Valid(XElement styleItem)
        {
            if (styleItem.Attribute("Browser") != null)
            {
                if (styleItem.Attribute("Browser").Value != HtmlHelpers.BrowserName())
                {
                    return(false);
                }

                if (styleItem.Attribute("MajorVersion") != null)
                {
                    if (styleItem.Attribute("MajorVersion").Value != HtmlHelpers.BrowserMajorVersion().ToString())
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }