コード例 #1
0
        // Parses a HEADER from LINEAGE_LINKED GEDCOM. Returns false if parsing failed and leaves streamReader in its original state.
        private bool ParseHeader()
        {
            CGedcomLine gedcomLine = (CGedcomLine)m_alLines[ m_nLineIndex ];
            if( gedcomLine == null || gedcomLine.Tag.Length<4 || gedcomLine.Tag.Substring(0,4) != "HEAD" )
            {
                // No HEAD tag found (FTM 2006 seems to use "HEADER" instead of "HEAD".)
                return false;
            }
            m_nLineIndex++;

            m_header = new CHeader();

            for(;;)
            {
                gedcomLine = (CGedcomLine)m_alLines[ m_nLineIndex ];
                if( gedcomLine.Level != 1 )
                {
                    // Either we have the start of another nLevel 0, or an out of sequence nLevel
                    return true;
                }
                switch( gedcomLine.Tag )
                {
                    case "SOUR":
                        ParseApprovedSystemId();
                        break;
                    case "DEST":
                        m_header.m_sReceivingSystemName = gedcomLine.LineItem;
                        m_nLineIndex++;
                        break;
                    case "DATE":
                        ParseTransmissionDate();
                        break;
                    case "SUBM":
                        m_header.m_xrefSubM = gedcomLine.XrefID;
                        m_nLineIndex++;
                        break;
                    case "SUBN":
                        m_header.m_xrefSubN = gedcomLine.XrefID;
                        m_nLineIndex++;
                        break;
                    case "FILE":
                        m_header.m_sFilename = gedcomLine.LineItem;
                        m_nLineIndex++;
                        break;
                    case "COPR":
                        m_header.m_sCopyright2 = gedcomLine.LineItem;
                        m_nLineIndex++;
                        break;
                    case "GEDC":
                        ParseGedcomVersion();
                        break;
                    case "CHAR":
                        ParseCharacterSet();
                        break;
                    case "LANG":
                        m_header.m_sLanguage = gedcomLine.LineItem;
                        m_nLineIndex++;
                        break;
                    case "PLAC":
                        ParsePlaceHierarchy();
                        break;
                    case "NOTE":
                        m_header.m_sGedcomContentDescription = gedcomLine.LineItem;
                        m_nLineIndex++;
                        break;
                    case "CONT":
                    case "CONC":
                        m_header.m_sGedcomContentDescription += gedcomLine.LineItem;
                        m_nLineIndex++;
                        break;
                    default:
                        // Unknown tag, move on to next gedcomLine
                        m_nLineIndex++;
                        break;
                }
            }
        }
コード例 #2
0
 // Initialise all data of gedcom parser
 private void ClearOutParser()
 {
     m_alLines = new ArrayList();
     m_nBytesRead = 0;
     m_nBytesTotal = 0;
     m_nLineIndex = 0;
     m_alFamilyRecords = new ArrayList();
     m_htFamilyRecordsXref = new Hashtable();
     m_alIndividualRecords = new ArrayList();
     m_htIndividualRecordsXref = new Hashtable();
     m_alMultimediaRecords = new ArrayList();
     m_alNoteRecords = new ArrayList();
     m_alRepositoryRecords = new ArrayList();
     m_alSourceRecords = new ArrayList();
     m_htSourceRecordsXref = new Hashtable();
     m_alSubmitterRecords = new ArrayList();
     m_header = null;
     m_submissionRecord = null;
     m_bDataMayStartWithWhitespace = true;
     m_ecCharset = ECharset.Unknown8bit;
 }