Asp.net源码专业站
首页->博客空间->LiveBlog v1.0测试版源码>>LiveBlog.Core/Providers/XmlProvider/PingServices.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:LiveBlog v1.0测试版源码
当前文件:文件类型 LiveBlog/LiveBlog.Core/Providers/XmlProvider/PingServices.cs[1K,2009-6-12 11:47:02]打开代码结构图
普通视图
		            
1Using 11 12namespace LiveBlog.Core.Providers 13{ 14 /// <summary> 15 /// A storage provider for BlogEngine that uses XML files. 16 /// <remarks> 17 /// To build another provider, you can just copy and modify 18 /// this one. Then add it to the web.config's BlogEngine section. 19 /// </remarks> 20 /// </summary> 21 public partial class XmlBlogProvider : BlogProvider 22 { 23 24 /// <summary> 25 /// Loads the ping services. 26 /// </summary> 27 /// <returns></returns> 28 public override StringCollection LoadPingServices() 29 { 30 string fileName = _Folder + "pingservices.xml"; 31 if (!File.Exists(fileName)) 32 return new StringCollection(); 33 34 StringCollection col = new StringCollection(); 35 XmlDocument doc = new XmlDocument(); 36 doc.Load(fileName); 37 38 foreach (XmlNode node in doc.SelectNodes("services/service")) 39 { 40 if (!col.Contains(node.InnerText)) 41 col.Add(node.InnerText); 42 } 43 44 return col; 45 } 46 47 /// <summary> 48 /// Saves the ping services. 49 /// </summary> 50 /// <param name="services">The services.</param> 51 public override void SavePingServices(StringCollection services) 52 { 53 if (services == null) 54 throw new ArgumentNullException("services"); 55 56 string fileName = _Folder + "pingservices.xml"; 57 58 using (XmlTextWriter writer = new XmlTextWriter(fileName, System.Text.Encoding.UTF8)) 59 { 60 writer.Formatting = Formatting.Indented; 61 writer.Indentation = 4; 62 writer.WriteStartDocument(true); 63 writer.WriteStartElement("services"); 64 65 foreach (string service in services) 66 { 67 writer.WriteElementString("service", service); 68 } 69 70 writer.WriteEndElement(); 71 } 72 } 73 74 } 75} 76
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:LiveBlog v1.0测试版源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146