Ejemplo n.º 1
0
        internal static Hashtable parseNameValuePairs(string uri)
        {
            int num = uri.IndexOf('?');

            if (num < 0)
            {
                return(null);
            }
            Hashtable result = new Hashtable();

            num++;
            int num2;

            while ((num2 = uri.IndexOf('&', num)) >= 0)
            {
                ResultParser.appendKeyValue(uri, num, num2, result);
                num = num2 + 1;
            }
            ResultParser.appendKeyValue(uri, num, uri.Length, result);
            return(result);
        }
Ejemplo n.º 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 EmailAddressParsedResult parse(Result result)
        {
            string text = result.Text;

            if (text == null)
            {
                return(null);
            }
            string text2;

            if (text.StartsWith("mailto:") || text.StartsWith("MAILTO:"))
            {
                text2 = text.Substring(7);
                int num = text2.IndexOf('?');
                if (num >= 0)
                {
                    text2 = text2.Substring(0, num);
                }
                Hashtable hashtable = ResultParser.parseNameValuePairs(text);
                string    subject   = null;
                string    body      = null;
                if (hashtable != null)
                {
                    if (text2.Length == 0)
                    {
                        text2 = (string)hashtable["to"];
                    }
                    subject = (string)hashtable["subject"];
                    body    = (string)hashtable["body"];
                }
                return(new EmailAddressParsedResult(text2, subject, body, text));
            }
            if (!EmailDoCoMoResultParser.isBasicallyValidEmailAddress(text))
            {
                return(null);
            }
            text2 = text;
            return(new EmailAddressParsedResult(text2, null, null, "mailto:" + text2));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        private static string[] matchMultipleValuePrefix(string prefix, int max, string rawText, bool trim)
        {
            ArrayList arrayList = null;

            for (int i = 1; i <= max; i++)
            {
                string text = ResultParser.matchSinglePrefixedField(prefix + i + ':', rawText, '\r', trim);
                if (text == null)
                {
                    break;
                }
                if (arrayList == null)
                {
                    arrayList = new ArrayList();
                }
                arrayList.Add(text);
            }
            if (arrayList == null)
            {
                return(null);
            }
            return(ResultParser.toStringArray(arrayList));
        }
Ejemplo n.º 6
0
        private static string[] matchVCardPrefixedField(string prefix, string rawText, bool trim)
        {
            ArrayList arrayList = null;
            int       i         = 0;
            int       length    = rawText.Length;

            while (i < length)
            {
                i = rawText.IndexOf(prefix, i);
                if (i < 0)
                {
                    break;
                }
                if (i > 0 && rawText[i - 1] != '\n')
                {
                    i++;
                }
                else
                {
                    i += prefix.Length;
                    if (rawText[i] == ':' || rawText[i] == ';')
                    {
                        while (rawText[i] != ':')
                        {
                            i++;
                        }
                        i++;
                        int num = i;
                        i = rawText.IndexOf('\n', i);
                        if (i < 0)
                        {
                            i = length;
                        }
                        else
                        {
                            if (i > num)
                            {
                                if (arrayList == null)
                                {
                                    arrayList = new ArrayList();
                                }
                                string text = rawText.Substring(num, i - num);
                                if (trim)
                                {
                                    text = text.Trim();
                                }
                                arrayList.Add(text);
                                i++;
                            }
                            else
                            {
                                i++;
                            }
                        }
                    }
                }
            }
            if (arrayList == null || arrayList.Count == 0)
            {
                return(null);
            }
            return(ResultParser.toStringArray(arrayList));
        }
Ejemplo n.º 7
0
 private static bool isLikeVCardDate(string value_Renamed)
 {
     return(value_Renamed == null || ResultParser.isStringOfDigits(value_Renamed, 8) || (value_Renamed.Length == 10 && value_Renamed[4] == '-' && value_Renamed[7] == '-' && VCardResultParser.isSubstringOfDigits(value_Renamed, 0, 4) && VCardResultParser.isSubstringOfDigits(value_Renamed, 5, 2) && VCardResultParser.isSubstringOfDigits(value_Renamed, 8, 2)));
 }
 internal static string[] matchDoCoMoPrefixedField(string prefix, string rawText, bool trim)
 {
     return(ResultParser.matchPrefixedField(prefix, rawText, ';', trim));
 }
Ejemplo n.º 9
0
        public static SMSParsedResult parse(Result result)
        {
            string text = result.Text;

            if (text == null)
            {
                return(null);
            }
            int num;

            if (text.StartsWith("sms:") || text.StartsWith("SMS:") || text.StartsWith("mms:") || text.StartsWith("MMS:"))
            {
                num = 4;
            }
            else
            {
                if (!text.StartsWith("smsto:") && !text.StartsWith("SMSTO:") && !text.StartsWith("mmsto:") && !text.StartsWith("MMSTO:"))
                {
                    return(null);
                }
                num = 6;
            }
            Hashtable hashtable = ResultParser.parseNameValuePairs(text);
            string    subject   = null;
            string    text2     = null;
            bool      flag      = false;

            if (hashtable != null && hashtable.Count != 0)
            {
                subject = (string)hashtable["subject"];
                text2   = (string)hashtable["body"];
                flag    = true;
            }
            int    num2 = text.IndexOf('?', num);
            string text3;

            if (num2 < 0 || !flag)
            {
                text3 = text.Substring(num);
            }
            else
            {
                text3 = text.Substring(num, num2 - num);
            }
            int    num3 = text3.IndexOf(';');
            string text4;
            string via;

            if (num3 < 0)
            {
                text4 = text3;
                via   = null;
            }
            else
            {
                text4 = text3.Substring(0, num3);
                string text5 = text3.Substring(num3 + 1);
                if (text5.StartsWith("via="))
                {
                    via = text5.Substring(4);
                }
                else
                {
                    via = null;
                }
            }
            if (text2 == null)
            {
                int num4 = text4.IndexOf(':');
                if (num4 >= 0)
                {
                    text2 = text4.Substring(num4 + 1);
                    text4 = text4.Substring(0, num4);
                }
            }
            return(new SMSParsedResult("sms:" + text4, text4, via, subject, text2, null));
        }