예제 #1
0
        /// <summary>
        /// Outputs this instance as a GEDCOM record.
        /// </summary>
        /// <param name="tw">The writer to output to.</param>
        public override void Output(TextWriter tw)
        {
            tw.WriteLine();
            tw.Write(Util.IntToString(Level));
            tw.Write(" SLGS ");

            if (!string.IsNullOrEmpty(Description))
            {
                tw.Write(Description);
            }

            if (date != null)
            {
                date.Output(tw);
            }

            if (place != null)
            {
                place.Output(tw);
            }

            var levelPlusOne = Util.IntToString(Level + 1);

            if (!string.IsNullOrWhiteSpace(templeCode))
            {
                tw.WriteLine();
                tw.Write(levelPlusOne);
                tw.Write(" TEMP ");
                tw.Write(templeCode);
            }

            if (status != SpouseSealingDateStatus.NotSet)
            {
                tw.WriteLine();
                tw.Write(levelPlusOne);
                tw.Write(" STAT ");
                tw.Write(EnumHelper.ToDescription(status));

                if (StatusChangeDate != null)
                {
                    var levelPlusTwo = Util.IntToString(Level + 2);

                    tw.Write(Environment.NewLine);
                    tw.Write(levelPlusTwo);
                    tw.Write(" CHAN ");
                    StatusChangeDate.Output(tw);
                }
            }

            OutputStandard(tw);
        }
예제 #2
0
        /// <summary>
        /// Outputs the specified sw.
        /// </summary>
        /// <param name="sw">The sw.</param>
        public override void Output(TextWriter sw)
        {
            sw.Write(Environment.NewLine);
            sw.Write(Util.IntToString(Level));
            sw.Write(" ");

            sw.Write(GedcomTag);

            if (!string.IsNullOrEmpty(eventName))
            {
                sw.Write(" ");
                sw.Write(eventName);
            }

            OutputStandard(sw);

            string levelPlusOne = null;

            if (!string.IsNullOrEmpty(classification))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(Level + 1);
                }

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" TYPE ");
                sw.Write(classification);
            }

            if (date != null)
            {
                date.Output(sw);
            }

            if (place != null)
            {
                place.Output(sw);
            }

            if (address != null)
            {
                address.Output(sw, Level + 1);
            }

            if (!string.IsNullOrEmpty(responsibleAgency))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(Level + 1);
                }

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" AGNC ");
                string line = responsibleAgency.Replace("@", "@@");
                sw.Write(line);
            }

            if (!string.IsNullOrEmpty(religiousAffiliation))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(Level + 1);
                }

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" RELI ");
                string line = religiousAffiliation.Replace("@", "@@");
                sw.Write(line);
            }

            if (!string.IsNullOrEmpty(cause))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(Level + 1);
                }

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" CAUS ");
                string line = cause.Replace("@", "@@");
                sw.Write(line);
            }

            if (RestrictionNotice != GedcomRestrictionNotice.None)
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(Level + 1);
                }

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" RESN ");
                sw.Write(RestrictionNotice.ToString());
            }

            // Quality of data should only be on source citations according to
            // the spec.
            // We output it on events as well as it has been seen in GEDCOM
            // files from other apps
            if (Certainty != GedcomCertainty.Unknown)
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(Level + 1);
                }

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" QUAY ");
                sw.Write(Util.IntToString((int)Certainty));
            }
        }