/// <summary> /// Parse an SGFCollection object from a TextReader. /// </summary> /// <param name="sr">The source TextReader.</param> public void Read(TextReader sr) { sr.EatWS(); while ((char)sr.Peek() == '(') { var gameTree = new SGFGameTree(); gameTree.Read(sr); GameTrees.Add(gameTree); sr.EatWS(); } }
internal void Read(TextReader sr) { var c = (char)sr.Read(); if (c != '(') { throw new InvalidDataException("Game-tree doesn't begin with a '('."); } Sequence.Read(sr); sr.EatWS(); while ((char)sr.Peek() == '(') { var gameTree = new SGFGameTree(); gameTree.Read(sr); GameTrees.Add(gameTree); sr.EatWS(); } c = (char)sr.Read(); if (c != ')') { throw new InvalidDataException("Game-tree doesn't end with a ')'."); } }