using System;
using System.Collections.Generic;

namespace Stat.Items
{
    public class Browser
    {
        /// <summary>
        /// 浏览器列表
        /// </summary>
        /// <returns></returns>
        public static String[,] Get()
        {
            string[,] browser = new string[25, 2];

            browser[0, 0] = "-1";
            browser[0, 1] = "其他";

            browser[1, 0] = "1";
            browser[1, 1] = "MSIE 5";

            browser[2, 0] = "2";
            browser[2, 1] = "Netscape";

            browser[3, 0] = "3";
            browser[3, 1] = "Opera";

            browser[4, 0] = "4";
            browser[4, 1] = "Maxthon";

            browser[5, 0] = "5";
            browser[5, 1] = "Firefox";

            browser[6, 0] = "6";
            browser[6, 1] = "MSIE 6";

            browser[7, 0] = "7";
            browser[7, 1] = "MSIE 7";

            browser[8, 0] = "8";
            browser[8, 1] = "MSIE 8";

            browser[9, 0] = "9";
            browser[9, 1] = "NOKIAN";

            browser[10, 0] = "10";
            browser[10, 1] = "WGET";

            browser[11, 0] = "11";
            browser[11, 1] = "BREW-APPLET";

            browser[12, 0] = "12";
            browser[12, 1] = "CHROME";

            browser[13, 0] = "13";
            browser[13, 1] = "APPLEWEBKIT";

            browser[14, 0] = "14";
            browser[14, 1] = "MSIE 4";

            browser[15, 0] = "15";
            browser[15, 1] = "GOOGLEBOT";

            browser[16, 0] = "16";
            browser[16, 1] = "SONYERICSSON";

            browser[17, 0] = "17";
            browser[17, 1] = "OPENWARE";

            browser[18, 0] = "18";
            browser[18, 1] = "MSIE 10";

            browser[19, 0] = "19";
            browser[19, 1] = "搜狗浏览器";

            browser[20, 0] = "20";
            browser[20, 1] = "HW-C5600";

            browser[21, 0] = "21";
            browser[21, 1] = "360浏览器";

            browser[22, 0] = "22";
            browser[22, 1] = "腾讯TT";

            browser[23, 0] = "23";
            browser[23, 1] = "NOKIA6300";//合并到9

            browser[24, 0] = "24";
            browser[24, 1] = "MSIE 9";

            return browser;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public static List<Model.StatItem> Get(List<Model.StatItem> list)
        {
            foreach (Model.StatItem item in list)
            {
                item.Name = NumberToName(item.ID);
            }
            return list;
        }

        /// <summary>
        /// 根据 编号  获取名称
        /// </summary>
        /// <param name="Eno">编号</param>
        /// <returns>名称</returns>
        private static string NumberToName(int Eno)
        {
            string[,] arr = Get();
            string ss = "其他";
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                if (arr[i, 0].ToString() == Eno.ToString())
                {
                    ss = arr[i, 1].ToString();
                }
            }
            return ss;
        }
    }
}
