Exemple #1
0
        public static AddressBookParsedResult parse(Result result)
        {
            string text = result.Text;

            if (text == null || !text.StartsWith("MECARD:"))
            {
                return(null);
            }
            string[] array = AbstractDoCoMoResultParser.matchDoCoMoPrefixedField("N:", text, true);
            if (array == null)
            {
                return(null);
            }
            string value_Renamed = AddressBookDoCoMoResultParser.parseName(array[0]);
            string pronunciation = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("SOUND:", text, true);

            string[] phoneNumbers = AbstractDoCoMoResultParser.matchDoCoMoPrefixedField("TEL:", text, true);
            string[] emails       = AbstractDoCoMoResultParser.matchDoCoMoPrefixedField("EMAIL:", text, true);
            string   note         = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("NOTE:", text, false);

            string[] addresses = AbstractDoCoMoResultParser.matchDoCoMoPrefixedField("ADR:", text, true);
            string   text2     = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("BDAY:", text, true);

            if (text2 != null && !ResultParser.isStringOfDigits(text2, 8))
            {
                text2 = null;
            }
            string url = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("URL:", text, true);
            string org = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("ORG:", text, true);

            return(new AddressBookParsedResult(ResultParser.maybeWrap(value_Renamed), pronunciation, phoneNumbers, emails, note, addresses, org, text2, null, url));
        }
Exemple #2
0
        public static AddressBookParsedResult parse(Result result)
        {
            string text = result.Text;

            if (text == null || text.IndexOf("MEMORY") < 0 || text.IndexOf("\r\n") < 0)
            {
                return(null);
            }
            string value_Renamed = ResultParser.matchSinglePrefixedField("NAME1:", text, '\r', true);
            string pronunciation = ResultParser.matchSinglePrefixedField("NAME2:", text, '\r', true);

            string[] phoneNumbers = AddressBookAUResultParser.matchMultipleValuePrefix("TEL", 3, text, true);
            string[] emails       = AddressBookAUResultParser.matchMultipleValuePrefix("MAIL", 3, text, true);
            string   note         = ResultParser.matchSinglePrefixedField("MEMORY:", text, '\r', false);
            string   text2        = ResultParser.matchSinglePrefixedField("ADD:", text, '\r', true);

            string[] addresses = (text2 == null) ? null : new string[]
            {
                text2
            };
            return(new AddressBookParsedResult(ResultParser.maybeWrap(value_Renamed), pronunciation, phoneNumbers, emails, note, addresses, null, null, null, null));
        }
        public static AddressBookParsedResult parse(Result result)
        {
            string text = result.Text;

            if (text == null || !text.StartsWith("BIZCARD:"))
            {
                return(null);
            }
            string firstName     = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("N:", text, true);
            string lastName      = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("X:", text, true);
            string value_Renamed = BizcardResultParser.buildName(firstName, lastName);
            string title         = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("T:", text, true);
            string org           = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("C:", text, true);

            string[] addresses      = AbstractDoCoMoResultParser.matchDoCoMoPrefixedField("A:", text, true);
            string   number         = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("B:", text, true);
            string   number2        = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("M:", text, true);
            string   number3        = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("F:", text, true);
            string   value_Renamed2 = AbstractDoCoMoResultParser.matchSingleDoCoMoPrefixedField("E:", text, true);

            return(new AddressBookParsedResult(ResultParser.maybeWrap(value_Renamed), null, BizcardResultParser.buildPhoneNumbers(number, number2, number3), ResultParser.maybeWrap(value_Renamed2), null, addresses, org, null, title, null));
        }