예제 #1
0
        public GDMCommunicationRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType._COMM);

            fDate         = new GDMDate();
            fCorresponder = new GDMIndividualLink();
        }
예제 #2
0
파일: GDMTree.cs 프로젝트: chipsi/gedkeeper
 public TreeEnumerator(GDMTree tree, GDMRecordType recType)
 {
     fTree     = tree;
     fIndex    = -1;
     fEndIndex = tree.RecordsCount - 1;
     fRecType  = recType;
 }
예제 #3
0
        public GDMGroupRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType._GROUP);

            fGroupName = string.Empty;
            fMembers   = new GDMList <GDMIndividualLink>();
        }
예제 #4
0
 public GDMRecord(GDMTree tree)
 {
     fTree = tree;
     fXRef = string.Empty;
     fAutomatedRecordID = string.Empty;
     fChangeDate        = new GDMChangeDate();
 }
예제 #5
0
        public GDMRepositoryRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.REPO);

            fAddress        = new GDMAddress();
            fRepositoryName = string.Empty;
        }
예제 #6
0
        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));
        }
예제 #7
0
        public GDMTaskRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType._TASK);

            fStartDate = new GDMDate((int)GEDCOMTagType._STARTDATE, string.Empty);
            fStopDate  = new GDMDate((int)GEDCOMTagType._STOPDATE, string.Empty);
        }
예제 #8
0
        public virtual GDMTree GetTree()
        {
            GDMTree owner = null;

            GDMTag current = this;

            while (current != null)
            {
                GDMObject parent = current.fOwner;

                var parentTag = parent as GDMTag;
                if (parentTag != null)
                {
                    current = parentTag;
                }
                else
                {
                    var parentTree = parent as GDMTree;
                    if (parentTree != null)
                    {
                        owner = parentTree;
                    }
                    break;
                }
            }

            return(owner);
        }
예제 #9
0
        public static void Test_GDMSpouseToFamilyLink(GDMTree tree, GDMSpouseToFamilyLink spouseLink)
        {
            Assert.IsNotNull(tree.GetPtrValue <GDMFamilyRecord>(spouseLink));

            using (spouseLink = new GDMSpouseToFamilyLink()) {
                Assert.IsNotNull(spouseLink);
            }
        }
예제 #10
0
        public GDMFamilyRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.FAM);

            fHusband  = new GDMIndividualLink((int)GEDCOMTagType.HUSB, string.Empty);
            fWife     = new GDMIndividualLink((int)GEDCOMTagType.WIFE, string.Empty);
            fChildren = new GDMList <GDMIndividualLink>();
        }
예제 #11
0
        public GDMIndividualRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.INDI);

            fChildToFamilyLinks  = new GDMList <GDMChildToFamilyLink>();
            fPersonalNames       = new GDMList <GDMPersonalName>();
            fSpouseToFamilyLinks = new GDMList <GDMSpouseToFamilyLink>();
        }
예제 #12
0
        public GDMSubmitterRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.SUBM);

            fAddress             = new GDMAddress();
            fLanguages           = new GDMList <GDMLanguage>();
            fName                = new GDMPersonalName();
            fRegisteredReference = string.Empty;
        }
예제 #13
0
 public GDMRecord(GDMTree tree) : base()
 {
     fTree = tree;
     fXRef = string.Empty;
     fAutomatedRecordID = string.Empty;
     fChangeDate        = new GDMChangeDate();
     fNotes             = new GDMList <GDMNotes>();
     fSourceCitations   = new GDMList <GDMSourceCitation>();
     fMultimediaLinks   = new GDMList <GDMMultimediaLink>();
     fUserReferences    = new GDMList <GDMUserReference>();
 }
예제 #14
0
        public GDMResearchRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType._RESEARCH);

            fStartDate = new GDMDate((int)GEDCOMTagType._STARTDATE, string.Empty);
            fStopDate  = new GDMDate((int)GEDCOMTagType._STOPDATE, string.Empty);

            fTasks          = new GDMList <GDMPointer>();
            fCommunications = new GDMList <GDMPointer>();
            fGroups         = new GDMList <GDMPointer>();
        }
