コード例 #1
0
ファイル: TestUtils.cs プロジェクト: Akeloya/GEDKeeper
        public static string GetTagStreamText(GDMTag tag, int level)
        {
            GEDCOMProvider.DebugWrite = true;

            string result;

            using (MemoryStream stm = new MemoryStream()) {
                using (StreamWriter fs = new StreamWriter(stm)) {
                    if (tag is GDMRecord)
                    {
                        GEDCOMProvider.WriteRecordEx(fs, tag as GDMRecord);
                    }
                    else
                    {
                        if (tag is GDMPersonalName)
                        {
                            GEDCOMProvider.WritePersonalName(fs, 1, tag);
                        }
                        else if (tag is GDMMultimediaLink)
                        {
                            GEDCOMProvider.WriteMultimediaLink(fs, 1, tag);
                        }
                        else if (tag is GDMSourceCitation)
                        {
                            GEDCOMProvider.WriteSourceCitation(fs, 1, tag);
                        }
                        else if (tag is GDMSourceData)
                        {
                            GEDCOMProvider.WriteSourceData(fs, 1, tag);
                        }
                        else
                        {
                            GEDCOMProvider.WriteTagEx(fs, level, tag);
                        }
                    }
                    fs.Flush();
                    result = Encoding.ASCII.GetString(stm.ToArray());
                }
            }
            return(result);
        }