A C# GEDCOM library for loading, saving, working with and analysing family trees stored in the GEDCOM format.
Thank you to David A Knight who developed Gedcom.Net from which this project was forked.
Whilst we are below version 1.0 we won't be releasing a Nuget package (unless the .Net core / 4.5.x multi targeting issue #5 is handled before then). To use the library, please download the source and star / set the repository as watched so you receive updates.
If you would like to see a specific sample please let us know what you want via Twitter (@ryanoneill1970) or create an issue in GitHub.
Check the sample project out for working code, basic operations are;
To load a tree into memory use the following static helper.
var gedcomReader = GedcomRecordReader.CreateReader("Data\\presidents.ged");
There are other variants of this helper and non static methods that allow you to specify additional parameters such as encoding.
You'll want to make sure that the file you just read was parsed OK and handle any failures;
if (gedcomReader.Parser.ErrorState != Parser.Enums.GedcomErrorState.NoError)
{
Console.WriteLine($"Could not read file, encountered error {gedcomReader.Parser.ErrorState}.");
}
Console.WriteLine($"Found {db.Families.Count} families and {db.Individuals.Count} individuals.");
var individual = db
.Individuals
.FirstOrDefault(f => f.Names.Any());
if (individual != null)
{
Console.WriteLine($"Individual found with a preferred name of '{individual.GetName()}'.");
}
var individual = new GedcomIndividualRecord(db);
var name = individual.Names[0];
name.Given = "Michael";
name.Surname = "Mouse";
name.Nick = "Mickey";
individual.Names.Add(name);
var birthDate = new GedcomDate(db);
birthDate.ParseDateString("24 Jan 1933");
individual.Events.Add(new GedcomIndividualEvent
{
Database = db,
Date = birthDate,
EventType = Enums.GedcomEventType.Birth
});
GedcomRecordWriter.OutputGedcom(db, "Rewritten.ged");
In beta. Should be usable but we welcome bug reports, suggestions and pull requests.
We would love your help, subject to a few points. See Contributing.md for guidelines.