private void DownloadAndParse() { clear_all_data(); List <string> files = ftp.get_last_files(ftp.file_list(options), ftp.get_files_list(options), options); List <ftp.ftp_download> file_status = ftp.download_files(files, options); List <string> parsed_files = new List <string>(); foreach (ftp.ftp_download downloaded in file_status) { if (downloaded.transfer_succ) { ToConsole(downloaded.filename + " файл успешно загружен"); string fullpath = System.IO.Directory.GetCurrentDirectory() + "\\archive\\" + downloaded.filename; xml_parse(fullpath); parsed_files.Add(downloaded.filename); } } FoundNotConnected(); ftp.delete_processed(parsed_files); //Debugger.Break(); ftp.archivate_parsed(parsed_files, options); ToConsole("Сформировано данных по " + ToSend.Count() + " счетчикам"); if (!test_mode) { if (ToSend.Count > 0) { if (SendToVodokanal()) { ToConsole("Данные успешно отправлены по " + ToSend.Count + " счетчикам"); } } } }
private void button1_Click(object sender, EventArgs e) { uncheck_all(); ftp.ftp_options connection_options = new ftp.ftp_options(); connection_options.login = ftplogin_textBox.Text; connection_options.password = ftppassword_textBox.Text; connection_options.host = host_textBox.Text; connection_options.path = folder_textBox.Text; ftp connection = new ftp(); var connection_status = connection.check_connection(connection_options); if (connection_status.no_error) { pictureBox1.ImageLocation = path + "\\img\\check.png"; pictureBox2.ImageLocation = path + "\\img\\check.png"; pictureBox3.ImageLocation = path + "\\img\\check.png"; } else { switch (connection_status.error_status) { case 2: pictureBox1.ImageLocation = path + "\\img\\check.png"; break; case 3: pictureBox1.ImageLocation = path + "\\img\\check.png"; pictureBox2.ImageLocation = path + "\\img\\check.png"; break; } } if (connection_status.no_error) { var list = connection.file_list(connection_options); if (list.Count > 0) { files_listBox.DataSource = list; pictureBox4.ImageLocation = path + "\\img\\check.png"; } } }