Exemple #1
0
        public static CalendarParsedResult parse(Result result)
        {
            System.String rawText = result.Text;
            if (rawText == null)
            {
                return(null);
            }
            int vEventStart = rawText.IndexOf("BEGIN:VEVENT");

            if (vEventStart < 0)
            {
                return(null);
            }
            int vEventEnd = rawText.IndexOf("END:VEVENT");

            if (vEventEnd < 0)
            {
                return(null);
            }

            System.String summary = VCardResultParser.matchSingleVCardPrefixedField("SUMMARY", rawText, true);
            System.String start   = VCardResultParser.matchSingleVCardPrefixedField("DTSTART", rawText, true);
            System.String end     = VCardResultParser.matchSingleVCardPrefixedField("DTEND", rawText, true);
            try
            {
                return(new CalendarParsedResult(summary, start, end, null, null, null));
            }
            catch (System.ArgumentException)
            {
                return(null);
            }
        }
Exemple #2
0
        public static ParsedResult parseResult(Result theResult)
        {
            // This is a bit messy, but given limited options in MIDP / CLDC, this may well be the simplest
            // way to go about this. For example, we have no reflection available, really.
            // Order is important here.
            ParsedResult result;

            if ((result = BookmarkDoCoMoResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = AddressBookDoCoMoResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = EmailDoCoMoResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = AddressBookAuResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = VCardResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = BizcardResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = VEventResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = EmailAddressResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = TelResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = SMSMMSResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = GeoResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = URLTOResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = URIResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            else if ((result = ISBNResultParser.parse(theResult)) != null)
            {
                // We depend on ISBN parsing coming before UPC, as it is a subset.
                return(result);
            }
            else if ((result = ProductResultParser.parse(theResult)) != null)
            {
                return(result);
            }
            return(new TextParsedResult(theResult.Text, null));
        }