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();
 }
示例#2
0
        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));
        }
示例#4
0
        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);
        }
示例#5
0
 public void Update(T oldResource, T newResource)
 {
     RemoveRedundancy(oldResource);
     _mergedDictionaries.Add(_reader.Read(newResource));
 }