public string EatBracket(char closing) { char opening = Current; if (MoveNext()) { int depth = 1; while (!IsEof) { if (Current == opening) { depth++; } else if (Current == closing) { depth--; } if (depth == 0) { return(StopEating()); } Eat(); } } throw Failure.Eof(); }
public static PropertyTree FromStream(Stream stream, Encoding encoding = null) { if (stream == null) { throw new ArgumentNullException("stream"); // $NON-NLS-1 } using (var reader = PropertyTreeReader.CreateXml(stream, encoding, null)) { if (reader.Read()) { return(reader.ReadPropertyTree()); } else { throw Failure.Eof(); } } }