コード例 #1
0
 // Gets the n'th child in the fr, or returns the default individual if first child requested and no fr.
 private static CIndividualRecord GetChild(CFamilyRecord fr, int nChild, CIndividualRecord irDefault )
 {
     CIndividualRecord irChild = null;
     if (fr != null)
     {
         // The ordering of children in the tree can be selected to be the same as it is in the GEDCOM file. This
         // is because the file should be ordered as the user chose to order the fr when entering the data in
         // their fr history app, regardless of actual birth dates.
         if (MainForm.s_config.m_bKeepSiblingOrder)
         {
             irChild = fr.GetChildByPositionInFile(nChild);
         }
         else
         {
             irChild = fr.GetChild(nChild);
         }
     }
     else
     {
         // Return the default individual as first and only child of fr.
         if (nChild == 0)
         {
             irChild = irDefault;
         }
     }
     return irChild;
 }
コード例 #2
0
        // Extracts the data from the MARR event for the fr record.
        private string AddMarriageEvent( CFamilyRecord fr, string sourceRefs, out CPGDate marriageDate, out string marriageNote, out string marriagePlace )
        {
            // Find out when they were married
              marriageDate = null;
              marriagePlace = "";
              sourceRefs = "";
              marriageNote = "";
              foreach (CFamilyEventStructure fes in fr.m_alFamilyEventStructures)
              {
            if (fes.Type == "MARR")
            {
              if (fes.m_eventDetail != null)
              {
            marriageDate = fes.m_eventDetail.m_dateValue;

            if (fes.m_eventDetail.m_placeStructure != null)
            {
              if (fes.m_eventDetail.m_placeStructure.m_sPlaceName != "")
                marriagePlace = String.Concat(" ", MainForm.s_config.m_sPlaceWord, " ", EscapeHTML(fes.m_eventDetail.m_placeStructure.m_sPlaceName, false));
            }

            sourceRefs = AddSources(ref m_alReferenceList, fes.m_eventDetail.m_alSourceCitations);

            if (fes.m_eventDetail.m_alNoteStructures != null)
            {
              foreach (CNoteStructure ns in fes.m_eventDetail.m_alNoteStructures)
              {
                if (ns.Text != null && ns.Text.Length > 0)
                {
                  if (marriageNote != "")
                  {
                    marriageNote += "\n";
                  }

                  if (MainForm.s_config.m_bObfuscateEmails)
                  {
                    marriageNote += ObfuscateEmail(ns.Text);
                  }
                  else
                  {
                    marriageNote += ns.Text;
                  }
                }
              }
            }
            break;
              }
            }
              }
              return sourceRefs;
        }
コード例 #3
0
        // Parser
        public static CFamilyRecord Parse( CGedcom gedcom, int nLevel )
        {
            CGedcomLine gedcomLine;
            bool bParsingFinished;

            // Temporary holders for class members.
            CFamilyEventStructure fes;
            CLdsOrdinance lss;
            CNoteStructure ns;
            CSourceCitation sc;
            CMultimediaLink ml;
            int nChildPositionInFile = 0;

            // Without an xref header, we can't continue
            if ((gedcomLine = gedcom.GetLine(nLevel, "FAM")) == null)
            {
                // Not one of us
                return null;
            }

            CFamilyRecord fr = new CFamilyRecord( gedcom );

            fr.m_xref = gedcomLine.XrefID;
            gedcom.IncrementLineIndex(1);

            do
            {
                bParsingFinished = true;

                // Test for underscore items first so that parser doesn't skip them later
                if( (gedcomLine = gedcom.GetLine(nLevel+1, "_STAT")) != null || (gedcomLine = gedcom.GetLine(nLevel+1, "_MSTAT")) != null ) // Family tree maker (export as "FTW" format)
                {
                    fr.m_sStatus = gedcomLine.LineItem;
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
                // Let Record have a go at parsing the rest
                else if( fr.ParseRecord( gedcom, nLevel ) )
                {
                    bParsingFinished = false;
                    continue;
                }
                else if( (gedcomLine = gedcom.GetLine(nLevel+1, "RESN")) != null )
                {
                    fr.m_sRestrictionNotice = gedcomLine.LineItem;
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
                else if( (fes = CFamilyEventStructure.Parse( gedcom, nLevel+1)) != null )
                {
                    fr.m_alFamilyEventStructures.Add( fes );
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(nLevel+1, "HUSB")) != null )
                {
                    fr.m_xrefHusband = gedcomLine.LinePointer;
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(nLevel+1, "WIFE")) != null )
                {
                    fr.m_xrefWife = gedcomLine.LinePointer;
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(nLevel+1, "CHIL")) != null )
                {
                    fr.m_alXrefsChildren.Add( new CChildXref( nChildPositionInFile++, gedcomLine.LinePointer ) );
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(nLevel+1, "NCHI")) != null )
                {
                    fr.m_sCountOfChildren = gedcomLine.LineItem;
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(nLevel+1, "SUBM")) != null )
                {
                    fr.m_alXrefSubms.Add( gedcomLine.LinePointer );
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
                else if( (lss = CLdsOrdinance.Parse( gedcom, nLevel+1 )) != null )
                {
                    fr.m_alLdsSpouseSealings.Add( lss );
                    bParsingFinished = false;
                }
                else if( (sc = CSourceCitation.Parse( gedcom, nLevel+1 )) != null )
                {
                    fr.m_alSourceCitations.Add( sc );
                    bParsingFinished = false;
                }
                else if( (ml = CMultimediaLink.Parse( gedcom, nLevel+1 )) != null )
                {
                    fr.m_alMultimediaLinks.Add( ml );
                    bParsingFinished = false;
                }
                else if( (ns = CNoteStructure.Parse( gedcom, nLevel+1 )) != null )
                {
                    fr.m_alNoteStructures.Add( ns );
                    bParsingFinished = false;
                }
                else if( ( gedcomLine = gedcom.GetLine()).Level > nLevel )
                {
                    LogFile.TheLogFile.WriteLine( LogFile.DT_GEDCOM, LogFile.EDebugLevel.Warning, "Unknown tag :" );
                    LogFile.TheLogFile.WriteLine( LogFile.DT_GEDCOM, LogFile.EDebugLevel.Warning, gedcomLine.ToString() );
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
            }
            while( !bParsingFinished );

            return fr;
        }
