private async void ImportChecksumFile(string path) { _selectedChecksumFile = new FileInfo(path); BtChecksumChooseFile.IsEnabled = false; BtChecksumChooseFile.AllowDrop = false; BtChecksumExport.IsEnabled = false; TbChecksumMd5.Clear(); TbChecksumSha1.Clear(); TbChecksumSha256.Clear(); TbChecksumSha384.Clear(); TbChecksumSha512.Clear(); BtCopyMd5.IsEnabled = false; BtCopySha1.IsEnabled = false; BtCopySha256.IsEnabled = false; BtCopySha384.IsEnabled = false; BtCopySha512.IsEnabled = false; var length = _selectedChecksumFile.Length; double adaptedLength; string unit; if (length < 1024) { adaptedLength = length; unit = "B"; } else if (length < 1048576) { adaptedLength = length / 1024d; unit = "KiB"; } else if (length < 1073741824) { adaptedLength = length / 1048576d; unit = "MiB"; } else { adaptedLength = length / 1073741824d; unit = "GiB"; } adaptedLength = Math.Round(adaptedLength, 2); _lengthInMiB = Math.Round(length / 1048576d, 2).ToString(CultureInfo.InvariantCulture); TblChecksumSelectedFile.Text = $"{Path.GetFileName(_selectedChecksumFile.FullName)} ({adaptedLength} {unit})"; ImgChecksumSelectedFile.Source = Util.GetIconByFilename(_selectedChecksumFile.FullName).ToImageSource(); await Task.WhenAll( Task.Run(async() => await Checksum.CalculateHash(_selectedChecksumFile.FullName, TbChecksumMd5, PrMd5, BtCopyMd5, HashAlgorithm.Md5)), Task.Run(async() => await Checksum.CalculateHash(_selectedChecksumFile.FullName, TbChecksumSha1, PrSha1, BtCopySha1, HashAlgorithm.Sha1)), Task.Run(async() => await Checksum.CalculateHash(_selectedChecksumFile.FullName, TbChecksumSha256, PrSha256, BtCopySha256, HashAlgorithm.Sha256)), Task.Run(async() => await Checksum.CalculateHash(_selectedChecksumFile.FullName, TbChecksumSha384, PrSha384, BtCopySha384, HashAlgorithm.Sha384)), Task.Run(async() => await Checksum.CalculateHash(_selectedChecksumFile.FullName, TbChecksumSha512, PrSha512, BtCopySha512, HashAlgorithm.Sha512))); BtChecksumChooseFile.IsEnabled = true; BtChecksumChooseFile.AllowDrop = true; BtChecksumExport.IsEnabled = true; }