Example #1
0
        public void Test_GetTagProps()
        {
            GEDCOMTagProps props = GEDCOMTagsTable.GetTagProps(GEDCOMTagName.ADDR);

            Assert.IsNotNull(props);
            Assert.IsTrue(props.SkipEmpty);

            props = GEDCOMTagsTable.GetTagProps("test");
            Assert.IsNull(props);
        }
Example #2
0
        public static void RegisterTag(GEDCOMTagType tag, string tagName,
                                       TagConstructor constructor, AddTagHandler addHandler = null,
                                       SaveTagHandler saveHandler = null,
                                       bool skipEmpty             = false)
        {
            GEDCOMTagProps tagProps = RegisterTag(tag, tagName);

            tagProps.Constructor = constructor;
            tagProps.AddHandler  = addHandler;
            tagProps.SaveHandler = saveHandler;
            tagProps.SkipEmpty   = skipEmpty;
        }
Example #3
0
        public static GEDCOMTagProps RegisterTag(GEDCOMTagType tag, string tagName, bool skipEmpty = false)
        {
            GEDCOMTagProps tagProps;

            if (!fDictionary.TryGetValue(tagName, out tagProps))
            {
                int tagId = (int)tag;
                tagProps = new GEDCOMTagProps(tagId, tagName, skipEmpty);

                fDictionary.Add(tagName, tagProps);
                fList[tagId] = tagProps;
            }

            return(tagProps);
        }
Example #4
0
        public static GEDCOMTagProps RegisterTag(GEDCOMTagType tag, string tagName,
                                                 TagConstructor constructor = null, AddTagHandler addHandler = null,
                                                 SaveTagHandler saveHandler = null, bool skipEmpty           = false)
        {
            GEDCOMTagProps tagProps;

            if (!fDictionary.TryGetValue(tagName, out tagProps))
            {
                int tagId = (int)tag;
                tagProps = new GEDCOMTagProps(tagId, tagName, constructor, addHandler, saveHandler, skipEmpty);

                fDictionary.Add(tagName, tagProps);
                fList[tagId] = tagProps;
            }

            return(tagProps);
        }
Example #5
0
        public static int Lookup(string tagName)
        {
            GEDCOMTagProps tagProps;

            if (fDictionary.TryGetValue(tagName, out tagProps))
            {
                return(tagProps.TagId);
            }
            else
            {
                fLastId += 1;
                int tagId = (0x1 << 8) | fLastId;

                tagProps = new GEDCOMTagProps(tagId, tagName);

                fDictionary.Add(tagName, tagProps);
                fList[tagId] = tagProps;

                return(tagId);
            }
        }