Exemple #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);
 }
Exemple #2
0
        protected override bool ProcessParameter(CalendarParameter parameter)
        {
            ParameterId parameterId = parameter.ParameterId;

            if (parameterId <= ParameterId.Delegatee)
            {
                if (parameterId <= ParameterId.CalendarUserType)
                {
                    if (parameterId != ParameterId.CommonName)
                    {
                        if (parameterId == ParameterId.CalendarUserType)
                        {
                            this.calendarUserType = (string)parameter.Value;
                        }
                    }
                    else
                    {
                        this.name = CalendarUtil.RemoveDoubleQuotes((string)parameter.Value);
                    }
                }
                else if (parameterId != ParameterId.Delegator && parameterId != ParameterId.Delegatee)
                {
                }
            }
            else if (parameterId <= ParameterId.ParticipationRole)
            {
                if (parameterId != ParameterId.ParticipationStatus)
                {
                    if (parameterId == ParameterId.ParticipationRole)
                    {
                        this.role = (string)parameter.Value;
                    }
                }
                else
                {
                    this.partstat = (string)parameter.Value;
                }
            }
            else if (parameterId != ParameterId.RsvpExpectation)
            {
                if (parameterId == ParameterId.SentBy)
                {
                    string text = CalendarUtil.RemoveDoubleQuotes((string)parameter.Value);
                    if (text != null)
                    {
                        text = CalendarUtil.RemoveMailToPrefix(text);
                    }
                    this.sentBy = text;
                }
            }
            else if (!bool.TryParse(parameter.Value as string, out this.isResponseRequested))
            {
                this.isResponseRequested = true;
            }
            return(true);
        }
        protected override bool ProcessParameter(CalendarParameter parameter)
        {
            ParameterId parameterId = parameter.ParameterId;

            if (parameterId == ParameterId.TimeZoneId)
            {
                this.timeZoneId = (string)parameter.Value;
            }
            return(true);
        }
        internal bool Parse(CalendarPropertyReader propertyReader)
        {
            this.calendarPropertyId = new CalendarPropertyId(propertyReader.PropertyId, propertyReader.Name);
            this.value      = null;
            this.valueType  = propertyReader.ValueType;
            this.parameters = new List <CalendarParameter>();
            CalendarParameterReader parameterReader = propertyReader.ParameterReader;

            while (parameterReader.ReadNextParameter())
            {
                CalendarParameter calendarParameter = new CalendarParameter();
                if (!calendarParameter.Parse(parameterReader) || !this.ProcessParameter(calendarParameter))
                {
                    return(false);
                }
                this.parameters.Add(calendarParameter);
            }
            this.valueType = propertyReader.ValueType;
            SchemaInfo schemaInfo;

            if (VEvent.GetConversionSchema().TryGetValue(this.calendarPropertyId.Key, out schemaInfo) && schemaInfo.IsMultiValue)
            {
                List <object> list = new List <object>();
                while (propertyReader.ReadNextValue())
                {
                    object item = this.ReadValue(propertyReader);
                    list.Add(item);
                }
                this.value = list;
            }
            else
            {
                this.value = this.ReadValue(propertyReader);
            }
            return(this.Validate());
        }
 protected virtual bool ProcessParameter(CalendarParameter parameter)
 {
     return(true);
 }
Exemple #6
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);
        }