private static async Task <IDictionary <Guid, int> > UpdateDownloadedFeedsAsync(IDictionary <Guid, Feed> subscribedFeeds, string fileName, IPersistentManager dbContext) { var feedsUpdated = await dbContext.ReadSerializedCopyAsync <List <Feed> >(fileName); if (feedsUpdated == null || feedsUpdated.Count == 0) { return(null); } var updatedFeeds = new Dictionary <Guid, int>(); feedsUpdated.ForEach(f => { if (!subscribedFeeds.ContainsKey(f.Id)) { return; } var persistentFeed = subscribedFeeds[f.Id]; var updatedItemCount = FeedHelper.UpdateFeedItems(persistentFeed, f.Items); if (updatedItemCount > 0) { updatedFeeds.Add(persistentFeed.Id, updatedItemCount); } persistentFeed.LastUpdatedTime = f.LastUpdatedTime; }); return(updatedFeeds); }
private async Task <bool> LoadStoredItemsAsync() { if (_storedItems == null || _storedItems.Count == 0) { _storedItems = await _dbContext.ReadSerializedCopyAsync <IDictionary <string, Item> >(AppConfig.STORED_ITEM_FILE_NAME); } return(_storedItems != null && _storedItems.Count > 0); }