internal static RepositoryRow ReadFirst( IReadCondition <RepositoryRow> condition, string path) { RepositoryRow row = new RepositoryRow(); using (BinaryReader reader = IOBuilder.CreateBinaryReader(path)) while (reader.BaseStream.Position < reader.BaseStream.Length) { Read(ref row, reader); if (condition == null || condition.Matches(ref row)) { return(row); } } return(RepositoryRow.Empty); }
internal static List <RepositoryRow> Read( IReadCondition <RepositoryRow> condition, string path) { List <RepositoryRow> result = new List <RepositoryRow>(); RepositoryRow row = new RepositoryRow(); using (BinaryReader reader = IOBuilder.CreateBinaryReader(path)) while (reader.BaseStream.Position < reader.BaseStream.Length) { Read(ref row, reader); if (condition == null || condition.Matches(ref row)) { result.Add(row); } } return(result); }