RemoteItemMover, Startup/Exit handler refactor
This commit is contained in:
19
src/Providers/FileTime.Providers.Remote/RemoteItemMover.cs
Normal file
19
src/Providers/FileTime.Providers.Remote/RemoteItemMover.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using FileTime.Core.Models;
|
||||
using FileTime.Server.Common;
|
||||
|
||||
namespace FileTime.Providers.Remote;
|
||||
|
||||
public class RemoteItemMover : IRemoteItemMover
|
||||
{
|
||||
|
||||
private IRemoteConnection _remoteConnection = null!;
|
||||
private string _remoteContentProviderId = null!;
|
||||
public void Init(IRemoteConnection remoteConnection, string remoteContentProviderId)
|
||||
{
|
||||
_remoteConnection = remoteConnection;
|
||||
_remoteContentProviderId = remoteContentProviderId;
|
||||
}
|
||||
|
||||
public async Task RenameAsync(IRemoteContentProvider contentProvider, FullName fullName, FullName newPath)
|
||||
=> await _remoteConnection.MoveItemAsync(_remoteContentProviderId, fullName, newPath);
|
||||
}
|
||||
@@ -5,13 +5,12 @@ namespace FileTime.Providers.Remote;
|
||||
|
||||
public static class Startup
|
||||
{
|
||||
|
||||
public static IServiceCollection AddRemoteProviderServices(this IServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.TryAddSingleton<IRemoteContentProvider, RemoteContentProvider>();
|
||||
serviceCollection.TryAddTransient<IRemoteItemCreator, RemoteItemCreator>();
|
||||
serviceCollection.TryAddTransient<IRemoteItemDeleter, RemoteItemDeleter>();
|
||||
serviceCollection.TryAddTransient<IRemoteItemMover, RemoteItemMover>();
|
||||
return serviceCollection;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user