Copy status, fixes

This commit is contained in:
2022-02-13 16:49:59 +01:00
parent afb72ae491
commit 7019918496
17 changed files with 207 additions and 32 deletions

View File

@@ -24,7 +24,7 @@ namespace FileTime.Providers.Local.CommandHandlers
await copyCommand.Execute(CopyElement, timeRunner);
}
public static void CopyElement(AbsolutePath sourcePath, AbsolutePath targetPath)
public static async Task CopyElement(AbsolutePath sourcePath, AbsolutePath targetPath, OperationProgress? operationProgress, CopyCommandContext copyCommandContext)
{
using var sourceStream = File.OpenRead(sourcePath.Path);
using var sourceReader = new BinaryReader(sourceStream);
@@ -40,6 +40,8 @@ namespace FileTime.Providers.Local.CommandHandlers
dataRead = sourceReader.ReadBytes(bufferSize);
targetWriter.Write(dataRead);
targetWriter.Flush();
if (operationProgress != null) operationProgress.Progress += dataRead.LongLength;
await copyCommandContext.UpdateProgress();
}
while (dataRead.Length > 0);
}