forked from paviad/GoSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SGFCollection.cs
36 lines (34 loc) · 994 Bytes
/
SGFCollection.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Go
{
/// <summary>
/// Represents an SGF collection, see the SGF specification at
/// <a href="http://www.red-bean.com/sgf">http://www.red-bean.com/sgf</a>
/// </summary>
public class SGFCollection
{
/// <summary>
/// Contains a list of SGF game-tree objects.
/// </summary>
public List<SGFGameTree> GameTrees = new List<SGFGameTree>();
/// <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();
}
}
}
}