mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[Peek]Asynchronously display correct folder size (#31504)
* asynchronously display correct folder size * use async
This commit is contained in:
committed by
GitHub
parent
79de69547e
commit
1f9fd2631c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user