public ActionResult UploadInfor() { string guid = Request.Form["guid"]; Kain_class.Upload.DownloadingFileInfo info = HttpContext.Cache[guid] as Kain_class.Upload.DownloadingFileInfo; XDocument doc = new XDocument(); XElement root = new XElement("root"); if (info != null) { XElement fileName = new XElement("fileName", info.FileName); XElement upfileName = new XElement("upfileName", info.UpfileName); XElement fileFinished = new XElement("fileFinished", info.FileFinished); XElement fileSize = new XElement("fileSize", info.FileSize); XElement costTime = new XElement("costTime", info.CostTime); XElement fileState = new XElement("fileState", info.FileState); XElement speed = new XElement("speed", info.Speed); XElement percent = new XElement("percent", info.Percent); XElement abort = new XElement("abort", false); root.Add(fileName); root.Add(upfileName); root.Add(fileFinished); root.Add(fileSize); root.Add(costTime); root.Add(fileState); root.Add(speed); root.Add(percent); if (info.Abort) { abort.Value = info.Abort.ToString(); HttpContext.Cache.Remove(guid); } if (info.FileState == "finished") { HttpContext.Cache.Remove(guid); } } else { XElement none = new XElement("none", "no file"); root.Add(none); } doc.Add(root); return(Content(doc.ToString(), "application/xml", Encoding.UTF8)); }
public ActionResult UploadAbout() { string guid = Request.Form["guid"]; bool abort = string.IsNullOrEmpty(Request.Form["abort"]) ? false : true; Kain_class.Upload.DownloadingFileInfo info = HttpContext.Cache[guid] as Kain_class.Upload.DownloadingFileInfo; if (info != null) { info.Abort = abort; HttpContext.Cache[guid] = info; } XDocument doc = new XDocument(); XElement root = new XElement("root"); XElement flag = new XElement("flag", info == null ? "false" : "true"); root.Add(flag); doc.Add(root); return(Content(doc.ToString(), "application/xml", Encoding.UTF8)); }