/// <summary> /// 添加传输文件,列表已经有的,停止原来的下载并使用新的下载任务 /// </summary> /// <param name="srcurl">文件远程静态url地址</param> /// <param name="doctype">存储本地的文件类型</param> /// <returns>成功返回true,失败返回false</returns> public static bool AddFile(string srcurl, string doctype) { if (string.IsNullOrEmpty(srcurl)) { return(true); } string XPath = "//File[@srcurl='{0}' and @doctype='{1}']"; XPath = string.Format(XPath, srcurl, doctype); XmlElement xmlElem = _xmlDocList.SelectSingleNode(XPath) as XmlElement; if (null != xmlElem) { return(true); } xmlElem = _xmlDocList.CreateElement("File"); xmlElem.SetAttribute("srcurl", srcurl); xmlElem.SetAttribute("doctype", doctype); xmlElem.SetAttribute("state", "new"); string path = DataAccRes.AppSettings(doctype); if (string.IsNullOrEmpty(path)) { path = DataAccRes.AppSettings("DefaultFilePath"); } string dest = HttpContext.Current.Server.MapPath(path + Path.GetFileName(srcurl)); xmlElem.SetAttribute("localname", dest); _xmlDocList.DocumentElement.AppendChild(xmlElem); return(true); }
/// <summary> /// 创建数据访问资源,依据资源定义 /// </summary> /// <param name="DataRes"></param> public QueryDataRes(DataAccRes DataRes) { this.DataRes=DataRes; }