예제 #15
0
        public void SetXRef(GDMTree tree, string newXRef, bool removeOldXRef)
        {
            string oldXRef = fXRef;

            fXRef = newXRef;

            if (tree != null)
            {
                tree.SetXRef(oldXRef, this, removeOldXRef);
            }
        }
예제 #16
0
        public GDMSubmissionRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.SUBN);

            fFamilyFileName           = string.Empty;
            fTempleCode               = string.Empty;
            fGenerationsOfAncestors   = -1;
            fGenerationsOfDescendants = -1;
            fOrdinanceProcessFlag     = GDMOrdinanceProcessFlag.opNone;
            fSubmitter = new GDMPointer((int)GEDCOMTagType.SUBM, string.Empty);
        }
예제 #17
0
        public void Test_Common2()
        {
            GDMTree tree = new GDMTree();

            using (GDMFamilyRecord famRec = new GDMFamilyRecord(tree)) {
                Assert.IsNotNull(famRec);

                GDMIndividualRecord unkInd = new GDMIndividualRecord(null);
                unkInd.Sex = GDMSex.svUnknown;
                Assert.IsFalse(famRec.AddSpouse(unkInd));

                GDMIndividualRecord child1 = tree.CreateIndividual(); // for pointer need a proper object
                Assert.IsTrue(famRec.AddChild(child1));

                GDMIndividualRecord child2 = tree.CreateIndividual(); // for pointer need a proper object
                Assert.IsTrue(famRec.AddChild(child2));
                Assert.AreEqual(1, famRec.IndexOfChild(child2));

                famRec.DeleteChild(child1);
                Assert.AreEqual(-1, famRec.IndexOfChild(child1));

                string str = GKUtils.GetFamilyString(famRec, null, null);
                Assert.AreEqual("? - ?", str);

                str = GKUtils.GetFamilyString(famRec, "x", "x");
                Assert.AreEqual("x - x", str);

                Assert.AreEqual(0.0f, famRec.IsMatch(null, new MatchParams()));
                Assert.AreEqual(100.0f, famRec.IsMatch(famRec, new MatchParams()));

                // MoveTo test
                Assert.Throws(typeof(ArgumentException), () => {
                    famRec.MoveTo(null, false);
                });

                GDMCustomEvent evt = famRec.AddEvent(new GDMFamilyEvent(famRec, (int)GEDCOMTagType.MARR, "01 SEP 1981"));
                Assert.AreEqual(1, famRec.Events.Count);
                Assert.AreEqual(evt, famRec.FindEvent(GEDCOMTagType.MARR));

                using (GDMFamilyRecord famRec2 = new GDMFamilyRecord(tree)) {
                    Assert.AreEqual(0, famRec2.Events.Count);
                    Assert.AreEqual(null, famRec2.FindEvent(GEDCOMTagType.MARR));

                    famRec.MoveTo(famRec2, false);

                    Assert.AreEqual(1, famRec2.Events.Count);
                    Assert.AreEqual(evt, famRec2.FindEvent(GEDCOMTagType.MARR));
                }

                famRec.ResetOwner(tree);
                Assert.AreEqual(tree, famRec.GetTree());
            }
        }
예제 #18
0
        public GDMSourceRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.SOUR);

            fData                = new GDMSourceData();
            fOriginator          = new GDMTextTag((int)GEDCOMTagType.AUTH);
            fPublication         = new GDMTextTag((int)GEDCOMTagType.PUBL);
            fRepositoryCitations = new GDMList <GDMRepositoryCitation>();
            fShortTitle          = string.Empty;
            fText                = new GDMTextTag((int)GEDCOMTagType.TEXT);
            fTitle               = new GDMTextTag((int)GEDCOMTagType.TITL);
        }
