// Used to ensure the each source is added to the list at the bottom of the web page only once.
 public abstract bool SameAs( CSourceCitationXref sc );
 // Tests to see if this source citation displays the same as the xref citation given.
 // Used to ensure the each source is added to the list at the bottom of the web page only once.
 public override bool SameAs(CSourceCitationXref sc)
 {
     return( this.m_sWhereWithinSource == sc.m_sWhereWithinSource
         //not displayed atm so ignore: && this.m_eventTypeCitedFrom == sc.m_eventTypeCitedFrom
         //not displayed atm so ignore: && this.m_roleInEvent == sc.m_roleInEvent
         //not displayed atm so ignore: && this.m_entryRecordingDate == sc.m_entryRecordingDate
         && this.m_xref == sc.m_xref
         && m_sCertaintyAssessment == sc.m_sCertaintyAssessment );
 }
        // Parser
        public static new CSourceCitationXref Parse( CGedcom gedcom, int nLevel )
        {
            CGedcomLine gedcomLine;

            // Temporary holders for class members. Saves constructing a class early.
            string xref;
            string sWhereWithinSource = "";
            string sEventTypeCitedFrom = "";
            string sRoleInEvent = "";
            string sEntryRecordingDate = "";
            ArrayList alTextsFromSource = new ArrayList();
            CMultimediaLink multimediaLink;
            ArrayList alMultimediaLinks = new ArrayList();
            CNoteStructure noteStructure;
            ArrayList alNoteStructures = new ArrayList();
            string sCertaintyAssessment = "";

            // There must be one of these, it defines the object.
            if ((gedcomLine = gedcom.GetLine(nLevel, "SOUR")) == null)
            {
                // Not one of us
                return null;
            }
            xref = gedcomLine.LinePointer;

            // Parsing is going well enough to say that we definitely have one of these,
            // so we can adjust the gedcom now.
            gedcom.IncrementLineIndex(1);

            bool bParsingFinished;
            do
            {
                bParsingFinished = true;

                // There may be one of these, standard specifies {0:1}
                if( (gedcomLine = gedcom.GetLine(nLevel+1, "PAGE")) != null )
                {
                    sWhereWithinSource = gedcomLine.LineItem;
                    gedcom.IncrementLineIndex(1);
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(nLevel+1, "EVEN")) != null )
                {
                    sEventTypeCitedFrom = gedcomLine.LineItem;
                    gedcom.IncrementLineIndex(1);
                    if( (gedcomLine = gedcom.GetLine(nLevel+2, "ROLE")) != null )
                    {
                        sRoleInEvent = gedcomLine.LineItem;
                        gedcom.IncrementLineIndex(1);
                    }
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(nLevel+1, "DATA")) != null )
                {
                    gedcom.IncrementLineIndex(1);

                    bool bParsingFinished2;
                    do
                    {
                        bParsingFinished2 = true;
                        if( (gedcomLine = gedcom.GetLine(nLevel+2, "DATE")) != null )
                        {
                            sEntryRecordingDate = gedcomLine.LineItem;
                            gedcom.IncrementLineIndex(1);
                            bParsingFinished2 = false;
                        }
                        else if( (gedcomLine = gedcom.GetLine(nLevel+2, "TEXT")) != null )
                        {
                            string textFromSource = gedcomLine.LineItem;
                            gedcom.IncrementLineIndex(1);

                            bool bParsingFinished3;
                            do
                            {
                                bParsingFinished3 = true;
                                if( (gedcomLine = gedcom.GetLine(nLevel+3, "CONC")) != null )
                                {
                                    textFromSource += gedcomLine.LineItem;
                                    gedcom.IncrementLineIndex(1);
                                    bParsingFinished3 = false;
                                }
                                else if( (gedcomLine = gedcom.GetLine(nLevel+3, "CONT")) != null )
                                {
                                    textFromSource += "\n" + gedcomLine.LineItem;
                                    gedcom.IncrementLineIndex(1);
                                    bParsingFinished3 = false;
                                }
                            }
                            while( !bParsingFinished3 );

                            alTextsFromSource.Add( textFromSource );
                            bParsingFinished2 = false;
                        }
                    }
                    while( !bParsingFinished2 );
                    bParsingFinished = false;
                }
                else if( (multimediaLink = CMultimediaLink.Parse( gedcom, nLevel+1 )) != null )
                {
                    alMultimediaLinks.Add( multimediaLink );
                    bParsingFinished = false;
                }
                else if( (noteStructure = CNoteStructure.Parse( gedcom, nLevel+1 )) != null )
                {
                    alNoteStructures.Add( noteStructure );
                    bParsingFinished = false;
                }
                else if( (gedcomLine = gedcom.GetLine(nLevel+1, "QUAY")) != null )
                {
                    sCertaintyAssessment = gedcomLine.LineItem;
                    gedcom.IncrementLineIndex(1);
                    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 );

            // Parsing went ok. Construct a new object and return it.
            CSourceCitationXref sc = new CSourceCitationXref( gedcom );
            sc.m_xref = xref;
            sc.m_sWhereWithinSource = sWhereWithinSource;
            sc.m_sEventTypeCitedFrom = sEventTypeCitedFrom;
            sc.m_sRoleInEvent = sRoleInEvent;
            sc.m_sEntryRecordingDate = sEntryRecordingDate;
            sc.m_alTextsFromSource = alTextsFromSource;
            sc.m_alMultimediaLinks = alMultimediaLinks;
            sc.m_alNoteStructures = alNoteStructures;
            sc.m_sCertaintyAssessment = sCertaintyAssessment;
            return sc;
        }
 // Copy constructor
 public override CSourceCitation CopyConstructor()
 {
     CSourceCitationXref sc = new CSourceCitationXref( Gedcom );
     CopyFieldsInto( sc );
     sc.m_sWhereWithinSource = m_sWhereWithinSource;
     sc.m_sEventTypeCitedFrom = m_sEventTypeCitedFrom;
     sc.m_sRoleInEvent = m_sRoleInEvent;
     sc.m_sEntryRecordingDate = m_sEntryRecordingDate;
     sc.m_xref = m_xref;
     return sc;
 }
 // Tests to see if this source citation displays the same as the xref citation given.
 // Used to ensure the each source is added to the list at the bottom of the web page only once.
 public override bool SameAs(CSourceCitationXref sc)
 {
     return false;
 }