/// <summary> /// Lookup possible information on child legal status. /// It is stored in separate chunks outside the Individual and Family chunks. /// </summary> private static void AddStatus(this ResultContainer resultContainer, ChildRelation childRelation) { var childChunk = resultContainer.GetIdChunk(childRelation.From.Id); if (childChunk != null) { foreach (var chunk1 in childChunk.SubChunks) { switch (chunk1.Type) { case "FAMC": foreach (var chunk2 in chunk1.SubChunks) { switch (chunk2.Type) { case "PEDI": childRelation.Pedigree = chunk2.Data; break; case "STAT": childRelation.Validity = chunk2.Data; break; case "ADOP": var adoptionInfo = new List <string>(); foreach (var chunk3 in chunk1.SubChunks) { switch (chunk3.Type) { case "DATE": adoptionInfo.Add(chunk3.ParseDateTime()); break; case "STAT": case "NOTE": adoptionInfo.Add(chunk3.Data); break; } } childRelation.Adoption = string.Join(", ", adoptionInfo); break; default: resultContainer.Errors.Add($"Failed to handle Status Type='{chunk2.Type}"); break; } } break; } } } }
internal static string ParseNote(this ResultContainer resultContainer, string previousNote, GedcomChunk incomingChunk) { var noteChunk = incomingChunk; if (incomingChunk.Reference.IsSpecified()) { noteChunk = resultContainer.GetIdChunk(noteChunk.Reference); if (noteChunk == null) { throw new Exception($"Unable to find Note with Id='{incomingChunk.Reference}'"); } } var sb = new StringBuilder(); foreach (var chunk in noteChunk.SubChunks) { if (chunk.IsUnwantedBlob()) { sb.AppendLine("(Skipped blob content)"); break; } switch (chunk.Type) { case "CONC": sb.Append(" " + chunk.Data); break; case "CONT": sb.AppendLine(chunk.Data); break; // Deliberately skipped for now case "_PLC": case "DATE": case "PLAC": case "SOUR": resultContainer.Warnings.Add($"Skipped Note Type='{chunk.Type}'"); break; default: resultContainer.Errors.Add($"Failed to handle Note Type='{chunk.Type}'"); break; } } return(previousNote.IsSpecified() ? previousNote + Environment.NewLine + sb : sb.ToString()); }