public IndiRecord GetMom(FamRecord fam) { if (fam.Moms.Count < 1) { return(null); } return(_allRecsDict[fam.Moms[0]] as IndiRecord); }
public FamilyUnit(FamRecord fam) { FamRec = fam; Husband = null; Wife = null; Childs = new List <IndiWrap>(); DadFam = null; MomFam = null; }
private static void WriteOneFam(StreamWriter file, FamRecord famRecord) { file.WriteLine("0 @{0}@ FAM", famRecord.Ident); WriteCommon.writeIfNotEmpty(file, "RESN", famRecord.Restriction, 1); // TODO multiple HUSB/WIFE? if (famRecord.Dads.Count > 0) { file.WriteLine("1 HUSB @{0}@", famRecord.Dads[0]); } if (famRecord.Moms.Count > 0) { file.WriteLine("1 WIFE @{0}@", famRecord.Moms[0]); } foreach (var child in famRecord.Childs) { file.WriteLine("1 CHIL @{0}@", child.Xref); if (!string.IsNullOrEmpty(child.FatherRelation)) { file.WriteLine("2 _FREL {0}", child.FatherRelation); } if (!string.IsNullOrEmpty(child.MotherRelation)) { file.WriteLine("2 _MREL {0}", child.MotherRelation); } } if (famRecord.ChildCount > 0) { file.WriteLine("1 NCHI {0}", famRecord.ChildCount); } WriteEvent.writeEvents(file, famRecord.FamEvents, 1); // TODO LDS Spouse Sealing // TODO why are INDI and FAM submitters treated different? foreach (var submitter in famRecord.FamSubm) { file.WriteLine("1 SUBM @{0}@", submitter); } WriteCommon.writeRecordTrailer(file, famRecord, 1); }
private void ScanIt(Forest f) { dataSet = new List <One>(); foreach (var person in f.AllPeople) { IndiRecord ged = person.Indi; foreach (var familyEvent in ged.Events) { string tag = familyEvent.Tag; if (!string.IsNullOrEmpty(familyEvent.Place)) { dataSet.Add(new One { Location = familyEvent.Place, Tag = tag, PersonId = ged.Ident, Indi = person }); } } foreach (var familyEvent in ged.Attribs) { string tag = familyEvent.Tag; if (!string.IsNullOrEmpty(familyEvent.Place)) { dataSet.Add(new One { Location = familyEvent.Place, Tag = tag, PersonId = ged.Ident, Indi = person }); } } } foreach (var union in f.AllUnions) { FamRecord fam = union.FamRec; foreach (var familyEvent in fam.FamEvents) { string tag = familyEvent.Tag; if (!string.IsNullOrEmpty(familyEvent.Place)) { dataSet.Add(new One { Location = familyEvent.Place, Tag = tag, FamId = fam.Ident, Fam = union }); } } } }
public void MultiUID() { IndiRecord recI = TestIndiMultiId("UID"); Assert.IsNotNull(recI.UID); Assert.AreEqual("number", recI.UID); recI = TestIndiMultiId("_UID"); Assert.IsNotNull(recI.UID); Assert.AreEqual("number", recI.UID); FamRecord recF = TestFamMultiId("UID"); Assert.IsNotNull(recF.UID); Assert.AreEqual("number", recF.UID); recF = TestFamMultiId("_UID"); Assert.IsNotNull(recF.UID); Assert.AreEqual("number", recF.UID); TestFamMultiId("_UID"); }
private static void dumpDates(Forest f) { int [] counts = new int[6]; //bool hasWFTEst = false; foreach (var person in f.AllPeople) { IndiRecord ged = person.Indi; foreach (var familyEvent in ged.Events) { var state = dumpDate(familyEvent); IncrCount(state, counts); } foreach (var familyEvent in ged.Attribs) { var state = dumpDate(familyEvent); IncrCount(state, counts); } } foreach (var union in f.AllUnions) { FamRecord ged = union.FamRec; foreach (var familyEvent in ged.FamEvents) { var state = dumpDate(familyEvent); IncrCount(state, counts); } } Console.WriteLine("\t Success:{0}", counts[0]); Console.WriteLine("\tSuccess (exact):{0}", counts[5]); Console.WriteLine("\t WFT Est:{0}", counts[1]); Console.WriteLine("\t Fail:{0}", counts[2]); Console.WriteLine("\t Fail/Dump:{0}", counts[3]); //if (hasWFTEst) // Console.WriteLine("\tWFT Est not shown"); }
private static void dump(Forest f, bool showErrors) { if (f.Errors.Count > 0) { foreach (var unkRec in f.Errors) { if (unkRec.Error == UnkRec.ErrorCode.EmptyFile) { Console.WriteLine("Empty file"); return; } } } if (f.AllRecords.Count == 0) { Console.WriteLine("*****Failed to parse"); return; } Dictionary <string, int> tagCounts = new Dictionary <string, int>(); foreach (var record in f.AllRecords) { incr(tagCounts, record.Tag); } Dictionary <string, int> indiEventCounts = new Dictionary <string, int>(); int indiEventLoc = 0; Dictionary <string, int> indiAttribCounts = new Dictionary <string, int>(); int attribLoc = 0; Dictionary <string, int> famEventCounts = new Dictionary <string, int>(); int famEventLoc = 0; foreach (var person in f.AllPeople) { IndiRecord ged = person.Indi; foreach (var familyEvent in ged.Events) { string tag = familyEvent.Tag; incr(indiEventCounts, tag); if (!string.IsNullOrEmpty(familyEvent.Place)) { indiEventLoc++; } } foreach (var familyEvent in ged.Attribs) { string tag = familyEvent.Tag; incr(indiAttribCounts, tag); if (!string.IsNullOrEmpty(familyEvent.Place)) { attribLoc++; } } } foreach (var union in f.AllUnions) { FamRecord ged = union.FamRec; foreach (var familyEvent in ged.FamEvents) { string tag = familyEvent.Tag; incr(famEventCounts, tag); if (!string.IsNullOrEmpty(familyEvent.Place)) { famEventLoc++; } } } HeadRecord head = f.Header; if (head == null) { Console.WriteLine("No head"); } else { Console.WriteLine(" {0}-{1}:{2} ({3})", head.GedVersion, head.Product, head.ProductVersion, head.GedDate.ToString("yyyyMMdd")); } Console.Write("\t"); foreach (var tag in tagCounts.Keys) { if (!string.IsNullOrEmpty(tag)) { Console.Write("{0}:{1};", tag, tagCounts[tag]); } } Console.WriteLine(); Console.WriteLine("\t\t----------"); Console.Write("\t"); foreach (var tag in indiEventCounts.Keys) { Console.Write("{0}:{1};", tag, indiEventCounts[tag]); } if (indiEventLoc > 0) { Console.Write("Locations:{0}", indiEventLoc); } Console.WriteLine(); Console.WriteLine("\t\t----------"); //foreach (var tag in indiAttribCounts.Keys) //{ // Console.WriteLine("\t\t{0}:{1}", tag, indiAttribCounts[tag]); //} //if (attribLoc > 0) // Console.WriteLine("\t\tLocations:{0}", attribLoc); //Console.WriteLine("\t\t----------"); Console.WriteLine("\t\t----------"); Console.Write("\t"); foreach (var tag in famEventCounts.Keys) { Console.Write("{0}:{1};", tag, famEventCounts[tag]); } if (famEventLoc > 0) { Console.Write("Locations:{0}", famEventLoc); } Console.WriteLine(); if (f.NumberOfTrees > 1) { Console.WriteLine("Number of trees:{0}", f.NumberOfTrees); } }