[Peek]Asynchronously display correct folder size (#31504)

* asynchronously display correct folder size

* use async
This commit is contained in:
Davide Giacometti
2024-02-27 17:09:32 +01:00
committed by GitHub
parent 79de69547e
commit 1f9fd2631c
4 changed files with 105 additions and 42 deletions

View File

@@ -102,32 +102,6 @@ namespace Peek.Common.Extensions
return size;
}
public static ulong GetSizeInBytes(this IFileSystemItem item)
{
ulong sizeInBytes = 0;
try
{
switch (item)
{
case FolderItem _:
FileSystemObject fileSystemObject = new FileSystemObject();
Folder folder = fileSystemObject.GetFolder(item.Path);
sizeInBytes = (ulong)folder.Size;
break;
case FileItem _:
sizeInBytes = item.FileSizeBytes;
break;
}
}
catch
{
sizeInBytes = 0;
}
return sizeInBytes;
}
public static async Task<string> GetContentTypeAsync(this IFileSystemItem item)
{
string contentType = string.Empty;