private void Completed(object sender, DownloadDataCompletedEventArgs e) { DelegateStatusTextAktualisieren textAktualisieren = new DelegateStatusTextAktualisieren(AktualisiereStatus); txtStatus.Invoke(textAktualisieren, "Download abgeschlossen"); File.WriteAllBytes(Directory.GetCurrentDirectory() + "/UpdatePacket.zip", e.Result); txtStatus.Invoke(textAktualisieren, "Das Update wurde als \"UpdatePacket.zip\" gespeichert."); Updatefertig = true; }
private void bwDownload_DoWork(object sender, DoWorkEventArgs e) { DelegateStatusTextAktualisieren textAktualisieren = new DelegateStatusTextAktualisieren(AktualisiereStatus); string curDir = Directory.GetCurrentDirectory(); txtStatus.Invoke(textAktualisieren, "Prüfe auf Updates..."); System.Net.WebClient client = new System.Net.WebClient(); byte[] tmpB = client.DownloadData("http://127.0.0.1/status.txt");//Url einfügen txtStatus.Invoke(textAktualisieren, "Download wird gestartet"); string downloadlink = System.Text.Encoding.ASCII.GetString(tmpB); downloadFile(downloadlink); while (!Updatefertig) { } ZipFile zip = ZipFile.Read(curDir + "/UpdatePacket.zip"); File.Move(curDir + "/Updater.exe", curDir + "/Updater.old.exe"); zip.ExtractAll(curDir); txtStatus.Invoke(textAktualisieren, "Update abgeschlossen."); }