Пример #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 void ProcessProperty(CalendarPropertyBase calendarProperty)
        {
            PropertyId propertyId = calendarProperty.CalendarPropertyId.PropertyId;

            if (propertyId == PropertyId.Unknown)
            {
                if (string.Compare(calendarProperty.CalendarPropertyId.PropertyName, "X-MICROSOFT-CALSCALE", StringComparison.CurrentCultureIgnoreCase) == 0)
                {
                    CalendarType?calendarType = CalendarUtil.CalendarTypeFromString((string)calendarProperty.Value);
                    if (calendarType != null)
                    {
                        base.Context.Type = calendarType.Value;
                        return;
                    }
                }
                else if (string.Compare(calendarProperty.CalendarPropertyId.PropertyName, "X-WR-CALNAME", StringComparison.CurrentCultureIgnoreCase) == 0)
                {
                    base.Context.CalendarName = (string)calendarProperty.Value;
                }
                return;
            }
            if (propertyId != PropertyId.Method)
            {
                return;
            }
            string strA = (string)calendarProperty.Value;

            if (string.Compare(strA, "PUBLISH", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                base.Context.Method = CalendarMethod.Publish;
                return;
            }
            if (string.Compare(strA, "REQUEST", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                base.Context.Method = CalendarMethod.Request;
                return;
            }
            if (string.Compare(strA, "CANCEL", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                base.Context.Method = CalendarMethod.Cancel;
                return;
            }
            if (string.Compare(strA, "REFRESH", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                base.Context.Method = CalendarMethod.Refresh;
                return;
            }
            if (string.Compare(strA, "REPLY", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                base.Context.Method = CalendarMethod.Reply;
                return;
            }
            if (string.Compare(strA, "COUNTER", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                base.Context.Method = CalendarMethod.Counter;
                return;
            }
            base.Context.Method = CalendarMethod.None;
        }
Пример #3
0
 protected static bool PromoteComment(VItemBase vitem, CalendarPropertyBase property)
 {
     if (vitem.body == null)
     {
         vitem.body = (string)property.Value;
     }
     return(true);
 }
Пример #4
0
 protected static bool PromoteSubject(VItemBase vitem, CalendarPropertyBase property)
 {
     if (vitem.Context.Method == CalendarMethod.Publish || vitem.GetValueOrDefault <string>(InternalSchema.Subject) == null)
     {
         vitem.SetProperty(InternalSchema.Subject, property.Value);
     }
     return(true);
 }
Пример #5
0
 protected static bool PromoteXImportance(VItemBase vitem, CalendarPropertyBase property)
 {
     if (!int.TryParse((string)property.Value, out vitem.importance))
     {
         ExTraceGlobals.ICalTracer.TraceError <LocalizedString>((long)vitem.GetHashCode(), "VEvent::PromoteXImportance. {0}.", ServerStrings.InvalidICalElement(property.CalendarPropertyId.PropertyId.ToString()));
         vitem.importance = 1;
     }
     return(true);
 }
Пример #6
0
        protected override void ProcessProperty(CalendarPropertyBase calendarProperty)
        {
            PropertyId propertyId = calendarProperty.CalendarPropertyId.PropertyId;

            if (propertyId != PropertyId.TimeZoneId)
            {
                return;
            }
            this.timeZoneId = CalendarUtil.RemoveDoubleQuotes((string)calendarProperty.Value);
        }
Пример #7
0
        protected override void ProcessProperty(CalendarPropertyBase calendarProperty)
        {
            PropertyId propertyId = calendarProperty.CalendarPropertyId.PropertyId;

            if (propertyId != PropertyId.Description)
            {
                switch (propertyId)
                {
                case PropertyId.Action:
                    if (string.Compare((string)calendarProperty.Value, "DISPLAY", StringComparison.CurrentCultureIgnoreCase) == 0)
                    {
                        this.action = VAlarmAction.Display;
                        return;
                    }
                    if (string.Compare((string)calendarProperty.Value, "EMAIL", StringComparison.CurrentCultureIgnoreCase) == 0)
                    {
                        this.action = VAlarmAction.Email;
                        return;
                    }
                    if (string.Compare((string)calendarProperty.Value, "AUDIO", StringComparison.CurrentCultureIgnoreCase) == 0)
                    {
                        this.action = VAlarmAction.Display;
                        return;
                    }
                    this.action = VAlarmAction.Unknown;
                    return;

                case PropertyId.Repeat:
                    break;

                case PropertyId.Trigger:
                    this.CheckTriggerArguments(calendarProperty);
                    this.value = calendarProperty.Value;
                    if (this.value != null && typeof(TimeSpan).GetTypeInfo().IsAssignableFrom(this.value.GetType().GetTypeInfo()))
                    {
                        this.valueType = CalendarValueType.Duration;
                        return;
                    }
                    if (this.value != null && typeof(DateTime).GetTypeInfo().IsAssignableFrom(this.value.GetType().GetTypeInfo()))
                    {
                        this.valueType = CalendarValueType.DateTime;
                        return;
                    }
                    this.valueType = calendarProperty.ValueType;
                    return;

                default:
                    return;
                }
            }
            else
            {
                this.message = (string)calendarProperty.Value;
            }
        }
        private bool ParseProperty(CalendarPropertyReader propertyReader)
        {
            bool result = false;
            CalendarPropertyBase calendarPropertyBase = this.NewProperty(propertyReader);

            if (calendarPropertyBase.Parse(propertyReader))
            {
                this.ProcessProperty(calendarPropertyBase);
                this.icalProperties.Add(calendarPropertyBase);
                result = true;
            }
            return(result);
        }
Пример #9
0
        protected override bool ValidateProperty(CalendarPropertyBase calendarProperty)
        {
            PropertyId propertyId = calendarProperty.CalendarPropertyId.PropertyId;

            if (propertyId == PropertyId.RecurrenceRule)
            {
                if (this.icalRecurrence != null)
                {
                    base.Context.AddError(ServerStrings.InvalidICalElement("VTIMEZONE.TimeZoneRule.RRULE.Duplicate"));
                    return(false);
                }
                this.icalRecurrence = (Recurrence)calendarProperty.Value;
            }
            return(true);
        }
Пример #10
0
 protected static bool PromotePriority(VItemBase vitem, CalendarPropertyBase property)
 {
     if (vitem.importance == -1)
     {
         int num = (int)property.Value;
         if (1 <= num && num <= 4)
         {
             vitem.importance = 2;
         }
         else if (6 <= num && num <= 9)
         {
             vitem.importance = 0;
         }
         else
         {
             vitem.importance = 1;
         }
     }
     return(true);
 }
Пример #11
0
 private void CheckTriggerArguments(CalendarPropertyBase property)
 {
     this.triggerRelationship = TriggerRelationship.None;
     foreach (CalendarParameter calendarParameter in property.Parameters)
     {
         if (calendarParameter.ParameterId == ParameterId.TriggerRelationship)
         {
             if (string.Compare((string)calendarParameter.Value, "START", StringComparison.CurrentCultureIgnoreCase) == 0)
             {
                 this.triggerRelationship = TriggerRelationship.Start;
                 break;
             }
             if (string.Compare((string)calendarParameter.Value, "END", StringComparison.CurrentCultureIgnoreCase) == 0)
             {
                 this.triggerRelationship = TriggerRelationship.End;
                 break;
             }
             this.triggerRelationship = TriggerRelationship.Unknown;
             break;
         }
     }
 }
Пример #12
0
        private static bool PromoteStatus(VTodo vtodo, CalendarPropertyBase property)
        {
            TaskStatus taskStatus = TaskStatus.NotStarted;

            if (string.Compare((string)property.Value, "IN-PROCESS", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                taskStatus = TaskStatus.InProgress;
            }
            else if (string.Compare((string)property.Value, "COMPLETED", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                taskStatus = TaskStatus.Completed;
            }
            else if (string.Compare((string)property.Value, "NEEDS-ACTION", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                taskStatus = TaskStatus.NotStarted;
            }
            else if (string.Compare((string)property.Value, "CANCELLED", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                taskStatus = TaskStatus.Deferred;
            }
            vtodo.SetProperty(InternalSchema.TaskStatus, taskStatus);
            return(true);
        }
Пример #13
0
        protected override bool ValidateProperty(CalendarPropertyBase calendarProperty)
        {
            bool       flag       = base.ValidateProperty(calendarProperty);
            PropertyId propertyId = calendarProperty.CalendarPropertyId.PropertyId;

            if (propertyId == PropertyId.DateTimeDue)
            {
                if (calendarProperty is CalendarDateTime)
                {
                    this.dueTime = (CalendarDateTime)calendarProperty;
                }
                else
                {
                    flag = false;
                }
            }
            if (!flag)
            {
                ExTraceGlobals.ICalTracer.TraceError <string>((long)this.GetHashCode(), "VTodo::ValidateProperty. Property validation failed. Property:'{1}'", calendarProperty.CalendarPropertyId.PropertyName);
                base.Context.AddError(ServerStrings.InvalidICalElement(calendarProperty.CalendarPropertyId.PropertyName));
            }
            return(flag);
        }
Пример #14
0
        protected override void ProcessProperty(CalendarPropertyBase calendarProperty)
        {
            PropertyId propertyId = calendarProperty.CalendarPropertyId.PropertyId;

            if (propertyId == PropertyId.Unknown)
            {
                if (string.Compare(calendarProperty.CalendarPropertyId.PropertyName, "X-MICROSOFT-RRULE", StringComparison.CurrentCultureIgnoreCase) == 0)
                {
                    this.hasRRule = true;
                }
                return;
            }
            if (propertyId == PropertyId.Uid)
            {
                this.uid = (calendarProperty.Value as string);
                return;
            }
            if (propertyId != PropertyId.RecurrenceRule)
            {
                return;
            }
            this.hasRRule = true;
        }
Пример #15
0
 private static bool PromoteDueDate(VTodo vtodo, CalendarPropertyBase property)
 {
     vtodo.SetProperty(InternalSchema.DueDate, property.Value);
     return(true);
 }
 protected virtual bool ValidateProperty(CalendarPropertyBase calendarProperty)
 {
     return(true);
 }
Пример #17
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);
        }
Пример #18
0
 protected static bool PromoteDescription(VItemBase vitem, CalendarPropertyBase property)
 {
     vitem.body = (string)property.Value;
     return(true);
 }
 protected virtual void ProcessProperty(CalendarPropertyBase calendarProperty)
 {
 }