/// <summary> /// Adds the feed source to the list of GoogleReaderFeedSources being modified by this class /// </summary> /// <param name="source"></param> public void RegisterFeedSource(GoogleReaderFeedSource source) { if (FeedSources.ContainsKey(source.GoogleUserName)) { FeedSources.Remove(source.GoogleUserName); } FeedSources.Add(source.GoogleUserName, source); }
/// <summary> /// Removes the feed source from the list of GoogleReaderFeedSources being modified by this class. /// </summary> /// <param name="source"></param> public void UnregisterFeedSource(GoogleReaderFeedSource source) { FeedSources.Remove(source.GoogleUserName); }
/// <summary> /// Performs the specified PendingGoogleReaderOperation. /// </summary> /// <param name="current">The operation to perform</param> private void PerformOperation(PendingGoogleReaderOperation current) { GoogleReaderFeedSource source = null; FeedSources.TryGetValue(current.GoogleUserName, out source); if (source == null) { return; } try { switch (current.Action) { case GoogleReaderOperation.AddFeed: source.AddFeedInGoogleReader(current.Parameters[0] as string, current.Parameters[1] as string); break; case GoogleReaderOperation.AddLabel: source.AddCategoryInGoogleReader(current.Parameters[0] as string); break; case GoogleReaderOperation.DeleteFeed: source.DeleteFeedFromGoogleReader(current.Parameters[0] as string, current.Parameters[1] as string); break; case GoogleReaderOperation.DeleteLabel: source.DeleteCategoryInGoogleReader(current.Parameters[0] as string); break; case GoogleReaderOperation.MarkAllItemsRead: source.MarkAllItemsAsReadInGoogleReader(current.Parameters[0] as string, current.Parameters[1] as string); break; case GoogleReaderOperation.MarkSingleItemRead: source.ChangeItemReadStateInGoogleReader(current.Parameters[0] as string, current.Parameters[1] as string, (bool)current.Parameters[2]); break; case GoogleReaderOperation.MarkSingleItemTagged: source.ChangeItemTaggedStateInGoogleReader(current.Parameters[0] as string, current.Parameters[1] as string, current.Parameters[2] as string, (bool)current.Parameters[3]); break; case GoogleReaderOperation.MoveFeed: source.ChangeCategoryInGoogleReader(current.Parameters[0] as string, current.Parameters[1] as string, current.Parameters[2] as string); break; case GoogleReaderOperation.RenameFeed: source.RenameFeedInGoogleReader(current.Parameters[0] as string, current.Parameters[1] as string); break; case GoogleReaderOperation.RenameLabel: source.RenameCategoryInGoogleReader(current.Parameters[0] as string, current.Parameters[1] as string); break; default: Debug.Assert(false, "Unknown Google Reader operation: " + current.Action); return; } } catch (Exception e) { //TODO: Rethrow to handle time outs and connections cancelled by host _log.Error("Error in GoogleReaderModifier.PerformOperation:", e); } ; }