- Yasaklandı
- #1
Öncelikle 2 tane void eklememiz gerekiyor. Şu 2 voidi kütüphanemize ekliyoruz.
C#:
private void neos1(string string_1, string string_2)
{
this.string_0 = string_2;
if (Directory.Exists(Application.StartupPath + "\\Dosya"))
{
using (WebClient webClient = new WebClient())
{
webClient.DownloadFileCompleted += this.method_0;
webClient.DownloadFileAsync(new Uri(string_1), Application.StartupPath + "\\Dosya\\" + string_2 + ".exe");
return;
}
}
Directory.CreateDirectory(Application.StartupPath + "\\Dosya");
using (WebClient webClient2 = new WebClient())
{
webClient2.DownloadFileCompleted += this.method_0;
webClient2.DownloadFileAsync(new Uri(string_1), Application.StartupPath + "\\Dosya\\" + string_2 + ".exe");
}
}
Kod:
private void method_0(object sender, AsyncCompletedEventArgs e)
{
if (Directory.Exists(Application.StartupPath + "\\Dosya"))
{
Process.Start(Application.StartupPath + "\\Dosya\\" + this.string_0 + ".exe");
}
}
Sonra bitane button ekleyip butonun içine şu kodu giriyoruz:
C#:
method_1("Direk indirceğiniz link", "Dosya Adı");