Optimization, UI improvements, Run command
This commit is contained in:
@@ -31,6 +31,8 @@ namespace FileTime.Providers.Smb
|
||||
|
||||
public bool SupportsDirectoryLevelSoftDelete => false;
|
||||
|
||||
public bool IsDisposed => false;
|
||||
|
||||
public SmbContentProvider(IInputInterface inputInterface)
|
||||
{
|
||||
_rootContainers = new List<IContainer>();
|
||||
@@ -102,5 +104,7 @@ namespace FileTime.Providers.Smb
|
||||
|
||||
public Task Rename(string newName) => throw new NotSupportedException();
|
||||
public Task<bool> CanOpen() => Task.FromResult(true);
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ namespace FileTime.Providers.Smb
|
||||
public IContentProvider Provider { get; }
|
||||
private IContainer _parent;
|
||||
|
||||
public bool IsDisposed { get; private set; }
|
||||
|
||||
public SmbFile(string name, SmbContentProvider provider, IContainer parent)
|
||||
{
|
||||
Name = name;
|
||||
@@ -43,5 +45,9 @@ namespace FileTime.Providers.Smb
|
||||
}
|
||||
|
||||
public IContainer? GetParent() => _parent;
|
||||
public Task<string> GetContent(CancellationToken token = default) => Task.FromResult("NotImplemented");
|
||||
public Task<long> GetElementSize(CancellationToken token = default) => Task.FromResult(-1L);
|
||||
|
||||
public void Dispose() => IsDisposed = true;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ namespace FileTime.Providers.Smb
|
||||
public AsyncEventHandler Refreshed { get; } = new();
|
||||
public IReadOnlyList<Exception> Exceptions { get; } = new List<Exception>().AsReadOnly();
|
||||
|
||||
public bool IsDisposed { get; private set; }
|
||||
|
||||
public bool SupportsDirectoryLevelSoftDelete => false;
|
||||
|
||||
public SmbFolder(string name, SmbContentProvider contentProvider, SmbShare smbShare, IContainer parent)
|
||||
@@ -103,6 +105,14 @@ namespace FileTime.Providers.Smb
|
||||
_containers = containers.AsReadOnly();
|
||||
_elements = elements.AsReadOnly();
|
||||
|
||||
if (_items != null)
|
||||
{
|
||||
foreach (var item in _items)
|
||||
{
|
||||
item.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
_items = _containers.Cast<IItem>().Concat(_elements).ToList().AsReadOnly();
|
||||
await Refreshed.InvokeAsync(this, AsyncEventArgs.Empty, token);
|
||||
}
|
||||
@@ -123,5 +133,7 @@ namespace FileTime.Providers.Smb
|
||||
return _elements;
|
||||
}
|
||||
public Task<bool> CanOpen() => Task.FromResult(true);
|
||||
|
||||
public void Dispose() => IsDisposed = true;
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,8 @@ namespace FileTime.Providers.Smb
|
||||
|
||||
public bool SupportsDirectoryLevelSoftDelete => false;
|
||||
|
||||
public bool IsDisposed => false;
|
||||
|
||||
public SmbServer(string path, SmbContentProvider contentProvider, IInputInterface inputInterface)
|
||||
{
|
||||
_inputInterface = inputInterface;
|
||||
@@ -97,7 +99,7 @@ namespace FileTime.Providers.Smb
|
||||
|
||||
_shares = shares.ConvertAll(s => new SmbShare(s, Provider, this, _smbClientContext)).AsReadOnly();
|
||||
_items = _shares.Cast<IItem>().ToList().AsReadOnly();
|
||||
await Refreshed.InvokeAsync(this, AsyncEventArgs.Empty);
|
||||
await Refreshed.InvokeAsync(this, AsyncEventArgs.Empty, token);
|
||||
}
|
||||
|
||||
public Task<IContainer> Clone() => Task.FromResult((IContainer)this);
|
||||
@@ -190,5 +192,7 @@ namespace FileTime.Providers.Smb
|
||||
|
||||
public Task Rename(string newName) => throw new NotSupportedException();
|
||||
public Task<bool> CanOpen() => Task.FromResult(true);
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ namespace FileTime.Providers.Smb
|
||||
public AsyncEventHandler Refreshed { get; } = new();
|
||||
public IReadOnlyList<Exception> Exceptions { get; } = new List<Exception>().AsReadOnly();
|
||||
|
||||
public bool IsDisposed => false;
|
||||
|
||||
public bool SupportsDirectoryLevelSoftDelete => false;
|
||||
|
||||
public SmbShare(string name, SmbContentProvider contentProvider, IContainer parent, SmbClientContext smbClientContext)
|
||||
@@ -111,6 +113,14 @@ namespace FileTime.Providers.Smb
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (_items != null)
|
||||
{
|
||||
foreach (var item in _items)
|
||||
{
|
||||
item.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
_containers = containers.AsReadOnly();
|
||||
_elements = elements.AsReadOnly();
|
||||
|
||||
@@ -160,5 +170,7 @@ namespace FileTime.Providers.Smb
|
||||
|
||||
public Task Rename(string newName) => throw new NotSupportedException();
|
||||
public Task<bool> CanOpen() => Task.FromResult(true);
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user