Exemplo n.º 1
0
        public override string ParseString(string strValue)
        {
            // Format: AFT DATE, BEF DATE, BET AFT_DATE AND BEF_DATE

            fDateAfter.Clear();
            fDateBefore.Clear();

            string result = strValue;

            if (!string.IsNullOrEmpty(result))
            {
                string su = result.Substring(0, 3).ToUpperInvariant();

                if (su == GEDCOMDateRangeArray[0])
                {
                    result = result.Remove(0, 3);
                    result = GEDCOMUtils.ExtractDelimiter(result, 0);
                    result = fDateAfter.ParseString(result);
                }
                else if (su == GEDCOMDateRangeArray[1])
                {
                    result = result.Remove(0, 3);
                    result = GEDCOMUtils.ExtractDelimiter(result, 0);
                    result = fDateBefore.ParseString(result);
                }
                else if (su == GEDCOMDateRangeArray[2])
                {
                    result = result.Remove(0, 3);
                    result = GEDCOMUtils.ExtractDelimiter(result, 0);
                    result = GEDCOMProvider.FixFTB(result);
                    result = fDateAfter.ParseString(result);
                    result = GEDCOMUtils.ExtractDelimiter(result, 0);

                    su = result.Substring(0, 3).ToUpper();

                    if (su == GEDCOMDateRangeArray[3])
                    {
                        result = result.Remove(0, 3);
                        result = GEDCOMUtils.ExtractDelimiter(result, 0);
                        result = GEDCOMProvider.FixFTB(result);
                        result = fDateBefore.ParseString(result);
                    }
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        public void testParseString_system()
        {
            string     strValue  = "20.12.1980";
            GEDCOMDate instance  = new GEDCOMDate(null, null, "", "");
            string     expResult = "";
            string     result    = instance.ParseString(strValue);

            Assert.AreEqual(expResult, result);
            Assert.AreEqual("20 DEC 1980", instance.StringValue);
        }
Exemplo n.º 3
0
        public void testParseStringUnknown()
        {
            string     strValue = "@#DUNKNOWN@ 20 DEC 1980";
            GEDCOMDate instance = new GEDCOMDate(null, null, "", "");

            instance.SetDate(GEDCOMCalendar.dcIslamic, 0, 0, 0);
            string expResult = "";
            string result    = instance.ParseString(strValue);

            Assert.AreEqual(expResult, result);
            Assert.AreEqual("@#DUNKNOWN@ 20 DEC 1980", instance.StringValue);
        }
Exemplo n.º 4
0
        public void testGetYearModifier()
        {
            GEDCOMDate instance  = new GEDCOMDate(null, null, "", "");
            string     expResult = "";
            string     result    = instance.YearModifier;

            Assert.AreEqual(expResult, result);
            instance.ParseString("20 DEC 1980/1");
            expResult = "1";
            result    = instance.YearModifier;
            Assert.AreEqual(expResult, result);
        }
Exemplo n.º 5
0
        public override string ParseString(string strValue)
        {
            // Format: FROM DATE1 TO DATE2

            string result = strValue;

            if (!string.IsNullOrEmpty(result))
            {
                if (result.StartsWith("FROM"))
                {
                    result = result.Remove(0, 4);
                    result = GEDCOMUtils.ExtractDelimiter(result, 0);
                    result = fDateFrom.ParseString(result);
                    result = GEDCOMUtils.ExtractDelimiter(result, 0);
                }
                if (result.StartsWith("TO"))
                {
                    result = result.Remove(0, 2);
                    result = GEDCOMUtils.ExtractDelimiter(result, 0);
                    result = fDateTo.ParseString(result);
                }
            }
            return(result);
        }