Portable Game Notation (PGN) implementation in .NET
Read more about PGN on Wikipedia.
Here is an excellent spec document.
pgn.NET is a library which can be used to handle chess games and read/write them in the PGN format. It is implemented in F# and C# and uses FParsec.
To support as many .pgn file formats as possible the parsers try to be as tolerant as possible. It mostly conforms to this specs. However, other than the specification says we use UTF-8 as encoding, cause it's the 21st century.
using ilf.pgn;
using ilf.pgn.Data;
// ...
//READ FILE
var reader = new PgnReader();
var gameDb = reader.ReadFromFile("Tarrasch.pgn");
Game game = gameDb.Games[0];
Console.WriteLine(game);
You can download the NuGet Package or just clone, build and reference the assemblies.
PM> Install-Package pgn.NET
Choose your project and open the NuGet Package Manager:
Search for "pgn.net" in the online directory, then click "Install" on the pgn.net package:
The project should now reference the pgn.NET assembly
This is the initial release of pgn.NET, a library to parse PGN chess databases which includes