/// <summary> /// Сохранить/узнать информацию о файле /// </summary> /// <param name="ChechInfo"></param> private void Save(bool ChechInfo = false) { WebClient webClient = WebReq.Request(); using ( webClient ) { if (ChechInfo == false) { webClient.DownloadStringTaskAsync(new Uri(LinkSoft)); } else { webClient.DownloadFileAsync(new Uri(LinkSoft), LinkSoft.Split('/').Last()); } webClient.DownloadProgressChanged += (o, args) => { if (ChechInfo == false) { label8.Text = (WebReq.BytesToString(args.BytesReceived)); progressBar1.Maximum = (int)args.BytesReceived; } else { progressBar1.Value = (int)args.BytesReceived; } }; webClient.DownloadFileCompleted += (o, args) => { if (ChechInfo) { MessageBox.Show("Нажмите OK для обновления приложения.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information); DownOk(); } }; } }
/// <summary> /// Проверяем версию программы на сайте /// </summary> /// <param name="Link"></param> /// <returns></returns> private static async Task <string> CheckUpdate(string Link) { var requestByte = await WebReq.Request().DownloadStringTaskAsync(new Uri(Link)); return(requestByte); }
/// <summary> /// Получить лог /// </summary> /// <param name="LinkLog">Ссылка на лог</param> /// <returns></returns> private async Task <string> GetLog(string LinkLog) { var requestByte = await WebReq.Request().DownloadStringTaskAsync(new Uri(LinkLog)); return(requestByte); }