mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00

Renamed and organized some components Rough implementation of install/expand (currently to alternate location to avoid overwrites) --HG-- branch : dev
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.ServiceModel.Syndication;
|
|
using System.Web;
|
|
using System.Web.Hosting;
|
|
using System.Xml;
|
|
|
|
namespace PackageIndexReferenceImplementation.Services {
|
|
public class FeedStorage {
|
|
|
|
public SyndicationFeed GetFeed() {
|
|
var formatter = new Atom10FeedFormatter<SyndicationFeed>();
|
|
var feedPath = HostingEnvironment.MapPath("~/App_Data/Feed.xml");
|
|
if (!File.Exists(feedPath)) {
|
|
return new SyndicationFeed();
|
|
}
|
|
using (var reader = XmlReader.Create(feedPath)) {
|
|
formatter.ReadFrom(reader);
|
|
return formatter.Feed;
|
|
}
|
|
}
|
|
|
|
public void StoreFeed(SyndicationFeed feed) {
|
|
var formatter = new Atom10FeedFormatter<SyndicationFeed>(feed);
|
|
var feedPath = HostingEnvironment.MapPath("~/App_Data/Feed.xml");
|
|
using (var writer = XmlWriter.Create(feedPath)) {
|
|
formatter.WriteTo(writer);
|
|
}
|
|
}
|
|
}
|
|
} |