Skip to content

Commit

Permalink
Feature: Display error when failing to calculate the hash of open fil…
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 authored Nov 22, 2023
1 parent bf7b5da commit 8e974c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -2340,6 +2340,9 @@
<data name="CalculationError" xml:space="preserve">
<value>An error occurred during the calculation</value>
</data>
<data name="CalculationErrorFileIsOpen" xml:space="preserve">
<value>Failed to calculate the hash, please close the file and try again.</value>
</data>
<data name="CalculationOnlineFileHashError" xml:space="preserve">
<value>Hashes aren't available for online files</value>
</data>
Expand Down
5 changes: 5 additions & 0 deletions src/Files.App/ViewModels/Properties/HashesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ private void ToggleIsEnabled(string? algorithm)
{
// not an error
}
catch (IOException)
{
// File is currently open
hashInfoItem.HashValue = "CalculationErrorFileIsOpen".GetLocalizedResource();
}
catch (Exception)
{
hashInfoItem.HashValue = "CalculationError".GetLocalizedResource();
Expand Down

0 comments on commit 8e974c7

Please sign in to comment.