// Helps in parsing the changes file private void ParseSecondary(ref CISRecordChanges isrc, string sSecondary) { string sCmd = ""; string sArg = ""; string sNum = ""; int nState = 0; foreach (char c in sSecondary) { switch (nState) { case 0: // Leading whitespace if (!char.IsWhiteSpace(c)) { sNum += c; nState = 1; } break; case 1: // Number if (char.IsDigit(c)) { sNum += c; } else { if (!char.IsWhiteSpace(c)) { sCmd += c; nState = 3; } nState = 2; } break; case 2: // Space after number if (!char.IsWhiteSpace(c)) { sCmd += c; nState = 3; } break; case 3: if (!char.IsWhiteSpace(c)) { sCmd += c; } else { nState = 4; } break; case 4: // Space after cmd if (!char.IsWhiteSpace(c)) { sArg += c; nState = 5; } break; case 5: sArg += c; break; } if (nState == 99) { // End of string parsing break; } } if (isrc != null) { switch (sCmd) { case "OBJE": { CMultimediaFileReference mfr = new CMultimediaFileReference(m_gedcom); mfr.m_bFromGEDCOM = false; isrc.m_alMfrs.Add(mfr); isrc.m_mfrCurrent = mfr; break; } case "FILE": if (isrc.m_mfrCurrent != null) { sArg = sArg.Replace('/', '\\'); isrc.m_mfrCurrent.m_sMultimediaFileReference = sArg; } break; case "FORM": if (isrc.m_mfrCurrent != null) { isrc.m_mfrCurrent.m_sMultimediaFormat = sArg; } break; case "TITL": if (isrc.m_mfrCurrent != null) { isrc.m_mfrCurrent.m_sDescriptiveTitle = sArg; } break; case "_ORDER": if (isrc.m_mfrCurrent != null) { isrc.m_mfrCurrent.m_nOrderIndex = int.Parse(sArg); } break; case "_VISIBLE": if (isrc.m_mfrCurrent != null) { isrc.m_mfrCurrent.m_bVisible = (sArg.ToUpper() == "TRUE") ? true : false; } break; case "_GEDCOM": if (isrc.m_mfrCurrent != null) { isrc.m_mfrCurrent.m_bFromGEDCOM = (sArg.ToUpper() == "TRUE") ? true : false; } break; case "_INLINE": if (isrc.m_mfrCurrent != null) { isrc.m_mfrCurrent.m_bEmbedded = true; isrc.m_mfrCurrent.m_xrefEmbedded = sArg; } break; case "_REGION": if (isrc.m_mfrCurrent != null) { int nFirstComma = sArg.IndexOf(','); if (nFirstComma > 0 && nFirstComma + 1 < sArg.Length) { string sAsid = sArg.Substring(0, nFirstComma); string sArea = sArg.Substring(nFirstComma + 1); CAsidPair asidPair = new CAsidPair(sAsid, sArea); isrc.m_mfrCurrent.m_asidPair = asidPair; } } break; } } return; }
// Copy constructor public CAsidPair( CAsidPair ap ) { m_sAsid = ap.m_sAsid; m_rectArea = ap.m_rectArea; }