private List <string> ListFiles(InitializationItem inititem) { LogSystem.Log($"LoadFiles {DateTime.Now}"); try { var ftp = new Ftp(_path); var ftpres = ftp.ListFiles(); var myRegex = new Regex(@"^.*\.(zip)$", RegexOptions.IgnoreCase); var ret = ftpres.Where(x => myRegex.IsMatch(x)).ToList(); return(inititem.Resume ? ret.Except(inititem.FilesIngested).ToList() : ret); } catch (Exception e) { LogSystem.Log($"An fatal Error happend {DateTime.Now}"); LogSystem.Log(e.Message); } LogSystem.Log("Empty Folder"); return(new List <string>()); }
public void Process() { LogSystem.Log($"proc started {DateTime.Now}"); while (_files.Count > 0) { var itm = _files.Dequeue(); try { var ftp = new Ftp(itm.Remote); //the only reason that i download zip files on the machine is to create a simple resume & disaster recovery system and show that i am thinking of those // in my codes i will explain in the other part (Part 2) of my task what is the better solution ftp.Download(itm.Local); var tmpdir = Unzip(itm.Local); Ingest(tmpdir); } catch (Exception e) { LogSystem.Log($"proc file {itm.Local} failed at {DateTime.Now} due to {e.Message}"); } } }
public StatioManager() { ftp = new Ftp(pathtoStations); }