コード例 #1
0
        protected override bool ProcessSubComponent(CalendarComponentBase calendarComponent)
        {
            bool         result       = true;
            TimeZoneRule timeZoneRule = calendarComponent as TimeZoneRule;

            if (timeZoneRule != null)
            {
                ushort      year        = timeZoneRule.Year;
                ComponentId componentId = calendarComponent.ComponentId;
                if (componentId != ComponentId.Standard)
                {
                    if (componentId == ComponentId.Daylight)
                    {
                        if (this.daylightRules.ContainsKey(year))
                        {
                            ExTraceGlobals.ICalTracer.TraceError <ushort>(0L, "VTimeZone::ProcessSubComponent:ComponentId.Daylight. Ignoring the repeated year timezone definition. Year: {0}", year);
                        }
                        else
                        {
                            this.daylightRules.Add(year, timeZoneRule);
                        }
                    }
                }
                else if (this.standardRules.ContainsKey(year))
                {
                    ExTraceGlobals.ICalTracer.TraceError <ushort>(0L, "VTimeZone::ProcessSubComponent:ComponentId.Standard. Ignoring the repeated year timezone definition. Year: {0}", year);
                }
                else
                {
                    this.standardRules.Add(year, timeZoneRule);
                }
            }
            return(result);
        }
コード例 #2
0
        private bool ParseSubComponent(CalendarReader calReader)
        {
            CalendarComponentBase calendarComponentBase = this.NewComponent(calReader);
            bool result;

            if (calendarComponentBase.Parse(calReader))
            {
                if (this.ProcessSubComponent(calendarComponentBase))
                {
                    this.subComponents.Add(calendarComponentBase);
                    result = true;
                }
                else
                {
                    ExTraceGlobals.ICalTracer.TraceError <string>((long)this.GetHashCode(), "CalendarComponentBase::ParseSubComponent. Failed to process component: {0}", calendarComponentBase.componentName);
                    result = false;
                }
            }
            else
            {
                ExTraceGlobals.ICalTracer.TraceError <string>((long)this.GetHashCode(), "CalendarComponentBase::ParseSubComponent. Failed to parse component: {0}", calendarComponentBase.componentName);
                result = false;
            }
            return(result);
        }
コード例 #3
0
        protected bool NormalizeCalendarDateTime(CalendarDateTime property)
        {
            if (property == null)
            {
                return(true);
            }
            bool       flag     = true;
            ExTimeZone timeZone = ExTimeZone.UnspecifiedTimeZone;

            if (!string.IsNullOrEmpty(property.TimeZoneId))
            {
                timeZone = this.InboundContext.DeclaredTimeZones[property.TimeZoneId];
            }
            List <object> list = property.Value as List <object>;
            object        value2;

            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    object value;
                    if (!CalendarComponentBase.NormalizeSingleDateTime(timeZone, list[i], out value))
                    {
                        flag = false;
                        break;
                    }
                    list[i] = value;
                }
            }
            else if (!CalendarComponentBase.NormalizeSingleDateTime(timeZone, property.Value, out value2))
            {
                flag = false;
            }
            else
            {
                property.Value = value2;
            }
            if (!flag)
            {
                this.Context.AddError(ServerStrings.InvalidICalElement(property.CalendarPropertyId.ToString()));
            }
            return(flag);
        }
コード例 #4
0
ファイル: VItemBase.cs プロジェクト: YHZX2013/exchange_diff
        protected override bool ProcessSubComponent(CalendarComponentBase calendarComponent)
        {
            ComponentId componentId = calendarComponent.ComponentId;

            if (componentId == ComponentId.VAlarm)
            {
                VAlarm valarm = (VAlarm)calendarComponent;
                if (valarm.Action == VAlarmAction.Display)
                {
                    if (this.displayVAlarm == null)
                    {
                        this.displayVAlarm = valarm;
                    }
                    else
                    {
                        ExTraceGlobals.ICalTracer.TraceDebug((long)this.GetHashCode(), "VItemBase::ProcessSubComponent. Ignoring additional display VALARMs in VItemBase.");
                    }
                }
                else if (valarm.Action == VAlarmAction.Email)
                {
                    if (this.emailVAlarms == null)
                    {
                        this.emailVAlarms = new List <VAlarm>();
                    }
                    if (this.emailVAlarms.Count < 12)
                    {
                        this.emailVAlarms.Add(valarm);
                    }
                    else
                    {
                        ExTraceGlobals.ICalTracer.TraceDebug <int>((long)this.GetHashCode(), "VItemBase::ProcessSubComponent. Ignoring email VALARM in VItemBase because max limit of {0} is reached.", 12);
                    }
                }
                else
                {
                    ExTraceGlobals.ICalTracer.TraceDebug((long)this.GetHashCode(), "VItemBase::ProcessSubComponent. Ignoring VALARM with unsupported action type in VItemBase.");
                }
            }
            return(true);
        }
