Skip to content

Commit

Permalink
Merge pull request #31 from encrypt0r/master
Browse files Browse the repository at this point in the history
Make sure checking folder size doesn't crash the app
  • Loading branch information
mhmd-azeez authored Oct 10, 2017
2 parents be691df + 7d66793 commit fa4c20f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Permadelete.FrontEnd/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.1.0")]
[assembly: AssemblyFileVersion("0.5.1.0")]
[assembly: AssemblyVersion("0.5.2.0")]
[assembly: AssemblyFileVersion("0.5.2.0")]
15 changes: 11 additions & 4 deletions Permadelete.FrontEnd/ViewModels/OperationVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,17 @@ public string Size
#region Methods
private async void CalculateBytes()
{
if (File.Exists(Path))
_bytes = new FileInfo(Path).Length;
else if (Directory.Exists(Path))
_bytes = await ShredderService.Instance.GetFolderSize(new DirectoryInfo(Path));
try
{
if (File.Exists(Path))
_bytes = new FileInfo(Path).Length;
else if (Directory.Exists(Path))
_bytes = await ShredderService.Instance.GetFolderSize(new DirectoryInfo(Path));
}
catch (UnauthorizedAccessException)
{
_bytes = -1;
}

RaisePropertyChanged(nameof(Bytes));
RaisePropertyChanged(nameof(Size));
Expand Down

0 comments on commit fa4c20f

Please sign in to comment.