コード例 #1
0
 private void ChooseMergeItem(string id, KeyedCollection<string, SubscriptionItem> previousAuxList, KeyedCollection<string, FeedItem> currentAuxList, MergeResult result)
 {
     var previous = previousAuxList.Take(id);
     var current = currentAuxList.Take(id);
     if (previous.LastUpdatedTime == current.LastUpdatedTime)
     {
         result.AddItem(previous, ItemMergeStatus.NoChangedItem);
     }
     else
     {
         previous.Update(current);
         result.AddItem(previous, ItemMergeStatus.UpdatedItem);
     }
 }
コード例 #2
0
 public MergeResult Merge(IEnumerable<SubscriptionItem> oldItems, IEnumerable<FeedItem> newItems)
 {
     var items = newItems.Select(x =>
     {
         var item = new SubscriptionItem(Subscription)
         {
             Id = x.Id,
             PublishDate = x.PublishDate,
             LastUpdatedTime = x.LastUpdatedTime,
             Summary = x.Summary,
             Title = x.Title,
             Categories = x.Categories
         };
         item.Links = x.Links.Select(y => new SubscriptionItemLink(item)
         {
             Length = y.Length,
             MediaType = y.MediaType,
             RelationshipType = y.RelationshipType,
             Title = y.Title,
             Uri = y.Uri
         }).ToList();
         return item;
     });
     var result = new MergeResult();
     foreach (var item in items)
         result.AddItem(item, ItemMergeStatus.NewItem);
     return result;
 }
コード例 #3
0
 private void ChooseRemovedItem(string id, KeyedCollection<string, SubscriptionItem> previousAuxList, MergeResult result)
 {
     result.AddItem(previousAuxList.Take(id), ItemMergeStatus.RemovedItem);
 }
コード例 #4
0
 private void ChooseNewItem(string id, KeyedCollection<string, FeedItem> currentAuxList, MergeResult result)
 {
     result.AddItem(new SubscriptionItem(currentAuxList.Take(id)), ItemMergeStatus.NewItem);
 }