コード例 #1
0
        /// <summary>
        /// Finds the closest anime (based on the user query)
        /// </summary>
        public void GetAndSetToClosestAnime()
        {
            searchResultOfAnime = jikanInterface.SearchAnime(_animeName).Result;
            if (searchResultOfAnime == null)
            {
                GetAndSetToRandomAnime();
            }
            else
            {
                _animeName = searchResultOfAnime.Results.First().Title;
                _malId     = searchResultOfAnime.Results.First().MalId;
                anime      = jikanInterface.GetAnime(_malId).Result;

                //If NSFW content is looked up, search up another anime
                if (anime.Rating.Contains("Rx"))
                {
                    GetAndSetToRandomAnime();
                }
                else
                {
                    animeName       = _animeName;
                    _scoreOfAnime   = (float)searchResultOfAnime.Results.First().Score;
                    _reviewsOfAnime = jikanInterface.GetAnimeReviews(_malId).Result;
                    _animePictures  = jikanInterface.GetAnimePictures(_malId).Result;
                }
            }
        }