static void UnzipCME_EODTrades(LogHelper log) { WinSCPHelper winSCP = new WinSCPHelper(); var directoryPath = new DirectoryInfo(localFolder); winSCP.UnzipFiletoFolder(directoryPath, log); }
//Collect Daily Files from different SFTP sources and Copy to centralized location in PCI static void CollectSFTPFiles(LogHelper log) { AppDAL appDAL = new AppDAL(); WinSCPHelper scp = new WinSCPHelper(); // Get the list of items to process List <SFTPFileCollection> fileCollection = appDAL.GetSFTPAppSettings(); //Get SFTP Credentials from DB // Set up session options scp.WinSCPSession(fileCollection, log, toProcessFile); }
static void DownloadCME_EODTrades(LogHelper log) { AppDAL appDAL = new AppDAL(); CME_EODTrades eodTrades = new CME_EODTrades(); log.Log("Downloading CME EOD Trade file.."); int downloaded = 0; WinSCPHelper scp = new WinSCPHelper(); // Get the list of items to process List <SFTPFileCollection> fileCollection = appDAL.GetSFTPAppSettingsByCode(sftpFileCode); //Get SFTP Credentials from DB //checked if file is already available in local folder - means already downloaded List <SFTPFileCollection> fileCollectionLeft = checkLocalFile(fileCollection, dateFilesToGet, log); if (fileCollectionLeft.Count <= 0) { log.Log("No files to be downloaded. Files might be already existing in local folder."); return; } string processTime = DateTime.Now.ToString(); Console.WriteLine("Start processing at {0}", processTime); log.Log("Starts - " + processTime); while (fileCollectionLeft.Count > 0) { // Set up session options fileCollectionLeft = scp.InitWinSCPSession(fileCollectionLeft, log, dateFilesToGet); if (fileCollectionLeft.Count > 0) { string mesg = "Still waiting for " + fileCollectionLeft.Count.ToString() + " file(s) from CME. Next file check will be at " + DateTime.Now.AddMilliseconds(300000) + " for the remaining files"; eodTrades.ExtractCME_Heartbit_Email(log, mesg); Console.WriteLine(mesg); Thread.Sleep(60000); //60 seconds Console.Clear(); } } }