public async Task GetFile(DownloadRecord downloadRecord) { try { var response = await httpClient.GetAsync(downloadRecord.Source); response.EnsureSuccessStatusCode(); using (var httpStream = await response.Content.ReadAsStreamAsync()) using (var fileStream = File.Create(downloadRecord.Destination?.AbsolutePath ?? downloadRecord.Filename)) { httpStream.CopyTo(fileStream); fileStream.Flush(); } } catch (HttpRequestException e) { Debug.WriteLine(e.Message); throw new Exception(e.Message); } }
public Task Save(DownloadRecord record) { throw new NotImplementedException(); }