/// <summary> /// Populate the people collection with information from the GEDCOM file. /// </summary> public bool Import(PeopleCollection peopleCollection, SourceCollection sourceCollection, RepositoryCollection repositoryCollection, string gedcomFilePath, bool disableCharacterCheck) { // Clear current content. peopleCollection.Clear(); sourceCollection.Clear(); repositoryCollection.Clear(); // First convert the GEDCOM file to an XML file so it's easier to parse, // the temp XML file is deleted when importing is complete. string xmlFilePath = Path.GetTempFileName(); bool loaded = false; // if user canceled the load try { this.people = peopleCollection; this.sources = sourceCollection; this.repositories = repositoryCollection; // Convert the GEDCOM file to a temp XML file. GedcomConverter.ConvertToXml(gedcomFilePath, xmlFilePath, true, disableCharacterCheck); doc = new XmlDocument(); doc.Load(xmlFilePath); // Get list of people. XmlNodeList list = doc.SelectNodes("/root/INDI"); // Import data from the temp XML file to the people collection. ImportPeople(list); ImportFamilies(); ImportSources(); ImportRepositories(); // The collection requires a primary-person, use the first // person added to the collection as the primary-person. if (peopleCollection.Count > 0) { peopleCollection.Current = peopleCollection[0]; } // Update IDs to match Family.Show standards UpdatePeopleIDs(); UpdateSourceIDs(); UpdateRepositoryIDs(); loaded = true; } finally { //Delete the temp XML file. File.Delete(xmlFilePath); } return(loaded); }
/// <summary> /// Removes all items from the <see cref="ICollection{T}"/>. This implementation /// clears the the source collection. /// </summary> /// /// <exception cref="NotSupportedException"> /// The <see cref="ICollection{T}"/> is read-only. /// </exception> public override void Clear() { SourceCollection.Clear(); }
public void Clear() { SourceCollection.Clear(); }