BlogEngine.Core/Providers/XmlProvider/Settings.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
#region Using
using System;
using System.Xml;
using System.IO;
using System.Globalization;
using System.Collections.Generic;
using System.Collections.Specialized;
using BlogEngine.Core;
#endregion
namespace BlogEngine.Core.Providers
{
/// <summary>
/// A storage provider for BlogEngine that uses XML files.
/// <remarks>
/// To build another provider, you can just copy and modify
/// this one. Then add it to the web.config's BlogEngine section.
/// </remarks>
/// </summary>
public partial class XmlBlogProvider : BlogProvider
{
/// <summary>
/// The storage location is to allow Blog Providers to use alternative storage locations that app_data root directory.
/// </summary>
/// <returns></returns>
public override string StorageLocation()
{
if(String.IsNullOrEmpty(System.Web.Configuration.WebConfigurationManager.AppSettings["StorageLocation"]))
return @"~/app_data/";
return System.Web.Configuration.WebConfigurationManager.AppSettings["StorageLocation"];
}
/// <summary>
/// Loads the settings from the provider.
/// </summary>
public override StringDictionary LoadSettings()
{
//string filename = System.Web.HttpContext.Current.Server.MapPath(Utils.RelativeWebRoot + "App_Data/settings.xml");
string filename = System.Web.HttpContext.Current.Server.MapPath(StorageLocation() + "settings.xml");
StringDictionary dic = new StringDictionary();
XmlDocument doc = new XmlDocument();
doc.Load(filename);
foreach (XmlNode settingsNode in doc.SelectSingleNode("settings").ChildNodes)
{
string name = settingsNode.Name;
string value = settingsNode.InnerText;
dic.Add(name, value);
}
return dic;
}
/// <summary>
/// Saves the settings to the provider.
后面还有 28 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
