Exemplo n.º 1
0
        public void ProcessNextLine(PropertyLine line)
        {
            if (line.Level == 1)
            {
                // reset date state machine
                inMarriage = false;
                inDivorce  = false;
            }

            switch (line.Keyword)
            {
            case "MARR":
                inMarriage = true;
                break;

            case "DIV":
                inDivorce = true;
                break;

            case "DATE":
                GeneaDate dt = GedcomDate.Parse(line.Value);
                if (dt != null)
                {
                    if (inMarriage)
                    {
                        this.family.MarriageDate = dt;
                    }
                    else if (inDivorce)
                    {
                        this.family.DivorceDate = dt;
                    }
                }
                break;

            case "PLAC":
                if (inMarriage)
                {
                    this.family.MarriagePlace = line.Value;
                }
                else if (inDivorce)
                {
                    this.family.DivorcePlace = line.Value;
                }
                break;

            case "CHIL":
                //  1 CHIL @I321@
                long cid = GedcomUtil.GetIdFromReference(line.Value);
                this.children.Add(cid);
                break;

            case "WIFE":
            // fall through to HUSB
            case "HUSB":
                long sid = GedcomUtil.GetIdFromReference(line.Value);
                this.spouses.Add(sid);
                break;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MutableGeneaDate"/> class, based on the supplied <see cref="GeneaDate"/>.
 /// </summary>
 /// <param name="date">The date.</param>
 /// <exception cref="ArgumentNullException">Date cannot be null.</exception>
 public MutableGeneaDate(GeneaDate date)
 {
     if (!(date is null))
     {
         this.Day      = date.Day;
         this.Month    = date.Month;
         this.Year     = date.Year;
         this.Accuracy = date.Accuracy;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Converts this to <see cref="GeneaDate"/>.
        /// </summary>
        /// <value>
        /// A genea date.
        /// </value>
        public GeneaDate ToGeneaDate()
        {
            if (this.Year <= 0)
            {
                this.Year     = 0;
                this.Accuracy = DateAccuracy.Unknown;
            }

            if (this.Month <= 0 || this.Month > 12)
            {
                this.Month    = 0;
                this.Accuracy = DateAccuracy.About;
            }

            if (this.Day <= 0 || this.Day > 31)
            {
                this.Day      = 0;
                this.Accuracy = DateAccuracy.About;
            }

            var gdate = new GeneaDate(this.Year, this.Month, this.Day, this.Accuracy);

            return(gdate);
        }
Exemplo n.º 4
0
        public void ProcessNextLine(PropertyLine line)
        {
            if (line.Level == 1)
            {
                // reset state machine
                inBirth = false;
                inDeath = false;
            }

            switch (line.Keyword)
            {
            case "NAME":
                ProcessName(line.Value);
                break;

            case "SEX":
                switch (line.Value)
                {
                case "M":
                    this.individual.Sex = Support.Sex.Male;
                    break;

                case "F":
                    this.individual.Sex = Support.Sex.Female;
                    break;
                }
                break;

            case "BIRT":
                inBirth = true;
                break;

            case "DEAT":
                inDeath = true;
                break;

            case "DATE":
                GeneaDate dt = GedcomDate.Parse(line.Value);
                if (dt != null)
                {
                    if (inBirth)
                    {
                        this.individual.BirthDate = dt;
                    }
                    else if (inDeath)
                    {
                        this.individual.DeathDate = dt;
                    }
                }
                break;

            case "PLAC":
                if (inBirth)
                {
                    this.individual.BirthPlace = line.Value;
                }
                else if (inDeath)
                {
                    this.individual.DeathPlace = line.Value;
                }
                break;
            }
        }