예제 #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;
     }
 }