Beispiel #1
0
        public static IDownloadingFile ToDownloadingFile(this string jsonText, Action <IDownloaderBuilder> configure, INetDiskUser owner)
        {
            var data = jsonText.ToObject <SerializedData>();

            var file    = data.File;
            var builder = FileTransferService.GetDownloaderBuilder();

            configure(builder);
            var downloader = builder.Build(data.DownloadInfo.ToString());

            return(DownloadingFile.Create(owner, file, downloader));
        }
        public override IDownloadingFile Download(INetDiskFile from, FileLocator to)
        {
            var downloader = FileTransferService
                             .GetDownloaderBuilder()
                             .UseSixCloudConfigure()
                             .Configure(localPath => localPath.GetUniqueLocalPath(path => File.Exists(path) || File.Exists($"{path}{ArddFileExtension}")))
                             .From(new RemotePathProvider(this, from.Path))
                             .To(Path.Combine(to, from.Path.FileName))
                             .Build();

            var result = DownloadingFile.Create(this, from, downloader);

            SaveDownloadingFile(result);

            return(result);
        }