/// <summary> /// Returns a list of downloded datasets. /// </summary> /// <returns></returns> public DownloadHistory GetFileDownloaHistory(string url) { var downloadHistoryFilePath = ApplicationService.GetDownloadHistoryFilePath(_configFile.Name); try { using (var r = new StreamReader(downloadHistoryFilePath)) { var json = r.ReadToEnd(); var downloadHistories = JsonConvert.DeserializeObject <List <DownloadHistory> >(json); Log.Debug("Read from download history file, " + _configFile.Name + "- downloadHistory.json"); r.Close(); if (downloadHistories != null) { DownloadHistory downloadHistory = downloadHistories.FirstOrDefault(d => d.Id == url); return(downloadHistory); } return(null); } } catch (FileNotFoundException e) { Log.Error("Could not find " + _configFile.Name + "- downloadHistory.json"); return(null); } }
/// <summary> /// Returns a list of downloded datasets. /// </summary> /// <returns></returns> public DownloadHistory GetFileDownloaHistory(string url) { var downloadHistoryFilePath = applicationService.GetDownloadHistoryFilePath(); try { using (var r = new StreamReader(downloadHistoryFilePath)) { var json = r.ReadToEnd(); var downloadHistories = JsonConvert.DeserializeObject <List <DownloadHistory> >(json); r.Close(); DownloadHistory downloadHistory = downloadHistories.FirstOrDefault(d => d.Id == url); return(downloadHistory); } } catch (FileNotFoundException) { return(null); } }