Package Description
License
—
Deps
0
Install Size
—
Vulns
✓ 0
Published
Feb 9, 2024
$ dotnet add package Sandberg.Chess.TRFAgreed general Data-Exchange Format for tournament results to be submitted to FIDE
PDF: FIDE - Format of TRF (Tournament Report File)
https://tornelo.com/knowledge-base/trfx-file-format/
Parse TRF files to objects
var trfFile = "C://TrfFile.txt";
var content = File.ReadAllText(trfFile);
var tournament = Sandberg.Chess.TRF.TRFParser.Parse(content)
Create TRF file from Tournament object
var content = tournament.ToTrf();
Sandberg.Chess.TRF is using bbpPairings for pairing tournaments.
https://github.com/BieremaBoyzProgramming/bbpPairings
Create settings (TempPath is optional. Will use System.IO.Path.GetTempFileName() if not present
var settings = new Sandberg.Chess.TRF.BbpPairingsSettings
{
BbpPairingsExePath = "C:\\bbpPairings\\bbpPairings-v5.0.1\\bbpPairings.exe",
TempPath = "C:\\Temp",
PairingType = Sandberg.Chess.TRF.PairingType.Dutch // Burstein or Dutch
};
Create a tournament or parse a TRF file.
var content = File.ReadAllText(trfFile);
var tournament = Sandberg.Chess.TRF.TRFParser.Parse(content)
Create an instance of Sandberg.Chess.TRF.Pairing
(Pairing can take a few seconds..)
var pairing = new Sandberg.Chess.TRF.Pairing(settings);
pairing.OnPairingComplete += (sender, pairing) =>
{
// Your pairing is ready
// The pairing object contains alle matches for next round
};
pairing.OnPairingError += (sender, args) =>
{
// Something wrong happened..
// Most likely your TRF file is corrupt.
};
await pairing.CreatePairings(tournament, 20);
I will work on better error handling in the next version.