Fixes
This commit is contained in:
@@ -53,6 +53,8 @@ namespace FileTime.Core.Providers
|
||||
protected void SetRootContainers(IEnumerable<IContainer> newRootContainers)
|
||||
=> RootContainers = newRootContainers.OrderBy(c => c.Name).ToList().AsReadOnly();
|
||||
|
||||
protected void ClearRootContainers() => RootContainers = new List<IContainer>().AsReadOnly();
|
||||
|
||||
public override async Task<IReadOnlyList<IContainer>?> GetContainers(CancellationToken token = default)
|
||||
{
|
||||
await InitIfNeeded();
|
||||
@@ -102,7 +104,11 @@ namespace FileTime.Core.Providers
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual Task Init() { return Task.CompletedTask; }
|
||||
protected virtual Task Init()
|
||||
{
|
||||
if (RootContainers == null) ClearRootContainers();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override Task<IEnumerable<IItem>> RefreshItems(CancellationToken token = default) { throw new NotImplementedException($"{nameof(RefreshItems)} should not be called in {nameof(ContentProviderBase<T>)}."); }
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace FileTime.Providers.Sftp
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override async Task<IEnumerable<IItem>> RefreshItems(CancellationToken token = default) => await _server.ListDirectory(FullName![(_server.FullName!.Length + 1)..]);
|
||||
public override async Task<IEnumerable<IItem>> RefreshItems(CancellationToken token = default) => await _server.ListDirectory(this, FullName![(_server.FullName!.Length + 1)..]);
|
||||
|
||||
public override Task Rename(string newName)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace FileTime.Providers.Sftp
|
||||
CanDelete = SupportsDelete.True;
|
||||
}
|
||||
|
||||
public override async Task<IEnumerable<IItem>> RefreshItems(CancellationToken token = default) => await ListDirectory("");
|
||||
public override async Task<IEnumerable<IItem>> RefreshItems(CancellationToken token = default) => await ListDirectory(this, "");
|
||||
|
||||
public override Task<IContainer> CloneAsync() => Task.FromResult((IContainer)this);
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace FileTime.Providers.Sftp
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<IItem>> ListDirectory(string path)
|
||||
public async Task<IEnumerable<IItem>> ListDirectory(IContainer parent, string path)
|
||||
{
|
||||
return await _sftpClientContext.RunWithSftpClientAsync(client =>
|
||||
{
|
||||
@@ -160,7 +160,7 @@ namespace FileTime.Providers.Sftp
|
||||
{
|
||||
if (file.IsDirectory)
|
||||
{
|
||||
var container = new SftpFolder(Provider, this, this, file.Name);
|
||||
var container = new SftpFolder(Provider, this, parent, file.Name);
|
||||
containers.Add(container);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user