using System.IO;
using System.Xml.Linq;
namespace MECF.Framework.Common.Account.Extends
{
///
/// Xml文件加载器。
///
public abstract class XmlLoader
{
#region Variables
///
/// Xml文件名。
///
protected readonly string FileName;
///
/// Xml文件加载后的XDocument对象。
///
protected XDocument XmlDoc;
#endregion
#region Constructors
///
/// 创建Xml文件加载器示例。
///
///
protected XmlLoader(string fileName)
{
FileName = fileName;
}
#endregion
#region Methods
///
/// 加载Xml文件。
///
///
public virtual void Load()
{
if (File.Exists(FileName))
{
XmlDoc = XDocument.Load(FileName);
AnalyzeXml();
return;
}
throw new FileNotFoundException("File " + FileName + " not be found");
}
///
/// 解析Xml文件。
///
protected virtual void AnalyzeXml()
{
}
#endregion
}
}