void Download(string patchFile, ITransferStatus status, IAbsoluteFilePath filePath) { using ( var scoreMirrorSelector = _createMirrorSelectorWithLimit(10, GetMirrors().Select(x => new Uri(x + "/" + CdnPath)).ToArray())) using (var multiMirrorFileDownloader = _createMultiMirrorFileDownloader(scoreMirrorSelector.Value)) { multiMirrorFileDownloader.Value.Download(new MultiMirrorFileDownloadSpec(patchFile, filePath) { Progress = status }); } }
async Task DownloadFileAsync(string remoteFile, IAbsoluteFilePath destinationPath, IMirrorSelector scoreMirrorSelector, CancellationToken token, Func <IAbsoluteFilePath, bool> confirmValidity, ITransferStatus status) { destinationPath.MakeSureParentPathExists(); using (var dl = _createMultiMirrorFileDownloader(scoreMirrorSelector)) { await dl.Value.DownloadAsync(new MultiMirrorFileDownloadSpec(remoteFile, destinationPath, confirmValidity) { CancellationToken = token, Progress = status }, token).ConfigureAwait(false); } }
void DownloadAndInstallCommunityPatchInternal(string patchFile, IAbsoluteDirectoryPath destinationPath, ITransferStatus status, IAbsoluteDirectoryPath gamePath) { var filePath = destinationPath.GetChildFileWithName(patchFile); Download(patchFile, status, filePath); status.Reset(); var gameFilePath = gamePath.GetChildFileWithName(filePath.FileName); Tools.Compression.Unpack(filePath, gamePath, true, true, true); try { InstallPatch(gameFilePath, "-silent -incurrentfolder"); } finally { gameFilePath.FileInfo.Delete(); } }
void InstallOfficialPatchInternal(string patchFile, IAbsoluteDirectoryPath tempPath, ITransferStatus status) { var filePath = tempPath.GetChildFileWithName(patchFile); Download(patchFile, status, filePath); status.Reset(); InstallPatch(filePath, "-silent"); }
public Task DownloadFileAsync(string remoteFile, IAbsoluteFilePath destinationPath, IMirrorSelector selector, ITransferStatus status, CancellationToken token) => DownloadFileAsync(remoteFile, destinationPath, selector, token, x => true, status);
async Task DownloadFileAsync(string remoteFile, IAbsoluteFilePath destinationPath, IMirrorSelector scoreMirrorSelector, CancellationToken token, Func<IAbsoluteFilePath, bool> confirmValidity, ITransferStatus status) { destinationPath.MakeSureParentPathExists(); using (var dl = _createMultiMirrorFileDownloader(scoreMirrorSelector)) { await dl.Value.DownloadAsync(new MultiMirrorFileDownloadSpec(remoteFile, destinationPath, confirmValidity) { CancellationToken = token, Progress = status }, token).ConfigureAwait(false); } }
public StatusWrapper2(ITransferStatus wrapped, Action <double, long?> act) : base(wrapped, act) { _wrapped = wrapped; }