I have next problem: I created downloader, which downloads xml documents, but in one the document has problem, in the document not end tag. For example:
<?xml version="1.0"?>
<rows xmlns:fo="http://www.w3.org/1999/XSL/Format">
<row StateID="AK">
I have next code:
public void SaveFiles(SftpClient sftp, string DirectoryName, string PathToFile)
{
foreach (Renci.SshNet.Sftp.SftpFile ftpfile in sftp.ListDirectory("." + DirectoryName))
{
DateTime downloadTime = ftpfile.LastWriteTime;
string newFileName = ftpfile.Name;
bool checkFile = check(PathToFile, newFileName, downloadTime);
if (checkFile == true)
{
FileStream fs = new FileStream(PathToFile + "" + ftpfile.Name, FileMode.Create);
sftp.DownloadFile(ftpfile.FullName, fs);
fs.Close();
File.SetLastWriteTime(PathToFile + "" + ftpfile.Name, downloadTime);
}
else
{
continue;
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…