protected static bool PromoteClass(VItemBase vitem, CalendarPropertyBase property) { string text = (string)property.Value; string a; if ((a = text.ToUpper()) != null) { if (a == "CONFIDENTIAL") { vitem.SetProperty(InternalSchema.Sensitivity, Sensitivity.CompanyConfidential); return(true); } if (a == "PRIVATE") { vitem.SetProperty(InternalSchema.Sensitivity, Sensitivity.Private); return(true); } if (a == "PERSONAL") { vitem.SetProperty(InternalSchema.Sensitivity, Sensitivity.Personal); return(true); } if (!(a == "PUBLIC")) { } } vitem.SetProperty(InternalSchema.Sensitivity, Sensitivity.Normal); return(true); }
protected static void DemoteXImportance(VItemBase vitem) { int valueOrDefault = vitem.GetValueOrDefault <int>(InternalSchema.Importance, 1); vitem.calendarWriter.StartProperty("X-MICROSOFT-CDO-IMPORTANCE"); vitem.calendarWriter.WritePropertyValue(valueOrDefault); }
private RecurrencePattern CreateMonthlyRecurrence(Recurrence icalRecurrence, ExDateTime start, CalendarType calendarType) { RecurrencePattern result = null; if (icalRecurrence.ByDayList == null && icalRecurrence.BySetPosition == null) { int dayOfMonth = (icalRecurrence.ByMonthDay != null) ? icalRecurrence.ByMonthDay[0] : start.Day; result = new MonthlyRecurrencePattern(dayOfMonth, icalRecurrence.Interval, calendarType); } else if (icalRecurrence.ByDayList != null && icalRecurrence.ByMonthDay == null) { DaysOfWeek daysOfWeek = VItemBase.DaysOfWeekFromByDayList(icalRecurrence.ByDayList, start); int occurrenceNumber = icalRecurrence.ByDayList[0].OccurrenceNumber; RecurrenceOrderType?recurrenceOrderType = null; if (icalRecurrence.BySetPosition != null) { if (occurrenceNumber == 0 && icalRecurrence.BySetPosition[0] >= -1 && icalRecurrence.BySetPosition[0] <= 4 && icalRecurrence.BySetPosition[0] != 0) { recurrenceOrderType = new RecurrenceOrderType?((RecurrenceOrderType)icalRecurrence.BySetPosition[0]); } } else if (occurrenceNumber != 0) { recurrenceOrderType = new RecurrenceOrderType?((RecurrenceOrderType)occurrenceNumber); } if (recurrenceOrderType != null) { result = new MonthlyThRecurrencePattern(daysOfWeek, recurrenceOrderType.Value, icalRecurrence.Interval, calendarType); } } return(result); }
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); }
protected static bool PromoteComment(VItemBase vitem, CalendarPropertyBase property) { if (vitem.body == null) { vitem.body = (string)property.Value; } return(true); }
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); }
protected static void DemoteDateTimeValue(VItemBase vevent, ExDateTime dateTime) { if (dateTime.TimeZone != ExTimeZone.UtcTimeZone) { vevent.calendarWriter.StartParameter(ParameterId.TimeZoneId); vevent.calendarWriter.WriteParameterValue(dateTime.TimeZone.AlternativeId); } vevent.calendarWriter.WritePropertyValue((DateTime)dateTime); }
private RecurrencePattern CreateWeeklyRecurrence(Recurrence icalRecurrence, ExDateTime start) { RecurrencePattern result; if (icalRecurrence.ByDayList != null) { DaysOfWeek daysOfWeek = VItemBase.DaysOfWeekFromByDayList(icalRecurrence.ByDayList, start); result = new WeeklyRecurrencePattern(daysOfWeek, icalRecurrence.Interval, icalRecurrence.WorkWeekStart); } else { result = new WeeklyRecurrencePattern((DaysOfWeek)(1 << (int)start.DayOfWeek), icalRecurrence.Interval, icalRecurrence.WorkWeekStart); } return(result); }
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); }
protected static void DemoteClass(VItemBase vitem) { string value; switch (vitem.GetValueOrDefault <Sensitivity>(InternalSchema.Sensitivity)) { case Sensitivity.Normal: value = "PUBLIC"; goto IL_44; case Sensitivity.Personal: value = "PERSONAL"; goto IL_44; case Sensitivity.CompanyConfidential: value = "CONFIDENTIAL"; goto IL_44; } value = "PRIVATE"; IL_44: vitem.calendarWriter.StartProperty(PropertyId.Class); vitem.calendarWriter.WritePropertyValue(value); }
protected void DemoteSimpleProperty(SchemaInfo schemaInfo) { PropertyDefinition propertyDefinition = (PropertyDefinition)schemaInfo.DemotionMethod; object obj = this.TryGetProperty(propertyDefinition); if (!(obj is PropertyError)) { if (schemaInfo.CalendarPropertyId.PropertyId != PropertyId.Unknown) { this.calendarWriter.StartProperty(schemaInfo.CalendarPropertyId.PropertyId); } else { this.calendarWriter.StartProperty(schemaInfo.CalendarPropertyId.PropertyName); } if (obj is ExDateTime) { VItemBase.DemoteDateTimeValue(this, (ExDateTime)obj); return; } this.calendarWriter.WritePropertyValue(obj); } }
protected static bool PromoteDescription(VItemBase vitem, CalendarPropertyBase property) { vitem.body = (string)property.Value; return(true); }
protected Recurrence ICalRecurrenceFromXsoRecurrence(Recurrence xsoRecurrence) { Recurrence recurrence = new Recurrence(); RecurrencePattern pattern = xsoRecurrence.Pattern; RecurrenceRange range = xsoRecurrence.Range; if (pattern is DailyRecurrencePattern) { recurrence.Frequency = Frequency.Daily; } else if (pattern is WeeklyRecurrencePattern) { recurrence.Frequency = Frequency.Weekly; WeeklyRecurrencePattern weeklyRecurrencePattern = (WeeklyRecurrencePattern)pattern; recurrence.ByDayList = VItemBase.ByDayListFromDaysOfWeek(weeklyRecurrencePattern.DaysOfWeek); recurrence.WorkWeekStart = weeklyRecurrencePattern.FirstDayOfWeek; } else if (pattern is MonthlyRecurrencePattern) { recurrence.Frequency = Frequency.Monthly; MonthlyRecurrencePattern monthlyRecurrencePattern = (MonthlyRecurrencePattern)pattern; recurrence.ByMonthDay = new int[] { monthlyRecurrencePattern.DayOfMonth }; } else if (pattern is MonthlyThRecurrencePattern) { recurrence.Frequency = Frequency.Monthly; MonthlyThRecurrencePattern monthlyThRecurrencePattern = (MonthlyThRecurrencePattern)pattern; recurrence.ByDayList = VItemBase.ByDayListFromDaysOfWeek(monthlyThRecurrencePattern.DaysOfWeek); int order = (int)monthlyThRecurrencePattern.Order; if (recurrence.ByDayList.Length == 1) { recurrence.ByDayList[0].OccurrenceNumber = order; } else { recurrence.BySetPosition = new int[] { order }; } } else if (pattern is YearlyRecurrencePattern) { recurrence.Frequency = Frequency.Yearly; YearlyRecurrencePattern yearlyRecurrencePattern = (YearlyRecurrencePattern)pattern; recurrence.ByMonth = new int[] { yearlyRecurrencePattern.Month }; recurrence.ByMonthDay = new int[] { yearlyRecurrencePattern.DayOfMonth }; } else if (pattern is YearlyThRecurrencePattern) { recurrence.Frequency = Frequency.Yearly; YearlyThRecurrencePattern yearlyThRecurrencePattern = (YearlyThRecurrencePattern)pattern; recurrence.ByMonth = new int[] { yearlyThRecurrencePattern.Month }; recurrence.ByDayList = VItemBase.ByDayListFromDaysOfWeek(yearlyThRecurrencePattern.DaysOfWeek); int order2 = (int)yearlyThRecurrencePattern.Order; if (recurrence.ByDayList.Length == 1) { recurrence.ByDayList[0].OccurrenceNumber = order2; } else { recurrence.BySetPosition = new int[] { order2 }; } } IntervalRecurrencePattern intervalRecurrencePattern = pattern as IntervalRecurrencePattern; if (intervalRecurrencePattern != null) { recurrence.Interval = intervalRecurrencePattern.RecurrenceInterval; } else { recurrence.Interval = 1; } if (range is EndDateRecurrenceRange) { EndDateRecurrenceRange endDateRecurrenceRange = (EndDateRecurrenceRange)range; recurrence.UntilDateTime = (DateTime)(endDateRecurrenceRange.EndDate + xsoRecurrence.StartOffset).ToUtc(); } else if (range is NumberedRecurrenceRange) { NumberedRecurrenceRange numberedRecurrenceRange = (NumberedRecurrenceRange)range; recurrence.Count = numberedRecurrenceRange.NumberOfOccurrences; } return(recurrence); }