예제 #19
0
        public void Test_Common()
        {
            var tree = new GDMTree();

            using (GDMRepositoryRecord repoRec = new GDMRepositoryRecord(tree)) {
                Assert.IsNotNull(repoRec);

                repoRec.InitNew();
                repoRec.RepositoryName = "Test Repository";
                Assert.AreEqual("Test Repository", repoRec.RepositoryName);

                Assert.IsNotNull(repoRec.Address);
                repoRec.Address.AddressLine1 = "AdrLine1";

                using (GDMRepositoryRecord repo2 = new GDMRepositoryRecord(tree)) {
                    repo2.InitNew();

                    Assert.Throws(typeof(ArgumentException), () => {
                        repo2.Assign(null);
                    });

                    repo2.Assign(repoRec);

                    string buf = TestUtils.GetTagStreamText(repo2, 0);
                    Assert.AreEqual("0 @R2@ REPO\r\n" +
                                    "1 NAME Test Repository\r\n" +
                                    "1 ADDR\r\n" +
                                    "2 ADR1 AdrLine1\r\n", buf);
                }

                using (GDMRepositoryRecord repo3 = new GDMRepositoryRecord(tree)) {
                    repo3.InitNew();

                    var matchParams = new MatchParams();
                    matchParams.NamesIndistinctThreshold = 100.0f;

                    Assert.AreEqual(0.0f, repoRec.IsMatch(null, matchParams));

                    repo3.RepositoryName = "Test Repository";
                    Assert.AreEqual(100.0f, repoRec.IsMatch(repo3, matchParams));

                    repo3.RepositoryName = "test";
                    Assert.AreEqual(0.0f, repoRec.IsMatch(repo3, matchParams));
                }

                repoRec.ReplaceXRefs(new GDMXRefReplacer());

                Assert.IsFalse(repoRec.IsEmpty());
                repoRec.Clear();
                Assert.IsTrue(repoRec.IsEmpty());
            }
        }
예제 #20
0
        public string GetUID(GDMTree tree)
        {
            string result = null;

            try {
                var mmRec = tree.GetPtrValue <GDMMultimediaRecord>(this);
                if (mmRec != null)
                {
                    ExtRect cutoutArea = IsPrimaryCutout ? CutoutPosition.Value : ExtRect.CreateEmpty();
                    result = mmRec.UID + "-" + GKUtils.GetRectUID(cutoutArea.Left, cutoutArea.Top, cutoutArea.Right, cutoutArea.Bottom);
                }
            } catch (Exception ex) {
                Logger.WriteError("GDMMultimediaLink.GetUID()", ex);
                result = null;
            }
            return(result);
        }
예제 #21
0
 protected GDMRecordWithEvents(GDMTree tree) : base(tree)
 {
 }
