Beispiel #1
0
        internal static bool CheckIfPodcastChanged(Podcast podcast1, Podcast podcast2)
        {
            bool isPodcastChanged = false;

            if (
                (podcast1.Title == podcast2.Title) &&
                (podcast1.URL == podcast2.URL) &&
                (podcast1.UpdateInterval == podcast2.UpdateInterval) &&
                (podcast1.Category == podcast2.Category))
            {
                isPodcastChanged = false;
            }
            else
            {
                isPodcastChanged = true;
            }
            return(isPodcastChanged);
        }
Beispiel #2
0
        internal static bool UpdatePodcast(Podcast oldPodcast, Podcast newPodcast)
        {
            bool isPodcastUpdate = false;

            if (Validater.CheckIfPodcastChanged(oldPodcast, newPodcast))
            {
                bool updatePodcast = true;
                foreach (var p in listOfPodcast)
                {
                    if ((p.Title == newPodcast.Title) && !(oldPodcast.Title == newPodcast.Title))
                    {
                        Dialog.PodcastExist();
                        updatePodcast = false;
                        break;
                    }
                }
                if (updatePodcast)
                {
                    if (Validater.NotEmpty(newPodcast))
                    {
                        if ((Validater.IsURL(newPodcast.URL)))
                        {
                            ListHandler.RemovePodcast(oldPodcast.Title);
                            listOfPodcast.Add(newPodcast);
                            new FileHandler().SavePodcasts(listOfPodcast);
                            isPodcastUpdate = true;
                            Dialog.PodcastUpdated();
                        }
                        else
                        {
                            Dialog.NotURL();
                        }
                    }
                    else
                    {
                        new Dialog().EmptyInput();
                    }
                }
            }
            return(isPodcastUpdate);
        }