bool IsDone(string filePath, out MyFile file, Log log = null) { filePath = Path.GetFullPath(filePath); file = null; if (File.Exists(filePath)) { file = new MyFile(filePath); foreach (var f in filesDone) { if (f.FullName == file.FullName && f.CreateDate == file.CreateDate) { return(true); } } return(false); } if (log != null) { log.Add($"Файл не найден: {filePath}"); } return(true); }
public void CheckDoneFiles(string fileNamesPath) { if (File.Exists(fileNamesPath)) { foreach (var line in File.ReadAllLines(fileNamesPath)) { try { MyFile file = MyFile.GetFromJson(line); if ((DateTime.Today - file.CreateDate).TotalDays > 10) { continue; } filesDone.Add(file); } catch (Exception ex) { Console.WriteLine(); Console.WriteLine($"Error!!! {ex.Message}"); Console.WriteLine(); } } } }
public void Add(MyFile myFile) { Add(filesDone, myFile.GetJson()); }