예제 #22
0
        public void Test_Common()
        {
            GDMTree tree = new GDMTree();

            Assert.IsNotNull(tree);

            Assert.IsNotNull(tree.GetSubmitter());

            // Tests of event handlers
            tree.OnChange   += OnTreeChange;
            tree.OnChanging += OnTreeChanging;
            tree.OnProgress += OnTreeProgress;

            tree.BeginUpdate();
            Assert.IsTrue(tree.IsUpdated());

            GDMRecord rec;

            GDMIndividualRecord iRec = tree.CreateIndividual();

            Assert.IsNotNull(iRec, "CreateIndividual() != null");

            string xref = iRec.XRef;

            rec = tree.XRefIndex_Find(xref);
            Assert.IsNotNull(rec);
            Assert.AreEqual(xref, rec.XRef);

            string uid = iRec.UID;

            rec = tree.FindUID(uid);
            Assert.IsNotNull(rec);
            Assert.AreEqual(uid, rec.UID);
            Assert.IsNull(tree.FindUID(""));

            //
            GDMFamilyRecord famRec = tree.CreateFamily();

            Assert.IsNotNull(famRec, "CreateFamily() != null");

            //
            GDMNoteRecord noteRec = tree.CreateNote();

            Assert.IsNotNull(noteRec, "CreateNote() != null");

            //
            GDMRepositoryRecord repRec = tree.CreateRepository();

            Assert.IsNotNull(repRec, "CreateRepository() != null");

            //
            GDMSourceRecord srcRec = tree.CreateSource();

            Assert.IsNotNull(srcRec, "CreateSource() != null");

            //
            GDMMultimediaRecord mmRec = tree.CreateMultimedia();

            Assert.IsNotNull(mmRec, "CreateMultimedia() != null");

            //

            GDMRecord sbmrRec = tree.AddRecord(new GDMSubmitterRecord(tree));

            Assert.IsNotNull(sbmrRec, "sbmrRec != null");
            tree.NewXRef(sbmrRec);
            string submXRef = sbmrRec.XRef;

            //

            GDMSubmissionRecord submRec = tree.AddRecord(new GDMSubmissionRecord(tree)) as GDMSubmissionRecord;

            Assert.IsNotNull(submRec, "rec1 != null");
            tree.NewXRef(submRec);

            //
            GDMGroupRecord groupRec = tree.CreateGroup();

            Assert.IsNotNull(groupRec, "CreateGroup() != null");

            //
            GDMTaskRecord taskRec = tree.CreateTask();

            Assert.IsNotNull(taskRec, "CreateTask() != null");

            //
            GDMCommunicationRecord commRec = tree.CreateCommunication();

            Assert.IsNotNull(commRec, "CreateCommunication() != null");

            //
            GDMResearchRecord resRec = tree.CreateResearch();

            Assert.IsNotNull(resRec, "CreateResearch() != null");

            //
            GDMLocationRecord locRec = tree.CreateLocation();

            Assert.IsNotNull(locRec, "CreateLocation() != null");

            tree.EndUpdate();
            Assert.IsFalse(tree.IsUpdated());

            tree.OnChange   -= OnTreeChange;
            tree.OnChanging -= OnTreeChanging;
            tree.OnProgress -= OnTreeProgress;

            int       size  = 0;
            var       enum1 = tree.GetEnumerator(GDMRecordType.rtNone);
            GDMRecord rec1;

            enum1.Reset();
            while (enum1.MoveNext(out rec1))
            {
                size++;
            }
            Assert.AreEqual(14, size);

            for (int i = 0; i < tree.RecordsCount; i++)
            {
                GDMRecord rec2 = tree[i];
                Assert.IsNotNull(rec2);

                string    xref2 = rec2.XRef;
                GDMRecord rec3  = tree.XRefIndex_Find(xref2);
                Assert.IsNotNull(rec3);
                Assert.AreEqual(rec2, rec3);

                /*string uid = rec2.UID;
                 * GEDCOMRecord rec4 = tree.FindUID(uid);
                 * Assert.IsNotNull(rec4);
                 * Assert.AreEqual(rec2, rec4);*/

                int idx = tree.IndexOf(rec2);
                Assert.AreEqual(i, idx);
            }

            var recordsX = tree.GetRecords <GDMIndividualRecord>();

            Assert.IsNotNull(recordsX);
            Assert.AreEqual(1, recordsX.Count);

            int[] stats = tree.GetRecordStats();
            Assert.IsNotNull(stats);
            Assert.AreEqual(14, stats.Length);

            Assert.IsFalse(tree.IsEmpty);

            Assert.IsFalse(tree.DeleteFamilyRecord(null));
            Assert.IsTrue(tree.DeleteFamilyRecord(famRec));

            Assert.IsFalse(tree.DeleteNoteRecord(null));
            Assert.IsTrue(tree.DeleteNoteRecord(noteRec));

            Assert.IsFalse(tree.DeleteSourceRecord(null));
            Assert.IsTrue(tree.DeleteSourceRecord(srcRec));

            Assert.IsFalse(tree.DeleteGroupRecord(null));
            Assert.IsTrue(tree.DeleteGroupRecord(groupRec));

            Assert.IsFalse(tree.DeleteLocationRecord(null));
            Assert.IsTrue(tree.DeleteLocationRecord(locRec));

            Assert.IsFalse(tree.DeleteResearchRecord(null));
            Assert.IsTrue(tree.DeleteResearchRecord(resRec));

            Assert.IsFalse(tree.DeleteCommunicationRecord(null));
            Assert.IsTrue(tree.DeleteCommunicationRecord(commRec));

            Assert.IsFalse(tree.DeleteTaskRecord(null));
            Assert.IsTrue(tree.DeleteTaskRecord(taskRec));

            Assert.IsFalse(tree.DeleteMediaRecord(null));
            Assert.IsTrue(tree.DeleteMediaRecord(mmRec));

            Assert.IsFalse(tree.DeleteIndividualRecord(null));
            Assert.IsTrue(tree.DeleteIndividualRecord(iRec));

            Assert.IsFalse(tree.DeleteRepositoryRecord(null));
            Assert.IsTrue(tree.DeleteRepositoryRecord(repRec));

            tree.Clear();
            Assert.AreEqual(0, tree.RecordsCount);
            Assert.IsTrue(tree.IsEmpty);

            tree.State = GDMTreeState.osReady;
            Assert.AreEqual(GDMTreeState.osReady, tree.State);


            // Tests of GEDCOMTree.Extract()
            using (GDMTree tree2 = new GDMTree()) {
                GDMIndividualRecord iRec2 = tree.AddRecord(new GDMIndividualRecord(tree2)) as GDMIndividualRecord;
                Assert.IsNotNull(iRec2);
                tree2.NewXRef(iRec2);

                tree2.AddRecord(iRec2);
                int rIdx = tree2.IndexOf(iRec2);
                Assert.IsTrue(rIdx >= 0);
                GDMRecord extractedRec = tree2.Extract(rIdx);
                Assert.AreEqual(iRec2, extractedRec);
                Assert.IsTrue(tree2.IndexOf(iRec2) < 0);
            }
        }
