예제 #1
0
 /// <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();
     }
 }
예제 #2
0
        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 ')'.");
            }
        }