当前位置: 首页>>代码示例>>C#>>正文


C# AniDB_AnimeRepository.SearchByTag方法代码示例

本文整理汇总了C#中JMMServer.Repositories.AniDB_AnimeRepository.SearchByTag方法的典型用法代码示例。如果您正苦于以下问题:C# AniDB_AnimeRepository.SearchByTag方法的具体用法?C# AniDB_AnimeRepository.SearchByTag怎么用?C# AniDB_AnimeRepository.SearchByTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JMMServer.Repositories.AniDB_AnimeRepository的用法示例。


在下文中一共展示了AniDB_AnimeRepository.SearchByTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Search

        public System.IO.Stream Search(string UserId, string limit, string query, bool searchTag)
        {
            KodiObject ret =new KodiObject(KodiHelper.NewMediaContainer("Search",false));
            ret.MediaContainer.Title2 = "Search Results for '" + query + "'...";
            AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
            AnimeSeriesRepository repSeries = new AnimeSeriesRepository();

            int lim;
            if (!int.TryParse(limit, out lim))
                lim = 100;
            JMMUser user = KodiHelper.GetUser(UserId);
            if (user == null) return new MemoryStream();
            List<Video> ls=new List<Video>();
            int cnt = 0;
            List<AniDB_Anime> animes;
            if (searchTag)
            {
                animes = repAnime.SearchByTag(query);
            }
            else
            {
                animes = repAnime.SearchByName(query);
            }
            foreach (AniDB_Anime anidb_anime in animes)
            {
                if (!user.AllowedAnime(anidb_anime)) continue;
                AnimeSeries ser = repSeries.GetByAnimeID(anidb_anime.AnimeID);
                if (ser != null)
                {
                    Contract_AnimeSeries cserie = ser.ToContract(ser.GetUserRecord(user.JMMUserID), true);
                    Video v = KodiHelper.FromSerieWithPossibleReplacement(cserie, ser, user.JMMUserID);

                    //proper naming
                    v.OriginalTitle = "";
                    foreach (AniDB_Anime_Title title in anidb_anime.GetTitles())
                    {
                        if (title.TitleType == "official" || title.TitleType == "main")
                        {
                            v.OriginalTitle += "{" + title.TitleType + ":" + title.Language + "}" + title.Title + "|";
                        }
                    }
                    v.OriginalTitle = v.OriginalTitle.Substring(0, v.OriginalTitle.Length - 1);
                    //proper naming end

                    //experiment
                    Characters c = new Characters();
                    c.CharactersList = new List<Character>();
                    c.CharactersList = GetCharactersFromAniDB(anidb_anime);
                    v.CharactersList = new List<Characters>();
                    v.CharactersList.Add(c);
                    //experiment END

                    switch (anidb_anime.AnimeTypeEnum)
                    {
                        case enAnimeType.Movie:
                            v.SourceTitle = "Anime Movies";
                            break;
                        case enAnimeType.OVA:
                            v.SourceTitle = "Anime Ovas";
                            break;
                        case enAnimeType.Other:
                            v.SourceTitle = "Anime Others";
                            break;
                        case enAnimeType.TVSeries:
                            v.SourceTitle = "Anime Series";
                            break;
                        case enAnimeType.TVSpecial:
                            v.SourceTitle = "Anime Specials";
                            break;
                        case enAnimeType.Web:
                            v.SourceTitle = "Anime Web Clips";
                            break;

                    }

                    ls.Add(v);
                    cnt++;
                    if (cnt == lim)
                        break;
                }
            }
            ret.MediaContainer.Childrens= ls;
            return ret.GetStream();
        }
开发者ID:,项目名称:,代码行数:84,代码来源:


注:本文中的JMMServer.Repositories.AniDB_AnimeRepository.SearchByTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。