예제 #23
0
        public void Test_IndiMathes()
        {
            GDMTree tree = new GDMTree();

            Assert.IsNotNull(tree);

            GDMIndividualRecord ind1, ind2;
            GDMCustomEvent      ev1, ev2;
            GDMDateValue        dtVal1, dtVal2;

            ind1     = tree.CreateIndividual();
            ind1.Sex = GDMSex.svMale;
            GDMPersonalName pn = ind1.AddPersonalName(new GDMPersonalName(ind1));

            pn.SetNameParts("Ivan Ivanov", "Fedoroff", "");

            ind2     = tree.CreateIndividual();
            ind2.Sex = GDMSex.svMale;
            pn       = ind2.AddPersonalName(new GDMPersonalName(ind2));
            pn.SetNameParts("Ivan Ivanovich", "Fedoroff", "");

            ev1    = new GDMIndividualEvent(ind1, (int)GEDCOMTagType.BIRT, "");
            dtVal1 = ev1.Date;
            ind1.AddEvent(ev1);

            ev2    = new GDMIndividualEvent(ind2, (int)GEDCOMTagType.BIRT, "");
            dtVal2 = ev2.Date;
            ind2.AddEvent(ev2);

            float       res;
            MatchParams mParams;

            mParams.NamesIndistinctThreshold = 1.0f;
            mParams.DatesCheck       = true;
            mParams.YearsInaccuracy  = 0;
            mParams.CheckEventPlaces = false;

            // null
            res = dtVal1.IsMatch(null, mParams);
            Assert.AreEqual(0.0f, res);

            // null
            res = ev1.IsMatch(null, mParams);
            Assert.AreEqual(0.0f, res);

            // dtVal1 -> dtVal2, delta = 0
            dtVal1.SetDateTime(DateTime.Parse("10.10.2013"));
            dtVal2.SetDateTime(DateTime.Parse("10.10.2013"));
            res = dtVal1.IsMatch(dtVal2, mParams);
            Assert.AreEqual(100.0f, res);

            // ev1 -> ev2, delta = 0
            res = ev1.IsMatch(ev2, mParams);
            Assert.AreEqual(100.0f, res);

            // dtVal1 -> dtVal2, delta = 3
            mParams.YearsInaccuracy = 3;

            dtVal2.SetDateTime(DateTime.Parse("10.10.2015"));
            res = dtVal1.IsMatch(dtVal2, mParams);
            Assert.AreEqual(100.0f, res);

            // ev1 -> ev2, delta = 3
            res = ev1.IsMatch(ev2, mParams);
            Assert.AreEqual(100.0f, res);

            dtVal2.SetDateTime(DateTime.Parse("10.10.2009"));
            res = dtVal1.IsMatch(dtVal2, mParams);
            Assert.AreEqual(0.0f, res);

            // ev1 -> ev2, delta = 3
            res = ev1.IsMatch(ev2, mParams);
            Assert.AreEqual(0.0f, res);

            // //

            res = ind1.IsMatch(null, mParams);
            Assert.AreEqual(0.0f, res);

            res = ind1.IsMatch(ind2, mParams);
            Assert.AreEqual(0.0f, res);

            // Ivanov - Ivanov(ich) : 3 chars of difference -> 0.88
            mParams.NamesIndistinctThreshold = 0.85f;
            mParams.YearsInaccuracy          = 4;

            res = ind1.IsMatch(ind2, mParams);
            Assert.AreEqual(100.0f, res);
        }
