private void InitializeConfig(FeedConfig config) { config.BasePath = System.Configuration.ConfigurationManager.AppSettings["BasePath"]; config.Feeds.Add(new FeedDefinition { Name = "dotnetrocks", LatestDownload = DateTime.Today.AddDays(-7), Url = "http://www.pwop.com/feed.aspx?show=dotnetrocks&filetype=master" }); }
private static FeedConfig InitializeConfig() { var config = new FeedConfig(); config.Feeds.Add(new FeedDefinition { Name = "dotnetrocks", LatestDownload = DateTime.Today.AddDays(-7), Url = "http://www.pwop.com/feed.aspx?show=dotnetrocks&filetype=master", }); return(config); }
/// <summary> /// Gets the current configuration. /// </summary> /// <returns>A feed configuration.</returns> public FeedConfig GetCurrentConfig() { // already loaded one? if (this.currentConfig == null) { // does the file exist? if (File.Exists(this.configPath)) { var json = File.ReadAllText(this.configPath); this.currentConfig = JsonConvert.DeserializeObject <FeedConfig>(json); } else { // create one! this.currentConfig = InitializeConfig(); this.SaveCurrentConfig(); } } return(this.currentConfig); }