XmlLoader.cs 751 B

12345678910111213141516171819202122232425262728293031323334
  1. using System.IO;
  2. using System.Xml.Linq;
  3. namespace MECF.Framework.Common.Account.Extends
  4. {
  5. public abstract class XmlLoader
  6. {
  7. protected string m_strPath;
  8. protected XDocument m_xdoc;
  9. protected XmlLoader(string p_strPath)
  10. {
  11. this.m_strPath = p_strPath;
  12. }
  13. protected virtual void AnalyzeXml()
  14. {
  15. }
  16. public void Load()
  17. {
  18. if (File.Exists(this.m_strPath))
  19. {
  20. this.m_xdoc = XDocument.Load(this.m_strPath);
  21. this.AnalyzeXml();
  22. }
  23. else
  24. throw new FileNotFoundException("File " + this.m_strPath + " not be found");
  25. }
  26. }
  27. }