예제 #24
0
        public GDMMultimediaRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.OBJE);

            fFileReferences = new GDMList <GDMFileReferenceWithTitle>();
        }
예제 #25
0
        public GDMLocationRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType._LOC);

            fMap = new GDMMap();
        }
예제 #26
0
        public void Test_Common()
        {
            GDMTree tree = new GDMTree();

            Assert.IsNotNull(tree);

            GDMIndividualRecord indiv = tree.CreateIndividual();

            Assert.IsNotNull(indiv);

            GDMFamilyRecord famRec = tree.CreateFamily();

            Assert.IsNotNull(famRec);

            famRec.Restriction = GDMRestriction.rnLocked;
            Assert.AreEqual(GDMRestriction.rnLocked, famRec.Restriction);

            famRec.AddChild(indiv);
            Assert.AreEqual(0, famRec.IndexOfChild(indiv));

            famRec.Husband.Value = tree.CreateIndividual();
            famRec.Wife.Value    = tree.CreateIndividual();

            using (GDMFamilyRecord fam2 = tree.CreateFamily()) {
                Assert.Throws(typeof(ArgumentException), () => {
                    fam2.Assign(null);
                });

                fam2.Assign(famRec);

                string buf = TestUtils.GetTagStreamText(fam2, 0);
                Assert.AreEqual("0 @F2@ FAM\r\n" +
                                "1 RESN locked\r\n" +
                                "1 HUSB @I2@\r\n" +
                                "1 WIFE @I3@\r\n" +
                                "1 CHIL @I1@\r\n", buf);
            }

            // Integrity test
            GDMChildToFamilyLink childLink = indiv.ChildToFamilyLinks[0];

            Assert.IsNotNull(childLink.Family);

            famRec.RemoveChild(indiv);
            Assert.AreEqual(-1, famRec.IndexOfChild(indiv));

            //

            Assert.Throws(typeof(ArgumentException), () => {
                famRec.AddEvent(new GDMIndividualEvent(null));
            });

            famRec.ReplaceXRefs(new GDMXRefReplacer());

            //

            famRec.Husband.Value = indiv;
            Assert.AreEqual(indiv, famRec.Husband.Individual);
            famRec.Husband.Value = null;

            //

            famRec.Wife.Value = indiv;
            Assert.AreEqual(indiv, famRec.Wife.Individual);
            famRec.Wife.Value = null;

            //

            indiv.Sex = GDMSex.svMale;
            famRec.AddSpouse(indiv);
            Assert.AreEqual(0, indiv.IndexOfSpouse(famRec));
            Test_GDMSpouseToFamilyLink(indiv.SpouseToFamilyLinks[0]);
            Assert.IsNull(famRec.GetSpouseBy(indiv));
            famRec.RemoveSpouse(indiv);

            indiv.Sex = GDMSex.svFemale;
            famRec.AddSpouse(indiv);
            Assert.AreEqual(0, indiv.IndexOfSpouse(famRec));
            Test_GDMSpouseToFamilyLink(indiv.SpouseToFamilyLinks[0]);
            Assert.IsNull(famRec.GetSpouseBy(indiv));
            famRec.RemoveSpouse(indiv);

            //

            famRec.SortChilds();

            //

            famRec.AddChild(null);
            famRec.RemoveChild(null);
            famRec.AddSpouse(null);
            famRec.RemoveSpouse(null);

            //
            famRec.AddSpouse(indiv);

            famRec.AddChild(tree.CreateIndividual());
            famRec.AddChild(tree.CreateIndividual());
            famRec.AddChild(tree.CreateIndividual());
            Assert.AreEqual(3, famRec.Children.Count);

            Assert.IsFalse(famRec.IsEmpty());
            famRec.Clear();
            Assert.IsTrue(famRec.IsEmpty());
        }
