public void AddFeed(string name, string url) { if (_feeds.ContainsKey(name)) { throw new Exception("A feed with the specified name already exists."); } var feed = new RssFeed { Url = url }; feed.CatchUp(); _feeds.Add(name, feed); }
protected override void LoadConfig(XElement moduleEl) { base.LoadConfig(moduleEl); foreach(var feedEl in moduleEl.Elements("feed")) { var feed = new RssFeed(); BotModule.LoadProperties(feed, feedEl); if (_feeds.ContainsKey(feed.Name)) { throw new BotConfigException(string.Format( "An RSS feed with the name {0} already exists.", feed.Name)); } try { feed.CatchUp(); _feeds.Add(feed.Name, feed); } catch (Exception ex) { throw new BotConfigException(string.Format( "An RSS feed with the name {0} could not be loaded: {1}", feed.Name, ex.Message)); } } }