public RssFeedResources(IResourceReader resources) { this.resources = resources; var r = XmlReader.Create(new MemoryStream(new UTF8Encoding().GetBytes(resources.Read("http://molecule.nl/decorrespondent/rss.php")))); var xml = XDocument.Load(r); items = xml.XPathSelectElements("rss/channel/item").Select(i => new RssItem(i)).ToList(); }
public bool ForceLoad <T>(string path, IResourceReader <T> reader) { bool isReplaced = this.loaded.Remove(path); object item = reader.Read(path); this.loaded.Add(path, item); return(isReplaced); }
public IResource CreateResource(string resourcePath, string resourceName) { if (_fileResourceProvider.CanWrite(resourcePath) && _defaultResourceReader.CanRead(resourceName)) { var resourceContent = _defaultResourceReader.Read(resourceName); _fileResourceProvider.Write(resourcePath, resourceContent); } return(GetResource(resourcePath)); }
public T Load <T>(string path, IResourceReader <T> reader) { object item; if (IsLoaded(path)) { item = this.loaded[path]; } else { item = reader.Read(path); this.loaded.Add(path, item); } return((T)item); }
public void Update(T oldResource, T newResource) { RemoveRedundancy(oldResource); _mergedDictionaries.Add(_reader.Read(newResource)); }