public override List <string> GetInfo() { List <string> info = base.GetInfo(); info.AddRange(new List <string> { "Наличие интернета: " + (HaveInternet ? "Да" : "Нет"), "Количество заметок: " + NotesCount.ToString(), "Свободная память: " + FreeMemory.ToString(), }); return(info); }
public override List <string> GetInfo() { List <string> info = base.GetInfo(); info.AddRange(new List <string> { "Наличие интернета: " + (HaveInternet ? "Да" : "Нет"), "Интернет включён: " + (InternetIsOn ? "Да" : "Нет"), "Количество фото: " + PhotoCount.ToString(), "Количество заметок: " + NotesCount.ToString(), "Свободная память: " + FreeMemory.ToString(), "Запущенные приложения: " + string.Join(",", AppsStarted.ToArray()) }); return(info); }
/// <summary> /// 自动格式化歌曲信息 /// </summary> /// <param name="song"></param> /// <param name="format"></param> /// <returns></returns> public string AutoFormatSong(PluginArcaeaSong song) { if (song == null) { return(null); } string info = $"{song.SongTitle} [{song.ChartRatingClass} {song.ChartConstant}]\n" + (SongArtist.IsNullOrWhiteSpace() ? null : song.SongArtist?.Be($"曲师:{song.SongArtist}\n")) + (JacketDesigner.IsNullOrWhiteSpace() ? null : song.JacketDesigner?.Be($"画师:{song.JacketDesigner}\n")) + (SongBPM.IsNullOrWhiteSpace() ? null : song.SongBpm?.Be($"BPM:{song.SongBpm}\n")) + (SongLength.IsNullOrWhiteSpace() ? null : song.SongLength?.Be($"歌曲长度:{ song.SongLength}\n")) + //(song.Song_pack?.Be($"曲包:{song.Song_pack}\n")) + (ChartDesigner.IsNullOrWhiteSpace() ? null : song.ChartDesigner?.Be($"谱师:{song.ChartDesigner}\n")) + (NotesCount.IsNullOrWhiteSpace() ? null : song.ChartAllNotes?.Be($"note总数:{song.ChartAllNotes}\n")); return(info.ToString().Trim()); }
/// <summary> /// 获取满足当前条件的歌曲 /// </summary> /// <param name="ratingList"></param> /// <param name="ratingClass"></param> /// <returns></returns> public List <PluginArcaeaSong> GetSatisfiedSong(List <string> ratingList = null, PluginArcaeaSong.RatingClass ratingClass = PluginArcaeaSong.RatingClass.Random) { if (_kouContext.Set <PluginArcaeaSong>().IsNullOrEmptySet()) { return(null); } //处理限定难度信息 if (ratingList.IsNullOrEmptySet()) { MultiSelectionHelper.TryGetMultiSelections(Rating, out ratingList, @"^(11|10|[1-9])\+?$"); } //处理限定难度类型信息 Regex regex = new Regex("(,|,)?(ftr|pst|prs|byd|byn|future|past|present|beyond|all)(,|,)?", RegexOptions.IgnoreCase | RegexOptions.RightToLeft); if (!SongName.IsNullOrEmpty() && regex.IsMatch(SongName)) //若是歌名上包含难度信息则取出来 { RatingClass = SongName.Match("(ftr|pst|prs|byd|byn|future|past|present|beyond|all)", RegexOptions.IgnoreCase | RegexOptions.RightToLeft); SongName = regex.Replace(SongName, "", 1).Trim(); } if (!RatingClass.IsNullOrEmpty())//RatingClass属性优先级比该函数中的ratingClss优先级大 { if (!Enum.TryParse(RatingClass, out ratingClass)) { if (PluginArcaeaSong.RatingClassNameList.ContainsKey(RatingClass.ToLower())) { ratingClass = PluginArcaeaSong.RatingClassNameList[RatingClass.ToLower()]; } } } //设定难度类型默认值为FTR if (ratingList.IsNullOrEmptySet() && RatingClass.IsNullOrWhiteSpace() && NotesCount.IsNullOrWhiteSpace() && ChartConstant.IsNullOrWhiteSpace() && Rating.IsNullOrWhiteSpace()) //不指定难度类型则默认是future难度,后面是不默认ftr { ratingClass = PluginArcaeaSong.RatingClass.Future; } //处理歌名信息 if (!SongName.IsNullOrWhiteSpace()) { SongName = SongName.Trim().ToLower(); string songEnID = _kouContext.Set <PluginArcaeaSongAnotherName>().FirstOrDefault(s => s.AnotherName == SongName)?.SongEnId; if (songEnID != null) { SongEnID = songEnID; SongName = null; } } //将需要用到的过滤器放到过滤容器里 FilterContainer <PluginArcaeaSong> filterContainer = new FilterContainer <PluginArcaeaSong>(); //使用默认ModelFilter filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongTitle), SongName, FilterType.Default, SortType.Ascending);//增加Song_title字段的默认filter filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongEnId), SongEnID, FilterType.Exact); if (ratingClass != PluginArcaeaSong.RatingClass.Random) { filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.ChartRatingClass), ratingClass, FilterType.SupportValueDefault); } filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongArtist), SongArtist, FilterType.Default, SortType.Ascending); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.ChartDesigner), ChartDesigner, FilterType.Default, SortType.Ascending); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.JacketDesigner), JacketDesigner, FilterType.Default, SortType.Ascending); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.ChartAllNotes), NotesCount, FilterType.Default, SortType.StringAuto); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.ChartConstant), ChartConstant, FilterType.Default, SortType.StringAuto); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongLength), SongLength, FilterType.Default, SortType.StringAuto); filterContainer.AddAutoModelFilter(nameof(PluginArcaeaSong.SongBpm), SongBPM, FilterType.Interval, SortType.StringAuto); filterContainer.ActivateAutoModelFilter(); //加入自定义的filter if (!ratingList.IsNullOrEmptySet()) { filterContainer.Add(FilterContainer <PluginArcaeaSong> .Convert(PluginArcaeaSong.RatingNumFilter), ratingList); } //开始筛选 var selectedList = _kouContext.Set <PluginArcaeaSong>().ToList(); selectedList = selectedList.Where(song => filterContainer.StartFilter(song)).ToList(); var sorter = filterContainer.GetModelSorter();//若有sorter则排序 if (sorter != null) { selectedList.Sort(sorter); } return(selectedList); }