public static String DownloadFile(String url, String fileNameOrDirName, object data = null, String tempFileName = null) { HttpDownload download = new HttpDownload(url, fileNameOrDirName); download.LocalfileWithSuffix = tempFileName; download.Data = data; download.DownloadFile(); return(download.LocalfileReal); }
public static DownloadReslut Download(String url, String fileNameOrDirName, object data = null) { HttpDownload download = new HttpDownload(url, fileNameOrDirName); download.Data = data; try { download.DownloadFile(); } catch (Exception e) { if (download.response != null) { using (StreamReader srReader = new StreamReader(download.response.GetResponseStream(), HttpSetting.DefaultEncoding)) return(DownloadReslut.Messages(srReader.ReadToEnd())); } else { throw new HttpDownloadException(e); } } return(DownloadReslut.File(download.LocalfileReal)); }