public string downloadTable(ClientWebRequest request) { if(request.QueryString.ContainsKey("action")) { if(request.QueryString["action"] == "pause") { Download.downloads[Convert.ToInt32(request.QueryString["inst"])].Pause(); } if(request.QueryString["action"] == "resume") { Download.downloads[Convert.ToInt32(request.QueryString["inst"])].Resume(); } if(request.QueryString["action"] == "abort") { Download.downloads[Convert.ToInt32(request.QueryString["inst"])].Abort(); } return ""; } if(request.QueryString.ContainsKey("downloadFile")) { Stream fstr = File.Open(request.QueryString["downloadFile"],FileMode.Open,FileAccess.Read,FileShare.ReadWrite); ClientHttpResponse response = new ClientHttpResponse(); response.StatusCode = "200 OK"; response.ContentType = ConfigManager.getMimeType(request.QueryString["downloadFile"]); response.len = fstr.Length; response.AddHeader("Content-Disposition: attachment; filename=\""+Path.GetFileName(request.QueryString["downloadFile"])+"\""); response.WriteHeader(request.stream); request.ContinueProcessing = false; try { Download mload = new Download(request.QueryString["downloadFile"],fstr,request.stream,fstr.Length); mload.Begin(); }catch(Exception er) { } return ""; } try { statusUpdateEvent.WaitOne(5000); statusUpdateEvent.Reset(); }catch(Exception) { } StringBuilder mbuilder = new StringBuilder(); mbuilder.AppendLine("<table border=\"1\" inst_id=\"maintable\">"); mbuilder.AppendLine("<tr><td><b><u>Connection name</u></b></td><td><b><u>Progress</u></b></td><td><b><u>Status</u></b></td></tr>"); try { int i = 0; lock(Download.downloads) { foreach(Download et in Download.downloads) { string progress = "<div style=\"width:"+((int)(((float)et._progress/(float)et._size)*100f)).ToString()+"%;background-color:Green;\">PROGRESS</div>"; string actions = ""; if(et.paused) { actions = "PAUSED"; }else { actions = "IN PROGRESS"; } if(et.haserror) { actions = "ERROR"; } mbuilder.AppendLine("<tr dlID=\""+i.ToString()+"\"><td>"+et.name+"</td><td style=\"background-color:Red;\">"+progress+"</td><td inst_id=\"status\">"+actions+"</td></tr>"); i++; } mbuilder.AppendLine("</table>"); } }catch(Exception) { } return mbuilder.ToString(); }