/// <summary>
 /// 按作品年代进行分类
 /// </summary>
 public void ByAge()
 {
     for (int i = 0; i < infobase.Count; i++)
     {
         MusicInfo info = infobase[i];
         infoFlags[i] = new InfoFlag();
         if (info.Year == "" || info.Year == "0" || info.Year == null)
         {
             continue;
         }
         string century = info.Year.Substring(0, 2);
         string age     = info.Year.Substring(2, 1);
         try
         {
             if (Convert.ToInt32(century) < 20)
             {
                 infoFlags[i].Flag = age + "0年代";
                 if (Convert.ToInt32(century) < 19)
                 {
                     infoFlags[i].Flag = century + "世纪";
                 }
             }
             else
             {
                 if (Convert.ToInt32(age) == 0)
                 {
                     infoFlags[i].Flag = "2000年代";
                 }
                 else
                 {
                     infoFlags[i].Flag = "近年";
                 }
             }
         }
         catch (FormatException e) { }
         infoFlags[i].MusicInfo = info;
     }
     StartSort();
     MoveToTab(Setting.Default.LeastAge);
 }
        /// <summary>
        /// 按标题语言进行分类
        /// </summary>
        public void ByTitle(bool fristInit)
        {
            if (fristInit)
            {
                try
                {
                    DetectorFactory.loadProfile(@"profiles\");
                    Detector test = DetectorFactory.create();
                    test.append("test");
                }
                catch (BadImageFormatException)
                {
                    MessageBox.Show(
                        "检测到您未安装相关依赖包,如果需要请前往以下地址下载\n32位:http://www.microsoft.com/en-us/download/details.aspx?id=18084 \n64位:http://www.microsoft.com/en-us/download/details.aspx?id=15468");
                    return;
                }
            }

            for (int i = 0; i < infobase.Count; i++)
            {
                MusicInfo info = infobase[i];
                infoFlags[i] = new InfoFlag();
                Detector detector = DetectorFactory.create();
                string   tag      = info.Title;
                if (Setting.Default.isScanLyric)
                {
                    if (File.Exists(Path.ChangeExtension(info.Path, "lrc")))
                    {
                        try
                        {
                            StreamReader reader1 =
                                new StreamReader(
                                    new FileStream(Path.ChangeExtension(info.Path, "lrc"), FileMode.Open,
                                                   FileAccess.Read), EncodingType.GetType(Path.ChangeExtension(info.Path, "lrc")));
                            tag += Format.LyricDelTime(reader1.ReadToEnd());
                        }
                        catch (IOException e)
                        {
                            MessageBox.Show("无法读取歌词文件:" + Path.ChangeExtension(info.Path, "lrc") + "。" + e.Message);
                        }
                    }
                }

                try
                {
                    detector.append(tag);
                    switch (detector.detect())
                    {
                    case "th": infoFlags[i].Flag = "泰语"; break;

                    case "fi": infoFlags[i].Flag = "芬兰语"; break;

                    case "fr": infoFlags[i].Flag = "法语"; break;

                    case "it": infoFlags[i].Flag = "意大利语"; break;

                    case "ru": infoFlags[i].Flag = "俄语"; break;

                    case "es": infoFlags[i].Flag = "西班牙语"; break;

                    case "ja": infoFlags[i].Flag = "日语"; break;

                    case "en": infoFlags[i].Flag = "英语"; break;

                    case "ko": infoFlags[i].Flag = "韩语"; break;

                    case "zh-cn": infoFlags[i].Flag = "中文(简)"; break;

                    case "zh-tw": infoFlags[i].Flag = "中文(繁)"; break;
                    }
                }
                catch (BadImageFormatException)
                {
                    MessageBox.Show("检测到您未安装相关依赖包,如果需要请前往以下地址下载\n32位:http://www.microsoft.com/en-us/download/details.aspx?id=18084 \n64位:http://www.microsoft.com/en-us/download/details.aspx?id=15468");
                    return;
                }
                catch (LangDetectException)
                {
                    infoFlags[i].Flag = "检测失败的项目";
                }
                infoFlags[i].MusicInfo = info;
            }
            StartSort();
            MoveToTab(Setting.Default.LeastCountry);
        }
 public PlayWindow(MusicInfo info)
 {
     this.info = info;
     InitializeComponent();
     Initializtion();
 }