Example #1
0
        private static int EventsCompare(GDMPointer cp1, GDMPointer cp2)
        {
            UDN udn1 = ((GDMFamilyRecord)cp1.Value).GetUDN(GEDCOMTagName.MARR);
            UDN udn2 = ((GDMFamilyRecord)cp2.Value).GetUDN(GEDCOMTagName.MARR);

            return(udn1.CompareTo(udn2));
        }
Example #2
0
        public bool DeleteLocationRecord(GDMLocationRecord locRec)
        {
            if (locRec == null)
            {
                return(false);
            }

            int num = fRecords.Count;

            for (int i = 0; i < num; i++)
            {
                var evsRec = fRecords[i] as GDMRecordWithEvents;
                if (evsRec != null)
                {
                    for (int j = evsRec.Events.Count - 1; j >= 0; j--)
                    {
                        GDMPointer evLocation = evsRec.Events[j].Place.Location;

                        if (evLocation.XRef == locRec.XRef)
                        {
                            evLocation.XRef = string.Empty;
                        }
                    }
                }
            }

            DeleteRecord(locRec);
            return(true);
        }
Example #3
0
        private static int EventsCompare(GDMPointer cp1, GDMPointer cp2)
        {
            UDN udn1 = ((GDMIndividualRecord)cp1.Value).GetUDN(GEDCOMTagName.BIRT);
            UDN udn2 = ((GDMIndividualRecord)cp2.Value).GetUDN(GEDCOMTagName.BIRT);

            return(udn1.CompareTo(udn2));
        }
Example #4
0
        public GDMPlace()
        {
            SetName(GEDCOMTagType.PLAC);

            fForm     = string.Empty;
            fLocation = new GDMPointer((int)GEDCOMTagType._LOC, string.Empty);
            fMap      = new GDMMap();
        }
Example #5
0
        public GDMPlace(GDMObject owner) : base(owner)
        {
            SetName(GEDCOMTagType.PLAC);

            fForm     = string.Empty;
            fLocation = new GDMPointer(this, (int)GEDCOMTagType._LOC, string.Empty);
            fMap      = new GDMMap(this);
        }
Example #6
0
        private int ChildrenEventsCompare(GDMPointer cp1, GDMPointer cp2)
        {
            var child1 = GetPtrValue <GDMIndividualRecord>(cp1);
            var child2 = GetPtrValue <GDMIndividualRecord>(cp2);

            UDN udn1 = child1.GetUDN(GEDCOMTagName.BIRT);
            UDN udn2 = child2.GetUDN(GEDCOMTagName.BIRT);

            return(udn1.CompareTo(udn2));
        }
Example #7
0
        private int SpousesEventsCompare(GDMPointer cp1, GDMPointer cp2)
        {
            var spouse1 = GetPtrValue <GDMFamilyRecord>(cp1);
            var spouse2 = GetPtrValue <GDMFamilyRecord>(cp2);

            UDN udn1 = spouse1.GetUDN(GEDCOMTagName.MARR);
            UDN udn2 = spouse2.GetUDN(GEDCOMTagName.MARR);

            return(udn1.CompareTo(udn2));
        }
Example #8
0
        public GDMSubmissionRecord(GDMObject owner) : base(owner)
        {
            SetName(GEDCOMTagType.SUBN);

            fFamilyFileName           = string.Empty;
            fTempleCode               = string.Empty;
            fGenerationsOfAncestors   = -1;
            fGenerationsOfDescendants = -1;
            fOrdinanceProcessFlag     = GDMOrdinanceProcessFlag.opNone;
            fSubmitter = new GDMPointer(this, (int)GEDCOMTagType.SUBM, string.Empty);
        }
Example #9
0
        public GDMHeader()
        {
            SetName(GEDCOMTagType.HEAD);

            fCharacterSet = new GDMHeaderCharSet();
            fFile         = new GDMHeaderFile();
            fGEDCOM       = new GDMHeaderGEDCOM();
            fNote         = new GDMTextTag((int)GEDCOMTagType.NOTE);
            fPlace        = new GDMPlace();
            fSource       = new GDMHeaderSource();
            fSubmission   = new GDMPointer((int)GEDCOMTagType.SUBN, string.Empty);
            fSubmitter    = new GDMPointer((int)GEDCOMTagType.SUBM, string.Empty);
        }
