public async Task Get(Uri uri, int index) { if (!Enabled) { return; } try { var bytes = await WebClient.DownloadDataTaskAsync(uri); logger.LogInformation($"Downloaded {uri} ({bytes.Length} bytes)"); var filename = Uploads[index] + "/"; var file = new FileInfo(uri.LocalPath); using (var stream = new MemoryStream(bytes)) { var hash = await SHA1.ComputeHashAsync(stream); filename += BitConverter.ToString(hash).Replace("-", "").ToLower(); } filename += file.Extension.ToLower(); await File.WriteAllBytesAsync(filename, bytes); } catch (Exception e) { logger.LogError(e, e.Message); } }