/// <summary> /// WebClient AsyncCompleted Event Handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <see cref="https://msdn.microsoft.com/tr-tr/library/system.componentmodel.asynccompletedeventhandler"/> private void DownloadCompleted(object sender, AsyncCompletedEventArgs e) { if (File.Exists($"{Settings.CurrentDirectory}\\{Path.GetFileName(DownloadAddress)}")) { using var stream = File.OpenRead(Path.GetFileName(DownloadAddress)); using var zipArchive = new ZipArchive(stream); var zipArchiveHelpers = new ZipArchiveHelpers(); zipArchiveHelpers.ExtractToDirectory(zipArchive, Settings.CurrentDirectory, true); Directory.Move( $"{Settings.CurrentDirectory}\\{Path.GetFileNameWithoutExtension(DownloadAddress)}", $"{Settings.CurrentDirectory}\\FFmpeg" ); MessageBox.Show("İndirme ve kurulum işlemi tamamlandı.", "Başarılı", MessageBoxButton.OK, MessageBoxImage.Information); mWindow.Close(); } else { MessageBox.Show("İndirme işlemi bitti ancak dosya dulunamadı.", "Hata!", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// Processes the file. /// </summary> /// <param name="request">The request.</param> /// <returns>The HTTP content.</returns> async Task <string> IUploadService.ProcessFile(ProcessFileRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (string.IsNullOrWhiteSpace(request.FilePath)) { throw new ArgumentException(nameof(request.FilePath)); } var items = ZipArchiveHelpers.ListArchiveItems(request.FilePath); var json = NodeHelpers.ToJson(items, request.CipherKey); return(await _transferService.SendFile(new SendFileRequest { ContentType = ApplicationConstants.JsonContentType, Password = request.Password, StringContent = json, Url = request.ApiUrl, UserName = request.Username })); }