Example #10
0
        public GDMHeader(GDMObject owner) : base(owner)
        {
            SetName(GEDCOMTagType.HEAD);

            fCharacterSet = new GDMHeaderCharSet(this);
            fFile         = new GDMHeaderFile(this);
            fGEDCOM       = new GDMHeaderGEDCOM(this);
            fNote         = new GDMTextTag(this, (int)GEDCOMTagType.NOTE);
            fPlace        = new GDMPlace(this);
            fSource       = new GDMHeaderSource(this);
            fSubmission   = new GDMPointer(this, (int)GEDCOMTagType.SUBN, string.Empty);
            fSubmitter    = new GDMPointer(this, (int)GEDCOMTagType.SUBM, string.Empty);
        }
Example #11
0
        public bool AddGroup(GDMGroupRecord groupRecord)
        {
            bool result = false;

            if (groupRecord != null)
            {
                GDMPointer ptr = new GDMPointer((int)GEDCOMTagType._GROUP, string.Empty);
                ptr.XRef = groupRecord.XRef;
                fGroups.Add(ptr);
                result = true;
            }

            return(result);
        }
Example #12
0
        public bool AddCommunication(GDMCommunicationRecord commRecord)
        {
            bool result = false;

            if (commRecord != null)
            {
                GDMPointer ptr = new GDMPointer((int)GEDCOMTagType._COMM, string.Empty);
                ptr.XRef = commRecord.XRef;
                fCommunications.Add(ptr);
                result = true;
            }

            return(result);
        }
Example #13
0
        public bool AddTask(GDMTaskRecord taskRecord)
        {
            bool result = false;

            if (taskRecord != null)
            {
                GDMPointer ptr = new GDMPointer((int)GEDCOMTagType._TASK, string.Empty);
                ptr.XRef = taskRecord.XRef;
                fTasks.Add(ptr);
                result = true;
            }

            return(result);
        }
Example #14
0
        public void DeleteChild(GDMPointer childPtr)
        {
            if (childPtr == null)
            {
                return;
            }

            for (int i = fChildren.Count - 1; i >= 0; i--)
            {
                if (fChildren[i].XRef == childPtr.XRef)
                {
                    fChildren.DeleteAt(i);
                    break;
                }
            }
        }
Example #15
0
        public bool AddMember(GDMIndividualRecord member)
        {
            if (member == null)
            {
                return(false);
            }

            GDMIndividualLink mbrLink = new GDMIndividualLink(this, (int)GEDCOMTagType._MEMBER, string.Empty);

            mbrLink.Individual = member;
            fMembers.Add(mbrLink);

            var ptr = new GDMPointer(member, (int)GEDCOMTagType._GROUP, string.Empty);

            ptr.Value = this;
            member.Groups.Add(ptr);

            return(true);
        }
Example #16
0
        public void SetPtrValue(GDMPointer ptr, GDMRecord record)
        {
            if (ptr == null)
            {
                return;
            }

            ptr.XRef = string.Empty;
            if (record == null)
            {
                return;
            }

            string xrf = record.XRef;

            if (string.IsNullOrEmpty(xrf))
            {
                xrf = NewXRef(record);
            }
            ptr.XRef = xrf;
        }
