コード例 #1
0
        /// <summary>
        /// Create an SGFCollection object from a stream.
        /// </summary>
        public static SGFCollection Create(Stream stream)
        {
            var sgf = new SGFCollection();

            using (var tr = new StreamReader(stream, Encoding.UTF8)) {
                sgf.Read(tr);
            }
            return(sgf);
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: serd/GoSharp
 /// <summary>
 /// Parses an SGF game file and creates a list of games.
 /// </summary>
 /// <param name="path">The path to the SGF file.</param>
 /// <returns>A List&lt;Game&gt; containing all game trees in the SGF file.</returns>
 public static List <Game> SerializeFromSGF(string path)
 {
     using (StreamReader sr = new StreamReader(path, ASCIIEncoding.ASCII))
     {
         SGFCollection coll = new SGFCollection();
         coll.Read(sr);
         List <Game> games = new List <Game>();
         foreach (var c in coll.GameTrees)
         {
             games.Add(new Game(c));
         }
         return(games);
     }
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: nerai/GoSharp
 /// <summary>
 /// Parses an SGF game file and creates a list of games.
 /// </summary>
 /// <param name="path">The path to the SGF file.</param>
 /// <returns>A List&lt;Game&gt; containing all game trees in the SGF file.</returns>
 public static List<Game> SerializeFromSGF(string path)
 {
     using (StreamReader sr = new StreamReader(path, ASCIIEncoding.ASCII))
     {
         SGFCollection coll = new SGFCollection();
         coll.Read(sr);
         List<Game> games = new List<Game>();
         foreach (var c in coll.GameTrees) games.Add(new Game(c));
         return games;
     }
 }