(string url, string path, Action<long, long, int> onProgress)
| 175 | } |
| 176 | |
| 177 | static async Task DownloadFile(string url, string path, Action<long, long, int> onProgress) |
| 178 | { |
| 179 | using (WebClient client = new WebClient()) |
| 180 | { |
| 181 | client.Headers.Add("User-Agent", USER_AGENT); |
| 182 | client.DownloadProgressChanged += (s, e) => |
| 183 | { |
| 184 | onProgress.Invoke(e.BytesReceived, e.TotalBytesToReceive, e.ProgressPercentage); |
| 185 | }; |
| 186 | |
| 187 | await client.DownloadFileTaskAsync(new Uri(url), path); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | static void ApplyUpdate(string updateDir) |
| 192 | { |