Esempio n. 1
0
 private static bool TryDeserializeCalendar(
     string iCalData,
     out IICalendar calendar,
     WebResourceName uriOfCalendarForLogging,
     IStringSerializer calendarSerializer,
     ILoadEntityLogger logger)
 {
     calendar = null;
     try
     {
         calendar = DeserializeCalendar(iCalData, calendarSerializer);
         return(true);
     }
     catch (Exception x)
     {
         s_logger.Error(string.Format("Could not deserialize ICalData of '{0}'.", uriOfCalendarForLogging.OriginalAbsolutePath));
         s_logger.Debug(string.Format("ICalData:\r\n{0}", iCalData), x);
         logger.LogSkipLoadBecauseOfError(uriOfCalendarForLogging, x);
         return(false);
     }
 }
        private static bool TryDeserialize(
            string vcardData,
            out vCard vcard,
            WebResourceName uriOfAddressbookForLogging,
            vCardStandardReader deserializer,
            ILoadEntityLogger logger)
        {
            vcard = null;
            string fixedVcardData  = ContactDataPreprocessor.FixRevisionDate(vcardData);
            string fixedVcardData2 = ContactDataPreprocessor.FixUrlType(fixedVcardData);

            try
            {
                vcard = Deserialize(fixedVcardData2, deserializer);
                return(true);
            }
            catch (Exception x)
            {
                s_logger.Error(string.Format("Could not deserialize vcardData of '{0}':\r\n{1}", uriOfAddressbookForLogging, fixedVcardData2), x);
                logger.LogSkipLoadBecauseOfError(uriOfAddressbookForLogging, x);
                return(false);
            }
        }
Esempio n. 3
0
        protected override bool TryDeserialize(
            string vcardData,
            out vCard vcard,
            WebResourceName uriOfAddressbookForLogging,
            vCardStandardReader deserializer,
            ILoadEntityLogger logger)
        {
            vcard = null;

            // fix some linebreak issues with Open-Xchange
            string normalizedVcardData = vcardData.Contains("\r\r\n") ? ContactDataPreprocessor.NormalizeLineBreaks(vcardData) : vcardData;

            try
            {
                vcard = Deserialize(normalizedVcardData, deserializer);
                return(true);
            }
            catch (Exception x)
            {
                s_logger.Error(string.Format("Could not deserialize vcardData of '{0}':\r\n{1}", uriOfAddressbookForLogging, normalizedVcardData), x);
                logger.LogSkipLoadBecauseOfError(uriOfAddressbookForLogging, x);
                return(false);
            }
        }