public ModifyXNode ( string>.Dictionary |
||
value | string>.Dictionary | 需要修改的子节点的键值对 |
xElement | System.Xml.Linq.XElement | 所要修改的节点元素 |
xmlPath | string | xml文件的路径 |
리턴 | string |
/// <summary> /// 执行修改项目动态内容的操作(现有的,只修改不增加) /// </summary> /// <param name="value">需要修改的子节点的键值对</param> /// <param name="property">需要筛选的属性值的键值对</param> /// <param name="xmlPath">xml文件的路径</param> /// <param name="nodePath">节点的路径</param> /// <returns></returns> public string ModifyProject(Dictionary<string, string> projects, Dictionary<string, string> property, string xmlPath, string nodePath) { XmlDao xmlDao = new XmlDao(); string result = ""; XElement xElement = xmlDao.SelectOneXElement(property, xmlPath, nodePath); result = xmlDao.ModifyXNode(projects, xElement, xmlPath); return result; }
/// <summary> /// 执行保存已经修改的ConfigInfo /// </summary> /// <param name="configInfo">传入configInfo实例对象</param> /// <param name="xmlConfigPath">修改的xml文件</param> /// <returns></returns> public string SaveConfig(ConfigInfo configInfo,string xmlConfigPath) { string modifyPath = "preferences"; string result = ""; var value = new Dictionary<string, string>(); value.Add("SvnPath",configInfo.Svnpath); value.Add("UpdateInterval",configInfo.Updateinterval); value.Add("StandarOutput",configInfo.StandarOutput); value.Add("ServiceSwitch", configInfo.ServiceSwitch); try { XmlDao xmlDao = new XmlDao(); XElement xElement = xmlDao.SelectOneXElement(null, xmlConfigPath, modifyPath); result = xmlDao.ModifyXNode(value, xElement, xmlConfigPath); return result; } catch (Exception exception) { MessageBox.Show(exception.Message); result = "failed"; return result; } }