Ejemplo n.º 1
0
        public void checkIfThereAreNewEpisodes(Feed feed)
        {
            try
            {
                var  inFeedName                   = feed.Name;
                int  inFeedAmountOfEpisodes       = feed.Episodes.Count;
                var  existingFeedAmountOfEpisodes = EpisodeController.GetEpisodes(feed.Url).Count;
                Feed existingFeed                 = GetSpecificFeed(inFeedName);


                if (existingFeedAmountOfEpisodes > inFeedAmountOfEpisodes)
                {
                    UpdateSpecifikFeed(feed.Url, feed.Frequency, feed.Category, feed.Name);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong while checking for new Episodes " + ex);
            }
        }
Ejemplo n.º 2
0
        public void createFeed(string url, string inFrequency, string inCategory)
        {
            SyndicationFeed syndicationFeed = RssReader.ReadRss(url);

            if (ValidationService.checkIfRssReturnAFeed(syndicationFeed))
            {
                var name             = syndicationFeed.Title.Text;
                var numberOfEpisodes = EpisodeController.GetEpisodes(url).Count;

                Feed feed = new Feed(numberOfEpisodes, name, inFrequency, inCategory, EpisodeController.GetEpisodes(url), url);

                if (!ValidationService.checkIfFeedExist(GetAllFeeds(), url))
                {
                    AddFeed(feed);
                }
                else
                {
                    MessageBox.Show("There is already a feed with this Url.");
                }
            }
        }