Ejemplo n.º 1
0
        public async Task <CharadesEntry> MakeNextCharadesEntry()
        {
            bool shouldGoToNextSource = nextEntryIndex == currentMergedList.Count;

            if (shouldGoToNextSource)
            {
                nextEntryIndex = 0;
                if (sources.Count != 0)
                {
                    currentSource = sources.Dequeue();
                    await GetCurrentMergedListFromSource();
                }
                else if (otherSources.Count != 0)
                {
                    adaptationStrategy = AdaptationIncluding.OnlyKnownInOthers;
                    currentSource      = otherSources.Dequeue();
                    await GetCurrentMergedListFromSource();
                }
                else
                {
                    return(null);
                }
            }
            var entry        = currentMergedList[nextEntryIndex++];
            var nextCharades = await CreateNextCharades(entry);

            return(nextCharades);
        }
Ejemplo n.º 2
0
        public SeriesEntry CreateFromManga(long id, AdaptationIncluding withdaptations = AdaptationIncluding.None)
        {
            var provider     = providerFactory.Get(EntrySource.Manga);
            var mangaEntries = GetFranchiseEntries(id, provider);

            if (mangaEntries.Count == 0)
            {
                return(null);
            }
            switch (withdaptations)
            {
            case AdaptationIncluding.OnlyFromEntries:
                var animeEntries = GetEntriesAdaptations(mangaEntries, EntrySource.Anime);
                return(CreateFranchise(animeEntries, mangaEntries));

            case AdaptationIncluding.All:
            case AdaptationIncluding.OnlyKnownInOthers:
                animeEntries = GetAllAdaptations(mangaEntries, EntrySource.Anime);
                return(CreateFranchise(animeEntries, mangaEntries));

            case AdaptationIncluding.None:
            default:
                return(CreateFranchise(new List <IEntryInstance>(), mangaEntries));
            }
        }
Ejemplo n.º 3
0
 private void Reset()
 {
     charades = new List <CharadesEntry>();
     sources.Clear();
     otherSources.Clear();
     nextEntryIndex = 0;
     currentMergedList.Clear();
     adaptationStrategy = AdaptationIncluding.None;
 }
Ejemplo n.º 4
0
        public void StartComposing(GetCharadesCriteria criteria)
        {
            Reset();
            usernames = criteria.Usernames;
            sources.EnqueueRange(criteria.Sources);
            var allSources = Enum.GetValues(typeof(EntrySource)).Cast <EntrySource>();
            var isAllDone  = criteria.Sources.Count == allSources.Count();

            if (isAllDone)
            {
                adaptationStrategy = AdaptationIncluding.All;
            }
            else if (criteria.IncludeKnownAdaptations && sources.Count != 0)
            {
                adaptationStrategy = AdaptationIncluding.OnlyFromEntries;
                var otherSources = allSources.Except(criteria.Sources);
                this.otherSources.EnqueueRange(otherSources);
            }
        }
Ejemplo n.º 5
0
        public SeriesEntry CreateFranchise(IListEntry entry, IFranchiseService franchiseService, AdaptationIncluding withAdaptations)
        {
            var franchise = franchiseService.CreateFromAnime(entry.Id, withAdaptations);

            return(franchise);
        }