/// <summary> /// Loads the GEDCOM Document from a Stream /// </summary> /// <param name = "stream">The stream to load</param> public void Load(Stream stream) { using (var reader = GEDCOMReader.Create(stream)) { _records = reader.Read(); } }
public void WriteRecords(GEDCOMRecordList records, bool includeChildRecords) { foreach (GEDCOMRecord record in records) { WriteRecord(record, includeChildRecords); } }
/// <summary> /// Loads the GEDCOM Document from a String /// </summary> /// <param name = "text">The String to load</param> public void LoadGEDCOM(string text) { //Load(GEDCOMReader.Create(text)); using (var reader = GEDCOMReader.Create(text)) { _records = reader.Read(); } }
/// <summary> /// Adds a List of records to the GEDCOM Document /// </summary> /// <param name = "records">The list of records to add</param> public void AddRecords(GEDCOMRecordList records) { if (records == null) { throw new ArgumentNullException(typeof(GEDCOMRecordList).Name); } _records.AddRange(records); }
/// <summary> /// Loads the GEDCOM Document from a GEDCOMReader /// </summary> /// <param name = "reader">The GEDCOMReader to load.</param> public void Load(GEDCOMReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } //Read the GEDCOM file into a GEDCOMRecords Collection _records = reader.Read(); }
private void ClearList(GEDCOMTag tag) { switch (tag) { case GEDCOMTag.INDI: _individualRecords = null; break; case GEDCOMTag.FAM: _familyRecords = null; break; } }
public static GEDCOMRecordList CreateFamilyRecords() { var families = new GEDCOMRecordList(); var family = CreateFamilyRecord(1); families.Add(family); family = CreateFamilyRecord(2); families.Add(family); return(families); }
public static GEDCOMRecordList CreateIndividualRecords() { var individuals = new GEDCOMRecordList(); var individual = CreateIndividualRecord(1); individuals.Add(individual); individual = CreateIndividualRecord(2); individuals.Add(individual); return(individuals); }
public void GEDCOMWriter_WriterRecords_Correctly_Renders_Two_Individual_Records() { var sb = new StringBuilder(); GEDCOMWriter writer = GEDCOMWriter.Create(sb); writer.NewLine = "\n"; GEDCOMRecordList individuals = Util.CreateIndividualRecords(); //write Individuals writer.WriteRecords(individuals); //Assert GEDCOMAssert.IsValidOutput(GetEmbeddedFileString("TwoIndividuals"), sb); }
/// <summary> /// ReadRecords reads to the end of the source and return all the records /// of a sepcified Tag type /// </summary> /// <returns>A List of GEDCOMRecords.</returns> private GEDCOMRecordList ReadRecords(GEDCOMTag tag) { GEDCOMRecord record; var lines = new GEDCOMRecordList(); while ((record = ReadRecord()) != null) { if (record.TagName == tag || tag == GEDCOMTag.ANY) { lines.Add(record); } } return(lines); }
public void GEDCOMDocument_AddRecords_Add_Records_To_Individuals_Collection(int recordCount) { //Arrange var document = new GEDCOMDocument(); var records = new GEDCOMRecordList(); int count = document.Records.Count; for (int i = 1; i <= recordCount; i++) { records.Add(Util.CreateIndividualRecord(i)); } //Act document.AddRecords(records); //Assert Assert.AreEqual(count + recordCount, document.IndividualRecords.Count); }
public void WriteRecords(GEDCOMRecordList records) { WriteRecords(records, true); }
/// <summary> /// Adds a List of records to the GEDCOM Document /// </summary> /// <param name = "records">The list of records to add</param> public void AddRecords(GEDCOMRecordList records) { Requires.NotNull("records", records); _records.AddRange(records); }