예제 #1
0
        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);
            }
        }
예제 #2
0
 public Task Save(DownloadRecord record)
 {
     throw new NotImplementedException();
 }