private bool DownloadingZipFiles(string filePath, string fileName, string _CheckSum)
{
try
{
if ((filePath + fileName).ToString().LastIndexOf("\\") > 0)
{
if (!Directory.Exists((filePath + fileName).ToString().Substring(0, (filePath + fileName).ToString().LastIndexOf("\\") - 1)))
{
Directory.CreateDirectory((filePath + fileName).ToString().Substring(0, (filePath + fileName).ToString().LastIndexOf("\\")));
}
}
FtpWebRequest reqFTP;
//filePath = <<The full path where the
//file is to be created. the>>,
//fileName = <<Name of the file to be createdNeed not
//name on FTP server. name name()>>
FileStream outputStream = new FileStream(filePath + "\\" + fileName, FileMode.Create, FileAccess.ReadWrite);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + _FTP_Server + "/" + fileName));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(_FTP_UserName, _FTP_Password);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
if (_CheckSum == GetCheckSum(filePath + "\\" + fileName))
return true;
else
return false;
}
catch (Exception ex)
{
return false;
}
}
try
{
if ((filePath + fileName).ToString().LastIndexOf("\\") > 0)
{
if (!Directory.Exists((filePath + fileName).ToString().Substring(0, (filePath + fileName).ToString().LastIndexOf("\\") - 1)))
{
Directory.CreateDirectory((filePath + fileName).ToString().Substring(0, (filePath + fileName).ToString().LastIndexOf("\\")));
}
}
FtpWebRequest reqFTP;
//filePath = <<The full path where the
//file is to be created. the>>,
//fileName = <<Name of the file to be createdNeed not
//name on FTP server. name name()>>
FileStream outputStream = new FileStream(filePath + "\\" + fileName, FileMode.Create, FileAccess.ReadWrite);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + _FTP_Server + "/" + fileName));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(_FTP_UserName, _FTP_Password);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
if (_CheckSum == GetCheckSum(filePath + "\\" + fileName))
return true;
else
return false;
}
catch (Exception ex)
{
return false;
}
}
2 Comments
thanks for this information. I learned a lot of interesting things about FTP download in C#. By the way, I think it will be useful for you to know how to write cursive https://wr1ter.com/how-to-write-in-cursive . And remember that whether you are going to write in cursive or block type, it will be difficult for you to get neat letters without warming up. Start with a couple of curls and after such a warm-up, neat and confident letters will begin to come out from under your hand.
ReplyDeleteThe high downloaded casino gaming apps throughout the identical period had been Island King – Coin Adventure, Coin Master, and Teen Patti Win-3 Patti Online. Craps 카지노사이트 is a fast-paced, action-packed game using a pair of dice. Once gamers place their bets, one player generally known as|often identified as} the "shooter" throws the dice.
ReplyDelete