//============================================================ // <T>加载模块资源。</T> // // @param assembly 模块对象 // @param name 资源名称 //============================================================ public void LoadConfigResource(Assembly assembly, string name) { FXmlDocument document = new FXmlDocument(); document.LoadResource(assembly, name); LoadConfigNode(document.Root); }
//============================================================ // <T>加载类型资源。</T> // // @param type 类型对象 //============================================================ public void LoadConfigResource(Type type) { FXmlDocument document = new FXmlDocument(); document.LoadResource(type); LoadConfigNode(document.Root); }
//============================================================ // <T>保存设置文件。<T> // // @param fileName 保存路径 //============================================================ public virtual void SaveConfigFile(string fileName) { FXmlDocument document = new FXmlDocument(); SaveConfig(document.Root); document.SaveFile(fileName); }
//============================================================ // <T>加载设置文件。</T> // // @param fileName 文件名称 //============================================================ public void LoadConfigFile(string fileName) { FXmlDocument document = new FXmlDocument(); document.LoadFile(fileName); LoadConfigNode(document.Root); }
//============================================================ // <T>加载资源成为一个文档对象。</T> // // @param T 对象类型 // @param assembly 模块对象 // @param name 资源名称 // @return 文档对象 //============================================================ public T LoadResource <T>(Assembly assembly, string name) where T : IXmlObject { FXmlDocument document = new FXmlDocument(); document.LoadResource(assembly, name); return(LoadNode <T>(document.Root)); }
//============================================================ // <T>加载文件成为一个文档对象。</T> // // @param T 对象类型 // @param fileName 文件名称 // @return 文档对象 //============================================================ public T LoadFile <T>(string fileName) where T : IXmlObject { FXmlDocument document = new FXmlDocument(); document.LoadFile(fileName); return(LoadNode <T>(document.Root)); }
//============================================================ // <T>为一个文档对象加载文件。</T> // // @param top 文档对象 // @param fileName 文件名称 //============================================================ public void LoadFile(IXmlObject top, string filename) { if (_logger.DebugAble) { _logger.Debug(this, "LoadFile", "Load {0}={1}", top, filename); } FXmlDocument document = new FXmlDocument(); _context._top = top; document.LoadFile(filename); LoadNodes(top, document.Root.Nodes); }
//============================================================ // <T>保存对象为文件。</T> // // @param top 顶层对象 // @param fileName 文件名称 //============================================================ public void SaveFile(IXmlObject top, string fileName) { if (_logger.DebugAble) { _logger.Debug(this, "SaveFile", "Save {0}={1}", top, fileName); } _context._top = top; // 保存文件 FXmlDocument document = new FXmlDocument(); document.Root.Name = "Configuration"; SaveNodes(top, document.Root); document.SaveFile(fileName); }
//============================================================ // <T>构造节点工厂。</T> // // @param document 文档对象 //============================================================ public FXmlNodeFactory(FXmlDocument document) { _document = document; }