Example #17
0
        public override void MoveTo(GDMRecord targetRecord, bool clearDest)
        {
            GDMIndividualRecord targetIndi = targetRecord as GDMIndividualRecord;

            if (targetIndi == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "targetRecord");
            }

            /*if (!clearDest) {
             *  DeleteTag(GEDCOMTagType.SEX);
             *  DeleteTag(GEDCOMTagType._UID);
             * }*/

            base.MoveTo(targetRecord, clearDest);

            targetIndi.Sex = fSex;

            while (fPersonalNames.Count > 0)
            {
                GDMPersonalName obj = fPersonalNames.Extract(0);
                obj.ResetOwner(targetIndi);
                targetIndi.AddPersonalName(obj);
            }

            string currentXRef = this.XRef;
            string targetXRef  = targetRecord.XRef;

            while (fChildToFamilyLinks.Count > 0)
            {
                GDMChildToFamilyLink ctfLink = fChildToFamilyLinks.Extract(0);
                GDMFamilyRecord      family  = ctfLink.Family;

                int num = family.Children.Count;
                for (int i = 0; i < num; i++)
                {
                    GDMIndividualLink childPtr = family.Children[i];

                    if (childPtr.XRef == currentXRef)
                    {
                        childPtr.XRef = targetXRef;
                    }
                }

                ctfLink.ResetOwner(targetIndi);
                targetIndi.ChildToFamilyLinks.Add(ctfLink);
            }

            while (fSpouseToFamilyLinks.Count > 0)
            {
                GDMSpouseToFamilyLink stfLink = fSpouseToFamilyLinks.Extract(0);
                GDMFamilyRecord       family  = stfLink.Family;

                if (family.Husband.XRef == currentXRef)
                {
                    family.Husband.XRef = targetXRef;
                }
                else if (family.Wife.XRef == currentXRef)
                {
                    family.Wife.XRef = targetXRef;
                }

                stfLink.ResetOwner(targetIndi);
                targetIndi.SpouseToFamilyLinks.Add(stfLink);
            }

            while (fAssociations.Count > 0)
            {
                GDMAssociation obj = fAssociations.Extract(0);
                obj.ResetOwner(targetIndi);
                targetIndi.Associations.Add(obj);
            }

            while (fAliases.Count > 0)
            {
                GDMAlias obj = fAliases.Extract(0);
                obj.ResetOwner(targetIndi);
                targetIndi.Aliases.Add(obj);
            }

            while (fGroups.Count > 0)
            {
                GDMPointer obj = fGroups.Extract(0);
                obj.ResetOwner(targetIndi);
                targetIndi.Groups.Add(obj);
            }
        }
Example #18
0
 public T GetPtrValue <T>(GDMPointer ptr) where T : GDMRecord
 {
     return((ptr == null || !ptr.IsPointer) ? default(T) : XRefIndex_Find(ptr.XRef) as T);
 }
Example #19
0
        public override void MoveTo(GDMRecord targetRecord)
        {
            GDMIndividualRecord targetIndi = targetRecord as GDMIndividualRecord;

            if (targetIndi == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "targetRecord");
            }

            base.MoveTo(targetRecord);

            targetIndi.Sex = fSex;

            while (fPersonalNames.Count > 0)
            {
                GDMPersonalName obj = fPersonalNames.Extract(0);
                targetIndi.AddPersonalName(obj);
            }

            string currentXRef = this.XRef;
            string targetXRef  = targetRecord.XRef;

            while (fChildToFamilyLinks.Count > 0)
            {
                GDMChildToFamilyLink ctfLink = fChildToFamilyLinks.Extract(0);
                var family = fTree.GetPtrValue <GDMFamilyRecord>(ctfLink);

                int num = family.Children.Count;
                for (int i = 0; i < num; i++)
                {
                    GDMIndividualLink childPtr = family.Children[i];

                    if (childPtr.XRef == currentXRef)
                    {
                        childPtr.XRef = targetXRef;
                    }
                }

                targetIndi.ChildToFamilyLinks.Add(ctfLink);
            }

            while (fSpouseToFamilyLinks.Count > 0)
            {
                GDMSpouseToFamilyLink stfLink = fSpouseToFamilyLinks.Extract(0);
                var family = fTree.GetPtrValue <GDMFamilyRecord>(stfLink);

                if (family.Husband.XRef == currentXRef)
                {
                    family.Husband.XRef = targetXRef;
                }
                else if (family.Wife.XRef == currentXRef)
                {
                    family.Wife.XRef = targetXRef;
                }

                targetIndi.SpouseToFamilyLinks.Add(stfLink);
            }

            while (fAssociations.Count > 0)
            {
                GDMAssociation obj = fAssociations.Extract(0);
                targetIndi.Associations.Add(obj);
            }

            while (fGroups.Count > 0)
            {
                GDMPointer obj = fGroups.Extract(0);
                targetIndi.Groups.Add(obj);
            }
        }