private bool ReadValidation(DumpReader reader, IReadOnlyList <TreeDump> trees) { reader.FindContent(); bool validation = false; reader.StartPeeking(); if (reader.ReadWord() == "//") { if (reader.FindReadLineWord().StartsWith("==", StringComparison.InvariantCulture)) { validation = true; } } reader.FinishPeeking(); if (validation) { reader.ValidateWord("//"); reader.FindReadLineWord(); reader.FindValidateEOL(); reader.FindNextLine(); reader.ValidateWord("//"); reader.FindValidateLineWord("Successfully"); reader.FindValidateLineWord("finished"); reader.FindValidateLineWord("."); reader.FindValidateLineWord("Written"); int written = reader.FindReadLineInt(); reader.FindValidateLineWord("of"); int count = reader.FindReadLineInt(); reader.FindValidateEOL(); if (trees.Count != count) { throw new Exception($"Class count mismatch. Read {trees.Count} expected {count}"); } int validCount = trees.Count(t => t.IsValid); if (validCount != written) { throw new Exception($"Valid class count mismatch. Read {validCount} expected {written}"); } return(true); } else { return(false); } }