Example #1
0
		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;
		}
Example #2
0
		public static bool EvaluateSeriesTextSearch(AnimeSeriesVM series, string filterText, SeriesSearchType searchType)
		{
			if (String.IsNullOrEmpty(filterText) || series == null)
				return true;

			if (!string.IsNullOrEmpty(series.SeriesNameOverride))
			{
				int index = series.SeriesNameOverride.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase);
				if (index > -1) return true;
			}

			return EvaluateAnimeTextSearch(series.AniDB_Anime, filterText, searchType);
		}
        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 bool EvaluateSeriesTextSearch(VM_AnimeSeries_User series, string filterText, SeriesSearchType searchType)
        {
            if (string.IsNullOrEmpty(filterText) || series == null)
            {
                return(true);
            }

            if (!string.IsNullOrEmpty(series.SeriesNameOverride))
            {
                int index = series.SeriesNameOverride.IndexOf(filterText, 0, StringComparison.InvariantCultureIgnoreCase);
                if (index > -1)
                {
                    return(true);
                }
            }

            return(EvaluateAnimeTextSearch(series.AniDBAnime, filterText, searchType));
        }
        public static bool EvaluateAnimeTextSearch(VM_AniDB_Anime anime, string filterText, SeriesSearchType searchType)
        {
            if (string.IsNullOrEmpty(filterText) || anime == null)
            {
                return(true);
            }

            // search the romaji name, english names etc from anidb
            if (anime.GetAllTitles().SubContains(filterText))
            {
                return(true);
            }

            if (anime.GetAllTitles() != null)
            {
                foreach (string title in anime.GetAllTitles())
                {
                    if (string.IsNullOrEmpty(title))
                    {
                        continue;
                    }
                    if (!Misc.FuzzyMatches(title, filterText))
                    {
                        continue;
                    }
                    return(true);
                }
            }

            if (searchType == SeriesSearchType.Everything)
            {
                // check the tags
                if (anime.GetAllTags().Contains(filterText, StringComparer.InvariantCultureIgnoreCase))
                {
                    return(true);
                }
            }

            return(false);
        }
        public static bool EvaluateAnimeTextSearch(CL_AniDB_AnimeDetailed anime, string filterText, SeriesSearchType searchType)
        {
            if (string.IsNullOrEmpty(filterText) || anime == null)
            {
                return(true);
            }

            // search the romaji name, english names etc from anidb
            if (anime.AnimeTitles.Any(a =>
                                      (a.Language.Equals("en") || a.Language.Equals("x-jat") ||
                                       a.Language.Equals(VM_ShokoServer.Instance.LanguagePreference)) && a.Title.Contains(filterText)))
            {
                return(true);
            }

            foreach (string title in anime.AnimeTitles.Where(a =>
                                                             a.Language.Equals("en") || a.Language.Equals("x-jat") ||
                                                             a.Language.Equals(VM_ShokoServer.Instance.LanguagePreference)).Select(a => a.Title))
            {
                if (string.IsNullOrEmpty(title))
                {
                    continue;
                }
                if (!Misc.FuzzyMatches(title, filterText))
                {
                    continue;
                }
                return(true);
            }

            if (searchType == SeriesSearchType.Everything)
            {
                // check the tags
                if (anime.Tags.Select(a => a.TagName).Contains(filterText, StringComparer.InvariantCultureIgnoreCase))
                {
                    return(true);
                }
            }

            return(false);
        }
        public static bool EvaluateAnimeTextSearch(CL_AniDB_AnimeDetailed anime, string filterText, SeriesSearchType searchType = SeriesSearchType.TitleOnly)
        {
            filterText = filterText.Trim();
            if (string.IsNullOrEmpty(filterText))
            {
                return(true);
            }

            if (anime == null)
            {
                return(false);
            }

            // search the romaji name, english names etc from anidb
            if (anime.AnimeTitles.Any(a =>
                                      (a.Language.Equals("en") || a.Language.Equals("x-jat") ||
                                       a.Language.Equals(VM_ShokoServer.Instance.LanguagePreference)) && a.Title.FuzzyMatches(filterText)))
            {
                return(true);
            }

            // check the tags
            if (searchType == SeriesSearchType.Everything && anime.Tags.Select(a => a.TagName).Any(a => a.FuzzyMatches(filterText)))
            {
                return(true);
            }

            return(false);
        }
        public static bool EvaluateSeriesTextSearch(VM_AnimeSeries_User series, string filterText, SeriesSearchType searchType = SeriesSearchType.TitleOnly)
        {
            filterText = filterText.Trim();
            if (string.IsNullOrEmpty(filterText))
            {
                return(true);
            }

            if (series == null)
            {
                return(false);
            }

            if (IsDigitsOnly(filterText))
            {
                return(Convert.ToInt32(filterText) == series.AniDBAnime.AniDBAnime.AnimeID);
            }

            if (!string.IsNullOrEmpty(series.SeriesNameOverride) && series.SeriesNameOverride.FuzzyMatches(filterText))
            {
                return(true);
            }

            return(EvaluateAnimeTextSearch(series.AniDBAnime, filterText, searchType));
        }
Example #9
0
        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 tags
                index = anime.AllTags.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);
        }