private List <string> DownLoadFiles() { string url = null; string fileName = null; List <string> result = new List <string>(); try { foreach (string key in downloadUrl.Keys) { Regex regex = new Regex(key + @"\.[0-9]+\.xls"); MatchCollection matches = regex.Matches(downloadUrl[key]); fileName = mFileFolder + matches[0].Value; url = @"https://contracts.deutsche-boerse.com/indexdata/" + downloadUrl[key]; DataStreamRicCreationWithFileDownload.DownLoadFiles(url, fileName, cookies); result.Add(fileName); } } catch (System.Exception ex) { listFileNameError.Add(url); Logger.Log(string.Format("error when try to download file :{0} Exception:{1}", fileName, ex.ToString())); return(result); } return(result); }
private List <string> DownLoadFiles() { string url = null; string fileName = null; List <string> result = new List <string>(); try { foreach (string key in downloadUrl.Keys) { Regex regex = new Regex(key + @"\.[0-9]+\.xls"); MatchCollection matches = regex.Matches(downloadUrl[key]); fileName = mFileFolder + matches[0].Value; url = @"https://contracts.deutsche-boerse.com/indexdata/" + downloadUrl[key]; //获取当天时间 string correctDate = DateTime.Now.ToUniversalTime().AddDays(-1).ToString("yyyyMMdd"); correctDate = key + "." + correctDate + ".xls"; if (string.Compare(correctDate, matches[0].Value) != 0) { continue; } DataStreamRicCreationWithFileDownload.DownLoadFiles(url, fileName, cookies); result.Add(fileName); } } catch (System.Exception ex) { listFileNameError.Add(url); Logger.Log(string.Format("error when try to download file :{0} Exception:{1}", fileName, ex.ToString())); return(result); } return(result); }