public static void InitFanhaoList() { string QBPath = AppDomain.CurrentDomain.BaseDirectory + @"\Data\Qibing.txt"; string BBPath = AppDomain.CurrentDomain.BaseDirectory + @"\Data\Bubing.txt"; if (File.Exists(QBPath)) { using (StreamReader sr = new StreamReader(QBPath)) { foreach (var item in sr.ReadToEnd().Replace(",", ",").Split(',')) { if (!string.IsNullOrEmpty(item) && item.Length > 0) { Qibing.Add(item.ToUpper()); } } } } if (File.Exists(BBPath)) { using (StreamReader sr = new StreamReader(BBPath)) { foreach (var item in sr.ReadToEnd().Replace(",", ",").Split(',')) { if (!string.IsNullOrEmpty(item) && item.Length > 0) { Bubing.Add(item.ToUpper()); } } } } //如果为空,则载入默认 if (Qibing.Count == 0) { foreach (var item in Resource_String.Qibing.Split(',')) { if (!string.IsNullOrEmpty(item) && item.Length > 0) { Qibing.Add(item.ToUpper()); } } } if (Bubing.Count == 0) { foreach (var item in Resource_String.Bubing.Split(',')) { if (!string.IsNullOrEmpty(item) && item.Length > 0) { Bubing.Add(item.ToUpper()); } } } }
/// <summary> /// 获得视频类型 /// </summary> /// <param name="FileName">文件名</param> /// <returns></returns> public static VedioType GetVedioType(string FileName) { if (string.IsNullOrEmpty(FileName)) { return(VedioType.所有); } if (FileName.ToLower().IndexOf("s2m") >= 0) { return(VedioType.步兵); } if (FileName.ToLower().IndexOf("t28") >= 0) { return(VedioType.骑兵); } // 一本道、メス豚、天然むすめ if (FileName.IndexOf("_") > 0) { return(VedioType.步兵); } else { if (FileName.IndexOf("-") > 0) { //分割番号 string fanhao1 = FileName.Split(new char[1] { '-' })[0]; string fanhao2 = FileName.Split(new char[1] { '-' })[1]; if (fanhao1.All(char.IsDigit)) { //全数字:加勒比 return(VedioType.步兵); } else { //优先匹配步兵 if (Bubing.Contains(fanhao1)) { return(VedioType.步兵); } else if (Qibing.Contains(fanhao1)) { return(VedioType.骑兵); } else { // 剩下的如果还没匹配到,看看是否为 XXXX-000格式 if (GetEng(fanhao1) != "" & GetNum(fanhao2) != "") { return(VedioType.骑兵); } else { return(0); } } } } else { if (!string.IsNullOrEmpty(FileName)) { if ((FileName.StartsWith("N") & FileName.Replace("N", "").All(char.IsDigit)) | (FileName.StartsWith("K") & FileName.Replace("K", "").All(char.IsDigit))) { return(VedioType.步兵); //Tokyo } else { FileName = GetFanhaoByRegExp(FileName, "[A-Z][A-Z]+");//至少两个英文字母 if (!string.IsNullOrEmpty(FileName)) { if (Bubing.Contains(FileName)) { return(VedioType.步兵); } else { return(0); } } else { return(0); } } } else { return(0); } } } }