Ejemplo n.º 1
0
 public SubscriptionItem(FeedItem item)
 {
     Id = item.Id;
     PublishDate = item.PublishDate;
     LastUpdatedTime = item.LastUpdatedTime;
     Summary = item.Summary;
     Title = item.Title;
     Categories = item.Categories;
     Links = item.Links.Select(y => CreateLink(y)).ToList();
 }
Ejemplo n.º 2
0
 public void Update(FeedItem item)
 {
     LastUpdatedTime = item.LastUpdatedTime;
     Summary = item.Summary;
     Title = item.Title;
     Categories = item.Categories;
     var previousLinksAux = new KeyedCollection<Uri, SubscriptionItemLink>(x => x.Uri, Links);
     foreach (var currentLink in item.Links)
     {
         if (previousLinksAux.Contains(currentLink.Uri))
         {
             var previousLink = previousLinksAux[currentLink.Uri];
             if (previousLink.IsDownloaded && previousLink.Length != currentLink.Length)
             {
                 previousLink.Length = currentLink.Length;
                 previousLink.MarkAsNotDownloaded();
             }
             previousLink.MediaType = currentLink.MediaType;
             previousLink.RelationshipType = currentLink.RelationshipType;
             previousLink.Title = currentLink.Title;
             previousLinksAux.Remove(currentLink.Uri);
         }
         else
         {
             var newLink = CreateLink(currentLink);
             Links.Add(newLink);
         }
     }
     foreach (var previousLink in previousLinksAux)
         previousLink.Deleted = true;
 }