コード例 #4
0
        // Adds the marriage associated with the fr record to the list of events. Also adds irSubject death if within this person's lifetime.
        private void AddMarriage( CIndividualRecord spouse, string spouseLink, CFamilyRecord fr )
        {
            // Find wedding date
              if (spouse != null)
              {
            string sourceRefs = AddSpouseDeath(spouse, spouseLink);

            CPGDate marriageDate;
            string marriageNote;
            string marriagePlace;
            sourceRefs = AddMarriageEvent(fr, sourceRefs, out marriageDate, out marriageNote, out marriagePlace);

            marriageNote = BuildMaritalStatusNote(fr, marriageNote);

            // Add fr record notes to marriage event
            if (fr.m_alNoteStructures != null)
            {
              foreach (CNoteStructure ns in fr.m_alNoteStructures)
              {
            if (ns.Text != null && ns.Text.Length > 0)
            {
              if (marriageNote != "")
              {
                marriageNote += "\n";
              }
              if (MainForm.s_config.m_bObfuscateEmails)
              {
                marriageNote += ObfuscateEmail(ns.Text);
              }
              else
              {
                marriageNote += ns.Text;
              }
            }
              }
            }
            string marriedString = "married ";
            if (fr.WereTheyReallyMarried() == false)
            {
              marriedString = "partner of ";
            }
            if (marriageDate != null)
            {
              CIEvent iEvent = new CIEvent(marriageDate, "_MARRIAGE", String.Concat(marriedString, spouseLink, marriagePlace, ".", sourceRefs), "", marriageNote, true, MainForm.s_config.m_bCapitaliseEventDescriptions);
              m_alEventList.Add(iEvent);
            }
            // else its an attribute.
            else
            {
              CIEvent iEvent = new CIEvent(marriageDate, "_MARRIAGE", String.Concat(marriedString, spouseLink, marriagePlace, ".", sourceRefs), "", marriageNote, true, MainForm.s_config.m_bCapitaliseEventDescriptions);
              // Marriages go at the front of the list so that they appear first in "Other facts"
              m_alAttributeList.Insert(0, iEvent);
            }

              } // end if (irSubject != null )
        }
