у меня этот вариант нормально отработал (компилировал под .net framework в win10)
Код:
![Выделить весь код](images/misc/selectcode.png)
using System;
using System.ComponentModel;
using System.IO;
using System.Net;
public class Program
{
public static void Main()
{
new Program().Download("https://github.com/deemru/Chromium-Gost/releases/download/121.0.6167.85/chromium-gost-121.0.6167.85-windows-386.zip");
}
public void Download(string remoteUri)
{
string FilePath = Directory.GetCurrentDirectory() + "/temp/" + Path.GetFileName(remoteUri);
using (WebClient client = new WebClient())
{
if (!Directory.Exists("temp"))
{
Directory.CreateDirectory("temp");
}
Uri uri = new Uri(remoteUri);
client.DownloadFileCompleted += new AsyncCompletedEventHandler(Extract);
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgessChanged);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
client.DownloadFileTaskAsync(uri, FilePath).Wait();
}
}
public void Extract(object sender, AsyncCompletedEventArgs e)
{
Console.Write("\nFile has been downloaded.\n");
}
public void ProgessChanged(object sender, DownloadProgressChangedEventArgs e)
{
Console.Write("\rDownload status: " + e.ProgressPercentage + "%.");
}
}