Skip to content

Code Quality: HashesViewModel and ChecksumHelpers can be improved #18212

@KrisVandermotten

Description

@KrisVandermotten

Description

In #18073 we fixed #18069.

Those same fixes should be applied to HashesViewModel.CalculateFileHashAsync and the ChecksumHelpers methods.

Additionally, in HashesViewModel.CalculateFileHashAsync, we should open and close the stream on the background thread we're using to hash it.

Concerned code

  • src\Files.App\ViewModels\Properties\HashesViewModel.cs
  • src\Files.Shared\Helpers\ChecksumHelpers.cs

Gains

  • Better readability.
  • Consistency.
  • Better performance (event though virtually unnoticeable).

Requirements

  • Use MD5.HashData method in HashesViewModel.CalculateFileHashAsync.
  • Use Convert.ToHexStringLower.

Comments

I have a PR, I'll take the liberty of sending it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    🏗 In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions