⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 browserinfo.cs

📁 Freetextbox是优秀的在线编辑器
💻 CS
字号:
namespace FreeTextBoxControls.Support
{
    using System;
    using System.Web;

    public class BrowserInfo
    {
        public static BrowserInfo GetBrowserInfo()
        {
            return BrowserInfo.GetBrowserInfo(HttpContext.Current);
        }

        public static BrowserInfo GetBrowserInfo(HttpContext context)
        {
            BrowserInfo info1 = new BrowserInfo();
            HttpBrowserCapabilities capabilities1 = context.Request.Browser;
            string text1 = context.Request.UserAgent + "";
            info1.isOpera = text1.IndexOf("Opera") > 0;
            info1.isPalm = text1.IndexOf("Palm") > 0;
            info1.isMac = text1.IndexOf("Mac") > 0;
            info1.isLinux = text1.IndexOf("Linux") > 0;
            info1.isWindows = text1.IndexOf("Win") > 0;
            info1.isIE5plus = (((text1.IndexOf("MSIE 5") > 0) || (text1.IndexOf("MSIE 6") > 0)) || (text1.IndexOf("MSIE 7") > 0)) && (!info1.isOpera && !info1.isPalm);
            info1.isMSHTML = info1.isIE5plus && !info1.isMac;
            info1.isNS7 = text1.IndexOf("Netscape/7") > 0;
            info1.isFirefox = (text1.IndexOf("Firebird") > 0) || (text1.IndexOf("Firefox") > 0);
            info1.isGecko = text1.IndexOf("Gecko") > 0;
            if (info1.isGecko)
            {
                try
                {
                    string text2 = text1.Substring(text1.IndexOf("Gecko/") + 6, 8);
                    DateTime time1 = new DateTime(Convert.ToInt32(text2.Substring(0, 4)), Convert.ToInt32(text2.Substring(4, 2)), Convert.ToInt32(text2.Substring(6, 2)));
                    if (time1 >= new DateTime(0x7d3, 6, 0x18))
                    {
                        info1.isMozillaEditor = true;
                    }
                }
                catch
                {
                }
            }
            info1.isSafari = text1.IndexOf("Safari") > 0;
            info1.isRichCapable = info1.isMSHTML || info1.isMozillaEditor;
            return info1;
        }


        public bool IsFirefox
        {
            get
            {
                return this.isFirefox;
            }
        }

        public bool IsGecko
        {
            get
            {
                return this.isGecko;
            }
        }

        public bool IsIE5plus
        {
            get
            {
                return this.isIE5plus;
            }
        }

        public bool IsLinux
        {
            get
            {
                return this.isLinux;
            }
        }

        public bool IsMac
        {
            get
            {
                return this.isMac;
            }
        }

        public bool IsMozillaEditor
        {
            get
            {
                return this.isMozillaEditor;
            }
        }

        public bool IsMSHTML
        {
            get
            {
                return this.isMSHTML;
            }
        }

        public bool IsNS7
        {
            get
            {
                return this.isNS7;
            }
        }

        public bool IsOpera
        {
            get
            {
                return this.isOpera;
            }
        }

        public bool IsPalm
        {
            get
            {
                return this.isPalm;
            }
        }

        public bool IsRichCapable
        {
            get
            {
                return this.isRichCapable;
            }
        }

        public bool IsWindows
        {
            get
            {
                return this.isWindows;
            }
        }


        private bool isFirefox;
        private bool isGecko;
        private bool isIE5plus;
        private bool isLinux;
        private bool isMac;
        private bool isMozillaEditor;
        private bool isMSHTML;
        private bool isNS7;
        private bool isOpera;
        private bool isPalm;
        private bool isRichCapable;
        private bool isSafari;
        private bool isWindows;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -