private void OpenSite(string[] data) { string saveFile = "OpenSite_" + data[2]; using (WebClient client = new WebClient()) // WebClient class inherits IDisposable { client.DownloadFile(data[1], saveFile); } _service.UploadFile(data[2], saveFile, GetContetTypeForCommand(data[0])); }
private async void OnFileCreated(object sender, FileSystemEventArgs e) { _logger.LogDebug($"File created. {e}"); var uploaded = await _driveService.UploadFile(e.FullPath); if (uploaded.Id != null) { if (File.Exists(e.FullPath)) { File.Delete(e.FullPath); } } }