Пример #1
0
 private bool ProcessXAltDesc(CalendarPropertyBase calendarProperty)
 {
     this.xAltDesc = (calendarProperty.Value as string);
     if (this.xAltDesc != null)
     {
         this.TweakOutlookSquigglie();
         CalendarParameter parameter = calendarProperty.GetParameter(ParameterId.FormatType);
         if (parameter != null)
         {
             string text = parameter.Value as string;
             if (text != null)
             {
                 text = text.ToLowerInvariant();
                 string a;
                 if ((a = text) != null)
                 {
                     if (a == "text/plain")
                     {
                         this.bodyFormat = BodyFormat.TextPlain;
                         return(true);
                     }
                     if (a == "text/html")
                     {
                         this.bodyFormat = BodyFormat.TextHtml;
                         return(true);
                     }
                 }
                 return(false);
             }
         }
     }
     return(true);
 }
Пример #2
0
        protected override bool ValidateProperty(CalendarPropertyBase calendarProperty)
        {
            bool       result     = true;
            PropertyId propertyId = calendarProperty.CalendarPropertyId.PropertyId;

            if (propertyId <= PropertyId.DateTimeStart)
            {
                if (propertyId != PropertyId.Unknown)
                {
                    if (propertyId == PropertyId.DateTimeStart)
                    {
                        if (calendarProperty is CalendarDateTime)
                        {
                            this.dtStart = (CalendarDateTime)calendarProperty;
                        }
                        else
                        {
                            result = false;
                        }
                    }
                }
                else if (string.Compare(calendarProperty.CalendarPropertyId.PropertyName, "X-MICROSOFT-RRULE", StringComparison.CurrentCultureIgnoreCase) == 0)
                {
                    Recurrence recurrence = calendarProperty.Value as Recurrence;
                    if (this.xicalRule != null || recurrence == null || !this.ValidateRRule(recurrence))
                    {
                        result = false;
                    }
                    else
                    {
                        this.xicalRule = recurrence;
                        CalendarParameter parameter = calendarProperty.GetParameter("X-MICROSOFT-ISLEAPMONTH");
                        if (parameter != null)
                        {
                            bool?flag = CalendarUtil.BooleanFromString((string)parameter.Value);
                            if (flag == null)
                            {
                                result = false;
                            }
                            else
                            {
                                this.isLeapMonth = flag.Value;
                            }
                        }
                    }
                }
                else if (string.Compare(calendarProperty.CalendarPropertyId.PropertyName, "X-ALT-DESC", StringComparison.CurrentCultureIgnoreCase) == 0)
                {
                    result = this.ProcessXAltDesc(calendarProperty);
                }
            }
            else if (propertyId != PropertyId.Uid)
            {
                if (propertyId == PropertyId.RecurrenceRule)
                {
                    Recurrence recurrence2 = calendarProperty.Value as Recurrence;
                    if (this.icalRule != null || recurrence2 == null || !this.ValidateRRule(recurrence2))
                    {
                        result = false;
                    }
                    else
                    {
                        this.icalRule = recurrence2;
                    }
                }
            }
            else
            {
                string text = calendarProperty.Value as string;
                if (text == null)
                {
                    result = false;
                }
                else
                {
                    this.uid = text;
                }
            }
            return(result);
        }