forked from paviad/GoSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SGFNode.cs
35 lines (33 loc) · 962 Bytes
/
SGFNode.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Go
{
/// <summary>
/// Represents an SGF node, see the SGF specification at
/// <a href="http://www.red-bean.com/sgf">http://www.red-bean.com/sgf</a>
/// </summary>
public class SGFNode
{
/// <summary>
/// Contains a list of SGF properties.
/// </summary>
public List<SGFProperty> Properties = new List<SGFProperty>();
internal void Read(TextReader sr)
{
char c = (char)sr.Read();
if (c != ';')
throw new InvalidDataException("Node doesn't begin with a ';'.");
sr.EatWS();
while (char.IsUpper((char)sr.Peek()))
{
SGFProperty prop = new SGFProperty();
prop.Read(sr);
Properties.Add(prop);
sr.EatWS();
}
}
}
}