static public IEnumerable <(string filename, string content)> ReadFromFileStreamBackwards(string fileName, Func <string, FileStream> OpenFile, long maxLines = long.MaxValue) { FileSeeker f = new FileSeeker(); using var fileStream = new FileStreamWrapper(OpenFile(fileName)); fileStream.Seek(0, SeekOrigin.End); // We want to read backwards - so start at the end for (; ;) { string line = null; try { line = f.SeekLastLineFromCurrentAndPositionOnStartOfItAndReturnReadLine(fileStream); } catch (Exception) { } if (line != null && --maxLines > 0) { yield return(Path.GetFileNameWithoutExtension(fileName), line); } else { break; } } }
public static void Main(string[] args) { Console.WriteLine("Hello World!"); //Todo: CreateConfiguration //Todo: CreateLibraryOfPictures var config = new ConfigurationLoader(new JsonSerialization()).RunAndGetModel(); IFilesSeeker iFilesSeeker = new FileSeeker(); var files = iFilesSeeker.GetFilesInPath("/home/edward/Bilder/TempTest/", new List <string>() { ".jpg" }); TestDateFiles(files); var result = GenerateFilesTest(files); //new TestClass().SecondTest(result); }
private void ReadSnapshots() { snapshotFileSeeker = new FileSeeker(this.FolderPathModel.FolderPath, this.snapshotListModel); }