Task downloadRelease(string updateBaseUrl, ReleaseEntry releaseEntry, IFileDownloader urlDownloader, string targetFile, Action <int> progress) { var baseUri = Utility.EnsureTrailingSlash(new Uri(updateBaseUrl)); var releaseEntryUrl = releaseEntry.BaseUrl + releaseEntry.Filename; if (!String.IsNullOrEmpty(releaseEntry.Query)) { releaseEntryUrl += releaseEntry.Query; } var sourceFileUrl = new Uri(baseUri, releaseEntryUrl).AbsoluteUri; File.Delete(targetFile); return(urlDownloader.DownloadFile(sourceFileUrl, targetFile, progress)); }