public static void DownloadArticle(Paper paper, string fileSavePath, CookieContainer cookie) { if (!Directory.Exists(fileSavePath)) Directory.CreateDirectory(fileSavePath); var filepath = Path.Combine(fileSavePath,paper.GetFileName()); if (File.Exists(filepath)) File.Delete(filepath); var downloadLink = $"{ArticlesUrl}downloadpdf.ashx?id={paper.Id}&save=1"; using (var client = new ExtendedWebClient { CookieContainer = cookie }) client.DownloadFile(downloadLink, filepath); }
private bool Skip(Paper paper) { var path = Path.Combine(this.Directory.FullName, paper.GetFileName()); if (File.Exists(path) && new FileInfo(path).Length != 0) return true; return false; }