/// <summary> /// Receiving all orders from FTP by order list /// </summary> /// <param name="con">Connection class exemplar</param> /// <param name="list">Orders list</param> /// <param name="exceptionText">linked exception variable</param> /// <returns>Is download complee succsessfully</returns> public bool DownloadAllFiles(Ftp_Connection con, OrderList list, ref string exceptionText) { if (list.List.Count == 0) { return(true); } exceptionText = ""; WebClient request = new WebClient(); request.Credentials = new NetworkCredential(con.UserName, con.Password); for (int i = 0; i < list.List.Count; i++) { string filename = list.GetListElement(i); try { request.DownloadFile(con.FtpIn + filename, con.DwnldFlsPth + filename); } catch (Exception ex) { exceptionText = ex + "\nНе удалось записать файл " + con.FtpIn + filename + " по адресу " + con.DwnldFlsPth + filename + "!"; return(false); } } request.Dispose(); return(true); }