Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GedcomSubmitterRecord"/> class.
        /// </summary>
        /// <param name="database">The database to associate with this record.</param>
        public GedcomSubmitterRecord(GedcomDatabase database)
            : this()
        {
            Database = database;

            Level  = 0;
            XRefID = database.GenerateXref("S");

            database.Add(XRefID, this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GedcomNoteRecord"/> class.
        /// </summary>
        /// <param name="database">The database to associate with this record.</param>
        public GedcomNoteRecord(GedcomDatabase database)
            : this()
        {
            Level    = 0;
            Database = database;
            XRefID   = database.GenerateXref("NOTE");
            Text     = string.Empty;

            database.Add(XRefID, this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GedcomRepositoryRecord"/> class.
        /// </summary>
        /// <param name="database">The database to associate with this record.</param>
        public GedcomRepositoryRecord(GedcomDatabase database)
            : this()
        {
            Database = database;
            Level    = 0;

            Name = "New Repository";

            XRefID = database.GenerateXref("REPO");
            database.Add(XRefID, this);
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GedcomFamilyRecord" /> class.
        /// </summary>
        /// <param name="database">The database to associate with this record.</param>
        /// <param name="indi1">The first individual.</param>
        /// <param name="indi2">The second individual.</param>
        public GedcomFamilyRecord(GedcomDatabase database, GedcomIndividualRecord indi1, GedcomIndividualRecord indi2)
            : this()
        {
            Level    = 0;
            Database = database;
            XRefID   = database.GenerateXref("FAM");

            if (indi1 != null)
            {
                GedcomFamilyLink link = new GedcomFamilyLink();
                link.Database   = database;
                link.Family     = XRefID;
                link.Individual = indi1.XRefID;
                indi1.SpouseIn.Add(link);

                if (indi2 != null)
                {
                    link            = new GedcomFamilyLink();
                    link.Database   = database;
                    link.Family     = XRefID;
                    link.Individual = indi2.XRefID;
                    indi2.SpouseIn.Add(link);
                }

                switch (indi1.Sex)
                {
                case GedcomSex.Female:
                    Wife = indi1.XRefID;
                    if (indi2 != null)
                    {
                        Husband = indi2.XRefID;
                    }

                    break;

                default:
                    // got to put some where if not male or female,
                    // go with same as male
                    Husband = indi1.XRefID;
                    if (indi2 != null)
                    {
                        Wife = indi2.XRefID;
                    }

                    break;
                }
            }

            database.Add(XRefID, this);
        }
        /// <summary>
        /// Gets the TODO: Doc
        /// </summary>
        /// <value>
        /// The <see cref="string"/>.
        /// </value>
        /// <param name="str">The string.</param>
        /// <param name="startIndex">The start index.</param>
        /// <param name="length">The length.</param>
        /// <returns>TODO: Doc</returns>
        public override string this[string str, int startIndex, int length]
        {
            get
            {
                string ret = null;

                int  pos;
                bool found = Find(str, startIndex, length, out pos);

                if (!found)
                {
                    Strings.Insert(pos, str.Substring(startIndex, length).Trim());
                    if (replaceXrefs)
                    {
                        int prefixLen = 0;
                        while (char.IsLetter(str[prefixLen]))
                        {
                            prefixLen++;
                        }

                        string prefix;
                        if (prefixLen > 0)
                        {
                            prefix = str.Substring(0, prefixLen);
                        }
                        else
                        {
                            prefix = "XREF";
                        }

                        replacementXRefs.Insert(pos, database.GenerateXref(prefix));
                    }
                }

                if (replaceXrefs)
                {
                    ret = replacementXRefs[pos];
                }
                else
                {
                    ret = Strings[pos];
                }

                return(ret);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GedcomSourceRecord"/> class.
        /// </summary>
        /// <param name="database">The database to associate with this record.</param>
        public GedcomSourceRecord(GedcomDatabase database)
            : this()
        {
            Database = database;
            Level    = 0;

            Title = "New Source";

            // default to filer being current user
#if __MonoCS__
            // bug in mono code, doesn't correctly get the real name, need to strip off , chars
            FiledBy = UnixUserInfo.GetRealUser().RealName.Trim(new char[] { ',' });
#endif

            if (string.IsNullOrEmpty(FiledBy))
            {
                FiledBy = Environment.UserName;
            }

            XRefID = database.GenerateXref("SOURCE");
            database.Add(XRefID, this);
        }