MarkItUp.SingleUserBlog/UI/DailyLinkFeedHandler.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Web;
using System.Xml;
using MarkItUp.SingleUserBlog.UI;
using MarkItUp.SingleUserBlog.Services;
using MarkItUp.SingleUserBlog.Common;
using MarkItUp.SingleUserBlog.UI.WebParts;
using System.Collections.Generic;
using System.IO;
namespace MarkItUp.SingleUserBlog.UI {
public class DailyLinksFeedHandler : IHttpHandler {
public void ProcessRequest(HttpContext context) {
context.Response.ContentType = "text/xml";
XmlTextWriter writer = new XmlTextWriter(context.Response.Output);
writer.Formatting = Formatting.Indented;
RssFeedWriter feed = new RssFeedWriter();
feed.Title = string.Format("{0} - Daily Links.", BlogConfigurationSettings.BlogTitle);
feed.Description = string.Format("Daily Links for {0}.", BlogConfigurationSettings.BlogTitle);
feed.WriteFeed(writer, GetDailyLinks());
}
private List<DailyLink> GetDailyLinks() {
string cacheKey = "DailyLinksForFeed";
List<DailyLink> links = HttpRuntime.Cache[cacheKey] as List<DailyLink>;
if (links == null) {
links = new List<DailyLink>();
try {
string filePath = Path.Combine(Globals.BlogIndexDataFolderPath, "DailyLinks.xml");
XmlDocument doc = new XmlDocument();
doc.Load(filePath);
XmlNodeList nodes = doc.DocumentElement.SelectNodes("DailyLink");
if (nodes != null && nodes.Count > 0) {
int ceiling = (nodes.Count > 9) ? 9 : nodes.Count - 1;
int i = 0;
while (i <= ceiling) {
DailyLink link = new DailyLink();
link.Fill(nodes[i]);
links.Add(link);
i++;
}
}
} catch (Exception ex) {
后面还有 17 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