コード例 #5
0
 internal VTodo(CalendarComponentBase root) : base(root)
 {
 }
コード例 #6
0
        protected override bool ProcessSubComponent(CalendarComponentBase calendarComponent)
        {
            bool        result      = true;
            ComponentId componentId = calendarComponent.ComponentId;

            if (componentId != ComponentId.VEvent)
            {
                if (componentId != ComponentId.VTodo)
                {
                    if (componentId == ComponentId.VTimeZone)
                    {
                        VTimeZone vtimeZone = (VTimeZone)calendarComponent;
                        if (!vtimeZone.Validate())
                        {
                            result = false;
                        }
                        else
                        {
                            ExTimeZone exTimeZone = vtimeZone.Promote();
                            if (exTimeZone == null)
                            {
                                result = false;
                            }
                            else if (base.InboundContext.DeclaredTimeZones.ContainsKey(exTimeZone.AlternativeId))
                            {
                                ExTraceGlobals.ICalTracer.TraceError <string>((long)this.GetHashCode(), "VCalendar::ProcessSubComponent. Duplicate time zone id in VTIMEZONE. TZID:'{0}'.", exTimeZone.AlternativeId);
                                base.Context.AddError(ServerStrings.InvalidICalElement("VTIMEZONE"));
                                result = false;
                            }
                            else
                            {
                                base.InboundContext.DeclaredTimeZones.Add(exTimeZone.AlternativeId, exTimeZone);
                            }
                        }
                    }
                }
                else
                {
                    if (this.vTodos == null)
                    {
                        this.vTodos = new List <VTodo>();
                    }
                    this.vTodos.Add((VTodo)calendarComponent);
                }
            }
            else
            {
                VEvent vevent = (VEvent)calendarComponent;
                if (vevent.HasRecurrenceId)
                {
                    if (this.exceptions == null)
                    {
                        this.exceptions = new List <VEvent>();
                    }
                    this.exceptions.Add(vevent);
                }
                else
                {
                    if (this.vEvents == null)
                    {
                        this.vEvents = new List <VEvent>();
                    }
                    this.vEvents.Add(vevent);
                }
            }
            return(result);
        }
コード例 #7
0
 internal TimeZoneRule(CalendarComponentBase root) : base(root)
 {
 }
コード例 #8
0
ファイル: VAlarm.cs プロジェクト: YHZX2013/exchange_diff
 internal VAlarm(CalendarComponentBase root) : base(root)
 {
 }
コード例 #9
0
 internal VTimeZone(CalendarComponentBase root, REG_TIMEZONE_INFO tzInfo, string timeZoneId) : base(root)
 {
     this.timeZoneInfo = tzInfo;
     this.timeZoneId   = timeZoneId;
 }
コード例 #10
0
 internal VTimeZone(CalendarComponentBase root) : base(root)
 {
     this.standardRules = new Dictionary <ushort, TimeZoneRule>();
     this.daylightRules = new Dictionary <ushort, TimeZoneRule>();
 }
コード例 #11
0
ファイル: VItemBase.cs プロジェクト: YHZX2013/exchange_diff
 internal VItemBase(CalendarComponentBase root) : base(root)
 {
 }
コード例 #12
0
 protected virtual bool ProcessSubComponent(CalendarComponentBase calendarComponent)
 {
     return(true);
 }
コード例 #13
0
 private CalendarComponentBase(CalendarComponentBase root, ICalContext context)
 {
     this.root    = (root ?? this);
     this.context = context;
 }
コード例 #14
0
 protected CalendarComponentBase(CalendarComponentBase root) : this(root, root.context)
 {
 }