public static bool EvaluateAnimeTextSearch(AniDB_AnimeVM anime, string filterText, SeriesSearchType searchType) { if (String.IsNullOrEmpty(filterText) || anime == null) return true; // search the romaji name, english names etc from anidb int index = anime.AllTitles.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase); if (index > -1) return true; if (searchType == SeriesSearchType.Everything) { // check the categories index = anime.AllCategories.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase); if (index > -1) return true; } if (searchType == SeriesSearchType.Everything) { // check the tags index = anime.AllTags.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase); if (index > -1) return true; } return false; }
public static bool EvaluateAnimeTextSearch(AniDB_AnimeVM anime, string filterText, SeriesSearchType searchType) { if (string.IsNullOrEmpty(filterText) || anime == null) return true; // search the romaji name, english names etc from anidb if (anime.AllTitles.SubContains(filterText)) return true; if (searchType == SeriesSearchType.Everything) { // check the tags if (anime.AllTags.Contains(filterText, StringComparer.InvariantCultureIgnoreCase)) return true; } return false; }
public static List<AniDB_AnimeVM> BestLevenshteinDistanceMatchesCache(string input, int maxResults) { List<LDContainer> allLDs = new List<LDContainer>(); List<AniDB_AnimeVM> AllAnime = new List<AniDB_AnimeVM>(MainListHelperVM.Instance.AllAnimeDictionary.Values); List<JMMServerBinary.Contract_AniDBAnime> animeRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAllAnime(); foreach (JMMServerBinary.Contract_AniDBAnime anime in animeRaw) { AniDB_AnimeVM animeNew = new AniDB_AnimeVM(anime); AllAnime.Add(animeNew); } // now sort the groups by name List<SortPropOrFieldAndDirection> sortCriteria = new List<SortPropOrFieldAndDirection>(); sortCriteria.Add(new SortPropOrFieldAndDirection("MainTitle", false, SortType.eString)); AllAnime = Sorting.MultiSort<AniDB_AnimeVM>(AllAnime, sortCriteria); foreach (AniDB_AnimeVM anime in AllAnime) { LDContainer ldc = new LDContainer(); ldc.AnimeID = anime.AnimeID; ldc.LD = anime.LowestLevenshteinDistance(input); ldc.Anime = anime; allLDs.Add(ldc); } // now sort the groups by best score sortCriteria = new List<SortPropOrFieldAndDirection>(); sortCriteria.Add(new SortPropOrFieldAndDirection("LD", false, SortType.eInteger)); allLDs = Sorting.MultiSort<LDContainer>(allLDs, sortCriteria); List<AniDB_AnimeVM> retAnime = new List<AniDB_AnimeVM>(); for (int i = 0; i < allLDs.Count; i++) { AniDB_AnimeVM anime = allLDs[i].Anime; retAnime.Add(anime); if (i == maxResults - 1) break; } foreach (AniDB_AnimeVM anime in AllAnime) { retAnime.Add(anime); } return retAnime; }
public void ShowWebCacheAdmin(AniDB_AnimeVM anime) { try { SearchCriteria crit = new SearchCriteria(); crit = new SearchCriteria(); crit.ExtraInfo = string.Empty; crit.AnimeID = anime.AnimeID; tabControl1.SelectedIndex = TAB_MAIN_Community; tabcCommunity.SelectedIndex = 0; ucComLinks.PerformTvDBSearch(crit); ucComLinks.PerformTraktSearch(crit); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void RefreshMiniCalendar() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { MiniCalendar.Clear(); ViewMiniCalendar.SortDescriptions.Clear(); if (UserSettingsVM.Instance.Dash_MiniCalendarUpcomingOnly) ViewMiniCalendar.SortDescriptions.Add(new SortDescription("AirDate", ListSortDirection.Ascending)); else ViewMiniCalendar.SortDescriptions.Add(new SortDescription("AirDate", ListSortDirection.Descending)); }); List<JMMServerBinary.Contract_AniDBAnime> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetMiniCalendar(JMMServerVM.Instance.CurrentUser.JMMUserID.Value, UserSettingsVM.Instance.Dash_MiniCalendarDays); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { DateTime yesterday = DateTime.Now.AddDays(-1); foreach (JMMServerBinary.Contract_AniDBAnime contract in contracts) { bool useAnime = true; if (UserSettingsVM.Instance.Dash_MiniCalendarUpcomingOnly && contract.AirDate < yesterday) useAnime = false; if (useAnime) { AniDB_AnimeVM anime = new AniDB_AnimeVM(contract); if (JMMServerVM.Instance.CurrentUser.EvaluateAnime(anime)) MiniCalendar.Add(anime); } } ViewMiniCalendar.Refresh(); }); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
public static bool EvaluateAnimeTextSearch(AniDB_AnimeVM anime, string filterText) { return EvaluateAnimeTextSearch(anime, filterText, SeriesSearchType.Everything); }
public void RefreshMiniCalendar() { try { System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { MiniCalendar.Clear(); }); List<JMMServerBinary.Contract_AniDBAnime> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetMiniCalendar(JMMServerVM.Instance.CurrentUser.JMMUserID.Value, UserSettingsVM.Instance.Dash_MiniCalendarDays); System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)delegate() { foreach (JMMServerBinary.Contract_AniDBAnime contract in contracts) { AniDB_AnimeVM anime = new AniDB_AnimeVM(contract); if (JMMServerVM.Instance.CurrentUser.EvaluateAnime(anime)) MiniCalendar.Add(anime); } ViewEpsWatchNext_Recent.Refresh(); }); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { } }
public void UpdateAnime(int animeID) { try { JMMServerBinary.Contract_AniDBAnime animeRaw = JMMServerVM.Instance.clientBinaryHTTP.GetAnime(animeID); if (animeRaw != null) { AniDB_AnimeVM anime = new AniDB_AnimeVM(animeRaw); AllAnimeDictionary[anime.AnimeID] = anime; // update the series foreach (AnimeSeriesVM ser in AllSeries) { if (ser.AniDB_ID == anime.AnimeID) { ser.RefreshBase(); ser.AniDB_Anime.Detail.RefreshBase(); AllSeriesDictionary[ser.AnimeSeriesID.Value] = ser; } } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }