Volume size info for sub content providers

This commit is contained in:
2023-09-05 23:12:20 +02:00
parent b998dc5b33
commit ba0b55c733
20 changed files with 92 additions and 41 deletions

View File

@@ -66,14 +66,14 @@ public sealed partial class LocalContentProvider : ContentProviderBase, ILocalCo
return rootDrive is not null;
}
public override VolumeSizeInfo? GetVolumeSizeInfo(FullName path)
public override ValueTask<VolumeSizeInfo?> GetVolumeSizeInfoAsync(FullName path)
{
var rootDriveInfos = _rootDriveInfos.Value;
var rootDriveInfo = rootDriveInfos.FirstOrDefault(d => path.Path.StartsWith(d.Path.Path));
if (rootDriveInfo is null) return null;
if (rootDriveInfo is null) return ValueTask.FromResult<VolumeSizeInfo?>(null);
return new VolumeSizeInfo(rootDriveInfo.Size, rootDriveInfo.Free);
return ValueTask.FromResult<VolumeSizeInfo?>(new VolumeSizeInfo(rootDriveInfo.Size, rootDriveInfo.Free));
}
public override async Task<IItem> GetItemByNativePathAsync(NativePath nativePath,

View File

@@ -103,7 +103,7 @@ public sealed class RemoteContentProvider : ContentProviderBase, IRemoteContentP
public override Task<byte[]?> GetContentAsync(IElement element, int? maxLength = null, CancellationToken cancellationToken = default) => throw new NotImplementedException();
public override Task<bool> CanHandlePathAsync(NativePath path) => throw new NotImplementedException();
public override VolumeSizeInfo? GetVolumeSizeInfo(FullName path) => throw new NotImplementedException();
public override ValueTask<VolumeSizeInfo?> GetVolumeSizeInfoAsync(FullName path) => throw new NotImplementedException();
public override ValueTask<NativePath?> GetSupportedPathPart(NativePath nativePath) => throw new NotImplementedException();
private string ConvertLocalFullNameToRemote(FullName fullName)