Vergessene Commit
This commit is contained in:
@@ -117,12 +117,11 @@ namespace SanSystem
|
||||
txt_temp_aussen.Update();
|
||||
}
|
||||
|
||||
private void btn_transfer_ftp_Click(object sender, EventArgs e)
|
||||
private async void DownloadFromUV()
|
||||
{
|
||||
|
||||
Progress<double> progress = new Progress<double>(x =>
|
||||
{
|
||||
if(x < 0)
|
||||
if (x < 0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -131,37 +130,41 @@ namespace SanSystem
|
||||
ftpProgress.Value = Convert.ToInt32(x);
|
||||
}
|
||||
});
|
||||
try
|
||||
{
|
||||
|
||||
FtpClient client = new FtpClient("192.168.1.2");
|
||||
client.Credentials = new System.Net.NetworkCredential("damian", "bodde05");
|
||||
client.Connect();
|
||||
//client.ListingParser = FtpParser.UnixAlt;
|
||||
|
||||
ListFiles(client, "/");
|
||||
|
||||
foreach (string file in filenames)
|
||||
{
|
||||
string[] _tdateiname = file.Split('/');
|
||||
string dateiname = _tdateiname[_tdateiname.Length - 1];
|
||||
string ordner = _tdateiname[_tdateiname.Length - 2];
|
||||
|
||||
await client.DownloadFileAsync(Path.Combine(destinationPath, ordner, dateiname), file, true, FluentFTP.FtpVerify.None, progress);
|
||||
client.DeleteFile(file);
|
||||
|
||||
}
|
||||
}
|
||||
catch (TimeoutException ex)
|
||||
{
|
||||
MessageBox.Show("Die anlage reagiert nicht!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btn_transfer_ftp_Click(object sender, EventArgs e)
|
||||
{
|
||||
filenames.Clear();
|
||||
if (MessageBox.Show("Bitte stellen Sie sicher, dass der Server antwortet und dass nur die Dateien vorhanden sind!", "WARNUNG", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.OK)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
FtpClient client = new FtpClient("192.168.1.2");
|
||||
client.Credentials = new System.Net.NetworkCredential("damian", "bodde05");
|
||||
client.Connect();
|
||||
//client.ListingParser = FtpParser.UnixAlt;
|
||||
|
||||
ListFiles(client, "/");
|
||||
|
||||
foreach (string file in filenames)
|
||||
{
|
||||
string[] _tdateiname = file.Split('/');
|
||||
string dateiname = _tdateiname[_tdateiname.Length - 1];
|
||||
string ordner = _tdateiname[_tdateiname.Length - 2];
|
||||
|
||||
client.DownloadFile(Path.Combine(destinationPath, ordner, dateiname), file, true, FluentFTP.FtpVerify.None, progress);
|
||||
client.DeleteFile(file);
|
||||
|
||||
}
|
||||
}
|
||||
catch(TimeoutException ex)
|
||||
{
|
||||
MessageBox.Show("Die anlage reagiert nicht!");
|
||||
}
|
||||
DownloadFromUV();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ListFiles(FtpClient client, string directory)
|
||||
|
||||
Reference in New Issue
Block a user