Coder Social home page Coder Social logo

jthun / genegenie.gedcom Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thegenegenieproject/genegenie.gedcom

0.0 0.0 0.0 2.99 MB

A .Net library for loading, saving, working with and analysing family trees stored in the GEDCOM format.

License: GNU Affero General Public License v3.0

C# 99.80% TeX 0.01% Rich Text Format 0.20%

genegenie.gedcom's Introduction

GeneGenie.Gedcom

Current working dev branch for code quality, .net 7 and improved tests.

A .Net 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.

Installation

Whilst we are below version 1.0 we won't be releasing a Nuget package is handled before then). To use the library, please download the source and star / set the repository as watched so you receive updates.

Basic usage

If you would like to see a specific sample please let us know what you want via Mastodon (@[email protected] or create an issue in GitHub.

Check the sample project out for working code, basic operations are;

Loading a tree

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}.");
}

Querying the tree

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()}'.");
}

Adding a person to the tree

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
});

Saving the tree

GedcomRecordWriter.OutputGedcom(db, "Rewritten.ged");

Build status

Build and run tests

Code quality

Bugs CodeQL Code Smells Coverage Duplicated Lines (%) Lines of Code Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities

Contributing

We would love your help, see Contributing.md for guidelines.

genegenie.gedcom's People

Contributors

ryanoneill1970 avatar dependabot-preview[bot] avatar m3lindru avatar dependabot[bot] avatar sgaulding avatar mtx500 avatar lowenthal-jason avatar joerghoffmannatgithub avatar thalter avatar jeromechrist avatar kevek avatar nrkirby avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.