FtpWebRequest reqftp = (ftpwebrequest) ftpwebrequest.create (new Uri (URL));
Reqftp.credentials = new NetworkCredential ("name", "pwd");
Reqftp.timeout = 10000;
Reqftp.method = WebRequestMethods.Ftp.UploadFile;
Reqftp.method = WebRequestMethods.Ftp.ListDirectoryDetails;
using (ftpwebresponse response = (ftpwebresponse) reqftp.getresponse ())
{
var st = Response. GetResponseStream ();
StreamReader sr = new StreamReader (ST);
String line = "";
list<string> fileList = new list<string> ();
Do
{
Try
{
line = Sr. ReadLine ();
if (line. Contains ("Xdfnews.dtd"))
{
Continue
}
var Subay = line. Split (new char[] {"}, stringsplitoptions.removeemptyentries);
String tt = string. Format ("{0} {1} {2}", Subay[5], subay[6], subay[7]);
DateTime dt = DateTime.Parse (TT);
TimeSpan ts = DATETIME.NOW-DT;
if (Math.Abs (TS. Totaldays) > 7)
{
Continue
}
String fileName = line = line. Remove (0, line. LastIndexOf (") + 1);
FileName = Filename.remove (Filename.indexof ('. '));
string[] split = Filename.split ('-');
int num = 1;
if (split. Count () > 1)
{
num = Int. Parse (split[1]);
}
if (DIC. ContainsKey (Split[0]))
{
FileName = Path.getfilename (dic[split[0]);
FileName = Filename.remove (Filename.indexof ('. '));
string[] Sourfile = Filename.split ('-');
int dest = Convert.ToInt32 (split[1]);
int Source = Convert.ToInt32 (sourfile[1]);
if (dest > Source)
{
DIC[SPLIT[0]] = line;
}
}
Else
{
Dic. ADD (Split[0], line);
}
}
catch (Exception ex)
{
Hklog.graberror ("" + Ex. ToString ());
}
} while (!string. IsNullOrEmpty (line))
}
FTP upload Download