protected virtual async Task CopyFileEntries([NotNull] CopyCallback callback, IProgress <AsyncProgressEntry> progress, CancellationToken cancellation)
        {
            var list = (await GetFileEntriesAsync(cancellation))?.ToList();

            if (list == null)
            {
                return;
            }

            for (var i = 0; i < list.Count; i++)
            {
                var fileInfo    = list[i];
                var destination = callback(fileInfo);
                if (destination != null)
                {
                    FileUtils.EnsureFileDirectoryExists(destination);
                    progress?.Report(Path.GetFileName(destination), i, list.Count);
                    await fileInfo.CopyToAsync(destination);

                    if (cancellation.IsCancellationRequested)
                    {
                        return;
                    }
                }
            }
        }
 public InstallationDetails([NotNull] CopyCallback copyCallback, [CanBeNull] string[] toRemoval,
                            [CanBeNull] Func <CancellationToken, Task> beforeTask, [CanBeNull] Func <CancellationToken, Task> afterTask)
 {
     CopyCallback = copyCallback;
     ToRemoval    = toRemoval ?? new string[0];
     BeforeTask   = beforeTask;
     AfterTask    = afterTask;
 }
 public async Task InstallAsync([NotNull] CopyCallback callback,
                                IProgress <AsyncProgressEntry> progress, CancellationToken cancellation)
 {
     await CopyFileEntries(callback, progress, cancellation);
 }