public void GEDCOMUtils_Tests() { GEDCOMObject obj = new GEDCOMObject(); obj.ExtData = this; Assert.AreEqual(obj.ExtData, this); obj.Dispose(); // Assert.AreEqual("I12", GEDCOMUtils.CleanXRef("@I12@"), "CleanXRef(@I12@)"); Assert.AreEqual("@I12@", GEDCOMUtils.EncloseXRef("I12"), "EncloseXRef(I12)"); // string s1 = " 12345 efgh"; string s2 = ""; s2 = GEDCOMUtils.ExtractDelimiter(s1, 0); Assert.AreEqual("12345 efgh", s2); // string s3 = GEDCOMUtils.ExtractDelimiter(" abrvalg", 2); Assert.AreEqual(" abrvalg", s3); }
public CorresponderRet GetCorresponder() { GKCommunicationDir commDir = GKCommunicationDir.cdFrom; GEDCOMIndividualRecord corresponder = null; GEDCOMTag corrTag = FindTag("FROM", 0); if (corrTag == null) { corrTag = FindTag("TO", 0); } if (corrTag != null) { corresponder = (Owner.XRefIndex_Find(GEDCOMUtils.CleanXRef(corrTag.StringValue)) as GEDCOMIndividualRecord); if (corrTag.Name == "FROM") { commDir = GKCommunicationDir.cdFrom; } else if (corrTag.Name == "TO") { commDir = GKCommunicationDir.cdTo; } } return(new CorresponderRet(commDir, corresponder)); }
public TaskGoalRet GetTaskGoal() { GDMTree tree = GetTree(); string goalXRef = string.Empty; GDMRecord goalRec = tree.XRefIndex_Find(GEDCOMUtils.CleanXRef(Goal)); GDMGoalType goalType; if (goalRec is GDMIndividualRecord) { goalType = GDMGoalType.gtIndividual; } else if (goalRec is GDMFamilyRecord) { goalType = GDMGoalType.gtFamily; } else if (goalRec is GDMSourceRecord) { goalType = GDMGoalType.gtSource; } else { goalType = GDMGoalType.gtOther; } return(new TaskGoalRet(goalType, goalXRef, goalRec)); }
public TaskGoalRet GetTaskGoal() { GEDCOMTree tree = Owner; GEDCOMRecord goalRec = tree.XRefIndex_Find(GEDCOMUtils.CleanXRef(Goal)); GKGoalType goalType; if (goalRec is GEDCOMIndividualRecord) { goalType = GKGoalType.gtIndividual; } else if (goalRec is GEDCOMFamilyRecord) { goalType = GKGoalType.gtFamily; } else if (goalRec is GEDCOMSourceRecord) { goalType = GKGoalType.gtSource; } else { goalType = GKGoalType.gtOther; } return(new TaskGoalRet(goalType, goalRec)); }
public void AddXRef(GDMRecord rec, string oldXRef, string newXRef) { // protection oldXRef = GEDCOMUtils.CleanXRef(oldXRef); newXRef = GEDCOMUtils.CleanXRef(newXRef); fList.Add(new XRefEntry(rec, oldXRef, newXRef)); }
public override void ReplaceXRefs(GDMXRefReplacer map) { base.ReplaceXRefs(map); if (GEDCOMUtils.IsXRef(fGoal)) { fGoal = GEDCOMUtils.EncloseXRef(map.FindNewXRef(GEDCOMUtils.CleanXRef(fGoal))); } }
public override void ReplaceXRefs(GDMXRefReplacer map) { base.ReplaceXRefs(map); TaskGoalRet goalRet = GetTaskGoal(); if (goalRet.GoalType != GDMGoalType.gtOther) { Goal = GEDCOMUtils.EncloseXRef(map.FindNewXRef(GEDCOMUtils.CleanXRef(Goal))); } }
public string FindNewXRef(string oldXRef) { string result = oldXRef; foreach (XRefEntry entry in fList) { if (GEDCOMUtils.CleanXRef(entry.OldXRef) == GEDCOMUtils.CleanXRef(oldXRef)) { result = entry.NewXRef; break; } } return(result); }
public void Test_XRef_CleanEnclose() { Assert.AreEqual("I12", GEDCOMUtils.CleanXRef("@I12@"), "CleanXRef(@I12@)"); Assert.AreEqual("@I12@", GEDCOMUtils.EncloseXRef("I12"), "EncloseXRef(I12)"); }