コード例 #5
0
        // Adds birth, baptism, death etc of the children in the given fr.
        private void AddChildrensEvents( CFamilyRecord fr )
        {
            // Find out all the children.
              foreach (CChild ch in fr.m_alChildren)
              {
            CIndividualRecord child = ch.m_ir;
            if (child.Visibility() == CIndividualRecord.EVisibility.Invisible)
            {
              continue;
            }
            if (child != null)
            {
              bool childConcealed = (child.Visibility() == CIndividualRecord.EVisibility.Restricted);

              string childSex = "child";
              if (!childConcealed)
              {
            if (child.Sex == 'M')
            {
              childSex = "son";
            }
            else if (child.Sex == 'F')
            {
              childSex = "daughter";
            }
              }

              string childLink = MakeLink(child);
              string sourceRefs = "";

              if (!childConcealed)
              {
            // Add death of children if happened in irSubject's lifetime.
            // Note this is done before birth because the way the subsequent sort works it will put death after birth.
            CEventDetail childDeathday = child.GetEvent("DEAT");
            if (childDeathday == null)
            {
              childDeathday = child.GetEvent("BURI");
            }
            if (childDeathday == null)
            {
              childDeathday = child.GetEvent("CREM");
            }

            string deathPlace = "";
            CPGDate childDeathdate = null;

            if (childDeathday != null)
            {
              childDeathdate = childDeathday.m_dateValue;

              if (childDeathday.m_placeStructure != null)
              {
                if (childDeathday.m_placeStructure.m_sPlaceName != "")
                {
                  deathPlace = String.Concat(" ", MainForm.s_config.m_sPlaceWord, " ", EscapeHTML(childDeathday.m_placeStructure.m_sPlaceName, false));
                }
              }
            }

            if (childDeathdate != null && m_qdateInferredDeathday != null && m_qdateInferredDeathday.m_date != null && (childDeathdate.CompareTo(m_qdateInferredDeathday.m_date) <= 0))
            {
              sourceRefs = AddSources(ref m_alReferenceList, childDeathday.m_alSourceCitations);
              CIEvent iEvent = new CIEvent(childDeathdate, "_CHILDDIED", String.Concat("death of ", childSex, " ", childLink, deathPlace, ".", sourceRefs), "", null, false, MainForm.s_config.m_bCapitaliseEventDescriptions);
              m_alEventList.Add(iEvent);
            }
              }

              // Add birth of children.
              // Note this is done after deaths because the way the subsequent sort works it will put death after birth.
              CEventDetail childBirthday = child.GetEvent("BIRT");
              if (childBirthday == null)
              {
            childBirthday = child.GetEvent("CHR");
              }
              if (childBirthday == null)
              {
            childBirthday = child.GetEvent("BAPM");
              }

              string birthPlace = "";
              CPGDate childBirthdate = null;
              sourceRefs = "";

              if (childBirthday != null && !childConcealed)
              {
            childBirthdate = childBirthday.m_dateValue;

            if (childBirthday.m_placeStructure != null)
            {
              if (childBirthday.m_placeStructure.m_sPlaceName != "")
              {
                birthPlace = String.Concat(" ", MainForm.s_config.m_sPlaceWord, " ", EscapeHTML(childBirthday.m_placeStructure.m_sPlaceName, false));
              }
            }
            sourceRefs = AddSources(ref m_alReferenceList, childBirthday.m_alSourceCitations);
              }

              if (childBirthdate == null)
              {
            CIEvent iEvent = new CIEvent(null, "_CHILDBORN", String.Concat("birth of ", childSex, " ", childLink, birthPlace, ".", sourceRefs), "", null, true, MainForm.s_config.m_bCapitaliseEventDescriptions);
            m_alAttributeList.Add(iEvent);
              }
              else
              {
            CIEvent iEvent = new CIEvent(childBirthdate, "_CHILDBORN", String.Concat("birth of ", childSex, " ", childLink, birthPlace, ".", sourceRefs), "", null, true, MainForm.s_config.m_bCapitaliseEventDescriptions);
            m_alEventList.Add(iEvent);
              }
            }
              }
        }
コード例 #6
0
 // Creates a string describing the marital status of the given fr. Prepends the string provided in marriageNote.
 private static string BuildMaritalStatusNote(CFamilyRecord fr, string marriageNote)
 {
     if (fr.m_sStatus != null && fr.m_sStatus != "")
       {
     if (marriageNote != "")
     {
       marriageNote += "\n";
     }
     if (fr.m_sStatus.ToLower() == "unknown") // Nasty hack for Family Historian using strings to denote marital status
     {
       marriageNote += "Marital status unknown";
     }
     else
     {
       marriageNote += fr.m_sStatus;
     }
       }
       return marriageNote;
 }
コード例 #7
0
 // Gets the female spouse associated with the given family record
 public CIndividualRecord GetWife( CFamilyRecord fr )
 {
     if( fr == null )
     {
         return null;
     }
     return GetIndividualRecord( fr.m_xrefWife );
 }
コード例 #8
0
 // Gets the male spouse associated with the given family record
 public CIndividualRecord GetHusband( CFamilyRecord fr )
 {
     if( fr == null )
     {
         return null;
     }
     return GetIndividualRecord( fr.m_xrefHusband );
 }