Exemplo n.º 1
0
        public static int Update(Feed feed, ISession session, bool checktimestamp)
        {
            int result = 0;

            switch ((TransitFeedType)Enum.Parse(typeof(TransitFeedType), feed.Type))
            {
            case TransitFeedType.Rss:
                ManagedRssFeed rssFeed = new ManagedRssFeed(feed);
                if (!checktimestamp || rssFeed.NeedsUpdate)
                {
                    result = rssFeed.Update(session);
                }
                break;

            case TransitFeedType.Atom:
                ManagedAtomFeed atomFeed = new ManagedAtomFeed(feed);
                if (!checktimestamp || atomFeed.NeedsUpdate)
                {
                    result = atomFeed.Update(session);
                }
                break;

            case TransitFeedType.AtomPost:
                ManagedAtomPostFeed atomPostFeed = new ManagedAtomPostFeed(feed);
                if (!checktimestamp || atomPostFeed.NeedsUpdate)
                {
                    result = atomPostFeed.Update(session);
                }
                break;

            case TransitFeedType.ZenFlashGallery:
                ManagedZenFlashGalleryFeed zenFeed = new ManagedZenFlashGalleryFeed(feed);
                if (!checktimestamp || zenFeed.NeedsUpdate)
                {
                    result = zenFeed.Update(session);
                }
                break;

            default:
                throw new Exception("Unsupported feed type.");
            }
            return(result);
        }
Exemplo n.º 2
0
 public static int Update(Feed feed, ISession session, bool checktimestamp)
 {
     int result = 0;
     switch ((TransitFeedType)Enum.Parse(typeof(TransitFeedType), feed.Type))
     {
         case TransitFeedType.Rss:
             ManagedRssFeed rssFeed = new ManagedRssFeed(feed);
             if (!checktimestamp || rssFeed.NeedsUpdate)
             {
                 result = rssFeed.Update(session);
             }
             break;
         case TransitFeedType.Atom:
             ManagedAtomFeed atomFeed = new ManagedAtomFeed(feed);
             if (!checktimestamp || atomFeed.NeedsUpdate)
             {
                 result = atomFeed.Update(session);
             }
             break;
         case TransitFeedType.AtomPost:
             ManagedAtomPostFeed atomPostFeed = new ManagedAtomPostFeed(feed);
             if (!checktimestamp || atomPostFeed.NeedsUpdate)
             {
                 result = atomPostFeed.Update(session);
             }
             break;
         case TransitFeedType.ZenFlashGallery:
             ManagedZenFlashGalleryFeed zenFeed = new ManagedZenFlashGalleryFeed(feed);
             if (!checktimestamp || zenFeed.NeedsUpdate)
             {
                 result = zenFeed.Update(session);
             }
             break;
         default:
             throw new Exception("Unsupported feed type.");
     }
     return result;
 }