CopyCommand WIP

This commit is contained in:
2022-06-08 22:05:23 +02:00
parent 1547e84de4
commit e947282d7b
13 changed files with 338 additions and 7 deletions

View File

@@ -0,0 +1,37 @@
using FileTime.Core.Models;
using FileTime.Core.Timeline;
namespace FileTime.Core.Command.Copy;
public class CopyStrategy : ICopyStrategy
{
private readonly CopyFunc _copy;
private readonly CopyStrategyParam _copyStrategyParam;
public CopyStrategy(CopyFunc copy, CopyStrategyParam copyStrategyParam)
{
_copy = copy;
_copyStrategyParam = copyStrategyParam;
}
public async Task ContainerCopyDoneAsync(AbsolutePath containerPath)
{
foreach (var item in _copyStrategyParam.OperationProgresses.FindAll(o => o.Key.StartsWith(containerPath.Path.Path)))
{
item.SetProgress(item.TotalCount);
}
await _copyStrategyParam.RefreshContainerAsync(containerPath.Path);
}
public async Task CopyAsync(AbsolutePath from, AbsolutePath to, CopyCommandContext context)
{
await _copy(from, to, context);
context.CurrentProgress?.SetProgress(context.CurrentProgress.TotalCount);
}
public Task CreateContainerAsync(IContainer target, string name, PointInTime currentTime)
{
throw new NotImplementedException();
}
}