/// <summary> /// 增加插配置文件 /// </summary> /// <param name="fileName">文件名称</param> /// <param name="urlAddress">文件所在的URL地址</param> /// <param name="lastver">文件的最新版本</param> /// <param name="size">文件大小(以KB为单位)</param> /// <param name="needReset">是否需要重启应用程序</param> public void AddUpdaterConfig(string fileName, string urlAddress, string lastver, long size, bool needReset) { if (!FileHelper.Exists(ConfigFile)) { XMLHelper.CreateXmlDocument(ConfigFile, "updateFiels", "1.0", "utf-8", null); } XMLHelper.Insert(ConfigFile, "/updateFiels", "file", "path", fileName); XMLHelper.CreateOrUpdateXmlAttributeByXPath(ConfigFile, "/updateFiels/file[@path='" + fileName + "']", "url", urlAddress); XMLHelper.CreateOrUpdateXmlAttributeByXPath(ConfigFile, "/updateFiels/file[@path='" + fileName + "']", "lastver", lastver); XMLHelper.CreateOrUpdateXmlAttributeByXPath(ConfigFile, "/updateFiels/file[@path='" + fileName + "']", "size", size.ToString()); XMLHelper.CreateOrUpdateXmlAttributeByXPath(ConfigFile, "/updateFiels/file[@path='" + fileName + "']", "needRestart", needReset.ToString()); }
/// <summary> /// 恢复待办 /// </summary> /// <param name="addTime"></param> /// <returns></returns> public static bool Restore(DateTime addTime) { try { var xmlPath = "/Todos/Todo[AddTime='" + addTime.ToString(TIME_TEMP) + "']"; var xmlAttributeName = "Done"; var xmlAttributeValue = "0"; return(XMLHelper.CreateOrUpdateXmlAttributeByXPath(treePath, xmlPath, xmlAttributeName, xmlAttributeValue)); } catch (Exception ex) { return(false); } }
/// <summary> /// 完成待办 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Complete(DateTime addTime) { try { var xmlPath = "/Todos/Todo[@Done=0][AddTime='" + addTime.ToString(TIME_TEMP) + "']"; var xmlAttributeName = "Done"; var xmlAttributeValue = "1"; if (XMLHelper.CreateOrUpdateXmlAttributeByXPath(treePath, xmlPath, xmlAttributeName, xmlAttributeValue)) { xmlPath = "/Todos/Todo[AddTime='" + addTime.ToString(TIME_TEMP) + "']"; var xmlNodeName = "CompleteTime"; var xmlNodeValue = DateTime.Now.ToString(TIME_TEMP); return(XMLHelper.CreateOrUpdateXmlNodeByXPath(treePath, xmlPath, xmlNodeName, xmlNodeValue)); } } catch (Exception ex) { return(false); } return(false); }