public List <BarData> LoadID() { Dictionary <string, double> dic = new Dictionary <string, double>(); Movies.ForEach(arg => { string id = ""; if (arg.vediotype == 3) { id = Identify.GetEuFanhao(arg.id).Split('.')[0]; } else { id = Identify.GetFanhao(arg.id).Split('-')[0]; } if (!dic.ContainsKey(id)) { dic.Add(id, 1); } else { dic[id] += 1; } }); var dicSort = dic.OrderByDescending(arg => arg.Value).ToDictionary(x => x.Key, y => y.Value); return(dicSort.ToBarDatas()); }
public void Refresh(string filepath) { DetailMovie models = new DetailMovie(); models.filepath = filepath; FileInfo fileInfo = new FileInfo(filepath); //获取创建日期 string createDate = ""; try { createDate = fileInfo.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"); } catch { } if (createDate == "") { createDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } models.id = Identify.GetFanhao(fileInfo.Name); models.vediotype = (int)Identify.GetVedioType(models.id); models.scandate = createDate; models.filesize = fileInfo.Length; if (models != null) { DetailMovie = models; } }
private void LoadID() { Dictionary <string, double> dic = new Dictionary <string, double>(); Movies.ForEach(arg => { string id = ""; if (arg.vediotype == 3) { id = Identify.GetEuFanhao(arg.id).Split('.')[0]; } else { id = Identify.GetFanhao(arg.id).Split('-')[0]; } if (!dic.ContainsKey(id)) { dic.Add(id, 1); } else { dic[id] += 1; } }); var dicSort = dic.OrderByDescending(arg => arg.Value).ToDictionary(x => x.Key, y => y.Value); Labels = dicSort.Keys.ToArray(); ChartValues <double> cv = new ChartValues <double>(); dicSort.Values.ToList().ForEach(arg => cv.Add(arg)); SeriesCollection = new SeriesCollection { new ColumnSeries { Title = "数目", Values = cv } }; }
/// <summary> /// 在数据库中搜索影片 /// </summary> public async void Query() { if (Search == "") { return; } //对输入的内容进行格式化 string FormatSearch = Search.Replace(" ", "").Replace("%", "").Replace("'", ""); FormatSearch = FormatSearch.ToUpper(); if (string.IsNullOrEmpty(FormatSearch)) { return; } string fanhao = ""; if (CurrentVedioType == VedioType.欧美) { fanhao = Identify.GetEuFanhao(FormatSearch); } else { fanhao = Identify.GetFanhao(FormatSearch); } string searchContent = ""; if (fanhao == "") { searchContent = FormatSearch; } else { searchContent = fanhao; } TextType = searchContent;//当前显示内容 cdb = new DataBase(); List <Movie> models = null; if (!cdb.IsTableExist("movie")) { cdb.CloseDB(); return; } try { if (Properties.Settings.Default.AllSearchType == "识别码") { models = await cdb.SelectMoviesById(searchContent); } else if (Properties.Settings.Default.AllSearchType == "名称") { models = cdb.SelectMoviesBySql($"SELECT * FROM movie where title like '%{searchContent}%'"); } else if (Properties.Settings.Default.AllSearchType == "演员") { models = cdb.SelectMoviesBySql($"SELECT * FROM movie where actor like '%{searchContent}%'"); } } finally { cdb.CloseDB(); } MovieList = new ObservableCollection <Movie>(); models?.ForEach(arg => { MovieList.Add(arg); }); Sort(); }
/// <summary> /// 在数据库中搜索影片 /// </summary> public async Task <bool> Query() { if (!DataBase.IsTableExist("movie")) { return(false); } IsSearching = true; if (Search == "") { return(false); } string FormatSearch = Search.ToProperSql(); if (string.IsNullOrEmpty(FormatSearch)) { return(false); } string fanhao = ""; if (CurrentVedioType == VedioType.欧美) { fanhao = Identify.GetEuFanhao(FormatSearch); } else { fanhao = Identify.GetFanhao(FormatSearch); } string searchContent = ""; if (fanhao == "") { searchContent = FormatSearch; } else { searchContent = fanhao; } if (Properties.Settings.Default.AllSearchType == "识别码") { TextType = "搜索识别码:" + searchContent; MovieList = DataBase.SelectPartialInfo($"SELECT * FROM movie where id like '%{searchContent}%'"); } else if (Properties.Settings.Default.AllSearchType == "名称") { TextType = "搜索名称:" + searchContent; MovieList = DataBase.SelectPartialInfo($"SELECT * FROM movie where title like '%{searchContent}%'"); } else if (Properties.Settings.Default.AllSearchType == "演员") { TextType = "搜索演员:" + searchContent; MovieList = DataBase.SelectPartialInfo($"SELECT * FROM movie where actor like '%{searchContent}%'"); } return(true); }