예제 #27
0
        public void Test_Common()
        {
            GDMTree   tree    = new GDMTree();
            GDMHeader headRec = tree.Header;

            headRec.Note.Lines.Text = "This notes test";
            Assert.AreEqual("This notes test", headRec.Note.Lines.Text);

            headRec.CharacterSet.Value = GEDCOMCharacterSet.csASCII;
            Assert.AreEqual(GEDCOMCharacterSet.csASCII, headRec.CharacterSet.Value);

            headRec.CharacterSet.Version = "1x";
            Assert.AreEqual("1x", headRec.CharacterSet.Version);

            headRec.Copyright = "copyright";
            Assert.AreEqual("copyright", headRec.Copyright);

            headRec.Source.StringValue = "GEDKeeper";
            Assert.AreEqual("GEDKeeper", headRec.Source.StringValue);

            headRec.ReceivingSystemName = "GEDKeeper";
            Assert.AreEqual("GEDKeeper", headRec.ReceivingSystemName);

            headRec.Language = GDMLanguageID.Russian;
            Assert.AreEqual(GDMLanguageID.Russian, headRec.Language);

            headRec.GEDCOM.Version = "5.5";
            Assert.AreEqual("5.5", headRec.GEDCOM.Version);

            headRec.GEDCOM.Form = "LINEAGE-LINKED";
            Assert.AreEqual("LINEAGE-LINKED", headRec.GEDCOM.Form);

            headRec.File.StringValue = "testfile.ged";
            Assert.AreEqual("testfile.ged", headRec.File.StringValue);

            DateTime dtx = DateTime.Now;

            dtx = dtx.AddTicks(-dtx.Ticks % 10000000);
            headRec.TransmissionDateTime = dtx;
            Assert.AreEqual(dtx, headRec.TransmissionDateTime);

            headRec.File.Revision = 113;
            Assert.AreEqual(113, headRec.File.Revision);

            headRec.Place.Form = "test11";
            Assert.AreEqual("test11", headRec.Place.Form);

            /*Assert.IsNotNull(headRec.Source.BusinessAddress);
             *
             * headRec.Source.BusinessName = "test23";
             * Assert.AreEqual("test23", headRec.Source.BusinessName);*/

            headRec.Source.ProductName = "test33";
            Assert.AreEqual("test33", headRec.Source.ProductName);

            headRec.Source.Version = "test44";
            Assert.AreEqual("test44", headRec.Source.Version);

            Assert.IsNotNull(headRec.Submission);

            Assert.IsFalse(headRec.IsEmpty());
            headRec.Clear();
            Assert.IsTrue(headRec.IsEmpty());
        }
예제 #28
0
        public GDMNoteRecord(GDMTree tree) : base(tree)
        {
            SetName(GEDCOMTagType.NOTE);

            fLines = new GDMLines();
        }
예제 #29
0
 protected GDMRecordWithEvents(GDMTree tree) : base(tree)
 {
     fEvents = new GDMList <GDMCustomEvent>();
 }
예제 #30
0
 public void ResetTree(GDMTree tree)
 {
     fTree = tree;
 }