public Attendee Deserialize(string attendee)
        {
            try
            {
                var a         = CreateAndAssociate() as Attendee;
                var uriString = Unescape(Decode(a, attendee));

                // Prepend "mailto:" if necessary
                if (!uriString.StartsWith("mailto:", StringComparison.OrdinalIgnoreCase) && AlmostPerfectEmailMatch.Match(uriString).Success)
                {
                    uriString = "mailto:" + uriString;
                }

                a.Value = new Uri(uriString);
                return(a);
            }
            catch
            {
                // ignored
            }

            return(null);
        }
Example #2
0
        public override object Deserialize(TextReader tr)
        {
            var value = tr.ReadToEnd();

            Organizer o = null;

            try
            {
                o = CreateAndAssociate() as Organizer;
                if (o != null)
                {
                    var uriString = Unescape(Decode(o, value));

                    uriString = DecodeUrlString(uriString); // in some iCal files the organizer e-mail address contains URL encoded special characters
                    uriString = HandleDualooCase(uriString);

                    // Prepend "mailto:" if necessary
                    if (!uriString.StartsWith("mailto:", StringComparison.OrdinalIgnoreCase) && AlmostPerfectEmailMatch.Match(uriString.ToLower()).Success)
                    {
                        uriString = "mailto:" + uriString;
                    }

                    o.Value = new Uri(uriString);
                }
            }
            catch {}

            return(o);
        }